diff --git a/src/components/Library/LibraryContentPreview.tsx b/src/components/Library/LibraryContentPreview.tsx new file mode 100644 index 0000000..3501fb7 --- /dev/null +++ b/src/components/Library/LibraryContentPreview.tsx @@ -0,0 +1,48 @@ +import Link from "next/link"; +import { GetContentsQuery } from "graphql/operations-types"; +import { getAssetURL, prettySlug } from "queries/helpers"; +import Image from "next/image"; + +export type LibraryContentPreviewProps = { + item: { + slug: GetContentsQuery["contents"]["data"][number]["attributes"]["slug"]; + thumbnail: GetContentsQuery["contents"]["data"][number]["attributes"]["thumbnail"]; + titles: GetContentsQuery["contents"]["data"][number]["attributes"]["titles"]; + }; +}; + +export default function LibraryContentPreview( + props: LibraryContentPreviewProps +): JSX.Element { + const item = props.item; + + return ( + +
{item.titles[0].pre_title}
+event - {item.release_date ? prettyDate(item.release_date) : ""} + {prettyDate(item.release_date)}
) : ( "" @@ -64,3 +64,4 @@ export default function LibraryItemComponent( ); } + diff --git a/src/components/Library/LibraryMediaPreview.tsx b/src/components/Library/LibraryMediaPreview.tsx new file mode 100644 index 0000000..ec531d6 --- /dev/null +++ b/src/components/Library/LibraryMediaPreview.tsx @@ -0,0 +1,67 @@ +import Link from "next/link"; +import { GetLibraryItemsPreviewQuery } from "graphql/operations-types"; +import { getAssetURL, prettyDate, prettyPrice } from "queries/helpers"; +import Image from "next/image"; + +export type LibraryContentPreviewProps = { + item: { + slug: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["slug"]; + thumbnail: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["thumbnail"]; + title: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["title"]; + subtitle: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["subtitle"]; + price?: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["price"]; + release_date?: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["release_date"]; + }; +}; + +export default function LibraryContentPreview( + props: LibraryContentPreviewProps +): JSX.Element { + const item = props.item; + + return ( + ++ + event + + {prettyDate(item.release_date)} +
+ ) : ( + "" + )} + {item.price ? ( ++ + shopping_cart + + {prettyPrice(item.price)} +
+ ) : ( + "" + )} +