import { useState } from "react"; import { Platform, View } from "react-native"; import { percent, px, rem, useYoshiki } from "yoshiki/native"; import type { KyooImage, WatchStatusV } from "~/models"; import { GradientImageBackground, Heading, Link, P, Poster, PosterBackground, Skeleton, imageBorderRadius, important, ts, } from "~/primitives"; import type { Layout } from "~/query"; import { ItemWatchStatus } from "./item-helpers"; export const ItemList = ({ href, slug, type, name, subtitle, thumbnail, poster, watchStatus, unseenEpisodesCount, ...props }: { href: string; slug: string; type: "movie" | "show" | "collection"; name: string; subtitle: string | null; poster: KyooImage | null; thumbnail: KyooImage | null; watchStatus: WatchStatusV | null; unseenEpisodesCount: number | null; }) => { const { css } = useYoshiki("line"); const [moreOpened, setMoreOpened] = useState(false); return ( setMoreOpened(true)} {...css( { alignItems: "center", justifyContent: "space-evenly", flexDirection: "row", height: ItemList.layout.size, borderRadius: px(imageBorderRadius), overflow: "hidden", marginX: ItemList.layout.gap, child: { more: { opacity: 0, }, }, fover: { title: { textDecorationLine: "underline", }, more: { opacity: 100, }, }, }, props, )} > {name} {type !== "collection" && ( setMoreOpened(v)} {...css([ { // I dont know why marginLeft gets overwritten by the margin: px(2) so we important marginLeft: important(ts(2)), bg: (theme) => theme.darkOverlay, }, "more", Platform.OS === "web" && moreOpened && { opacity: important(100) }, ])} /> )} {subtitle && (

{subtitle}

)}
); }; ItemList.Loader = (props: object) => { const { css } = useYoshiki(); return ( theme.dark.background, marginX: ItemList.layout.gap, }, props, )} > ); }; ItemList.layout = { numColumns: 1, size: 300, layout: "vertical", gap: ts(2), } satisfies Layout;