diff --git a/front/src/components/entries/entry-line.tsx b/front/src/components/entries/entry-line.tsx index bf00a095..3d4315c8 100644 --- a/front/src/components/entries/entry-line.tsx +++ b/front/src/components/entries/entry-line.tsx @@ -105,7 +105,7 @@ export const EntryLine = ({ > {t("show.videosCount", { number: videosCount })} diff --git a/front/src/components/items/watchlist-info.tsx b/front/src/components/items/watchlist-info.tsx index 614bc5cc..51d454a8 100644 --- a/front/src/components/items/watchlist-info.tsx +++ b/front/src/components/items/watchlist-info.tsx @@ -2,12 +2,13 @@ import BookmarkAdd from "@material-symbols/svg-400/rounded/bookmark_add.svg"; import BookmarkAdded from "@material-symbols/svg-400/rounded/bookmark_added-fill.svg"; import BookmarkRemove from "@material-symbols/svg-400/rounded/bookmark_remove.svg"; import Bookmark from "@material-symbols/svg-400/rounded/bookmark-fill.svg"; -import type { ComponentProps } from "react"; import { useTranslation } from "react-i18next"; import type { Serie } from "~/models"; -import { IconButton, Menu, tooltip } from "~/primitives"; +import { IconButton, Menu, PressableFeedback, tooltip } from "~/primitives"; import { useAccount } from "~/providers/account-context"; import { useMutation } from "~/query"; +import { ComponentProps } from "react"; +import { PressableProps } from "react-native"; type WatchStatus = NonNullable["status"]; const WatchStatus = [ @@ -40,7 +41,7 @@ export const WatchListInfo = ({ kind: "movie" | "serie" | "episode"; slug: string; status: WatchStatus | null; -}) => { +} & Partial>>) => { const account = useAccount(); const { t } = useTranslation(); @@ -94,7 +95,7 @@ export const WatchListInfo = ({ Trigger={IconButton} icon={watchListIcon(status)} {...tooltip(t("show.watchlistEdit"))} - {...props} + {...(props as any)} > {Object.values(WatchStatus).map((x) => ( { return ( - -

{rating ? rating / 10 : "??"} / 10

+ +

+ {rating ? rating / 10 : "??"} / 10 +

); }; -Rating.Loader = ({ className, ...props }: { className?: string }) => { +Rating.Loader = ({ + className, + textClassName, + iconClassName, + ...props +}: { + className?: string; + textClassName?: string; + iconClassName?: string; +}) => { return ( - - + + ); }; diff --git a/front/src/primitives/chip.tsx b/front/src/primitives/chip.tsx index 4ecc25e0..245342c0 100644 --- a/front/src/primitives/chip.tsx +++ b/front/src/primitives/chip.tsx @@ -1,82 +1,58 @@ -import { type TextProps, View } from "react-native"; -import { px, rem, type Theme, useYoshiki } from "yoshiki/native"; +import { View } from "react-native"; +import { cn } from "~/utils"; import { Link } from "./links"; import { Skeleton } from "./skeleton"; import { P } from "./text"; -import { capitalize, ts } from "./utils"; +import { capitalize } from "./utils"; export const Chip = ({ - color, size = "medium", outline = false, label, href, replace, target, - textProps, + className, ...props }: { - color?: string; size?: "small" | "medium" | "large"; outline?: boolean; label: string; href: string | null; replace?: boolean; target?: string; - textProps?: TextProps; + className?: string; }) => { - const { css } = useYoshiki("chip"); - - textProps ??= {}; - - const sizeMult = size === "medium" ? 1 : size === "small" ? 0.5 : 1.5; - return ( theme.accent), - borderStyle: "solid", - borderWidth: px(1), - fover: { - self: { - bg: (theme: Theme) => theme.accent, - }, - text: { - color: (theme: Theme) => theme.alternate.contrast, - }, - }, - }, - !outline && { - bg: color ?? ((theme: Theme) => theme.accent), - }, - ], - props, + className={cn( + "group justify-center overflow-hidden rounded-4xl border border-accent outline-0", + size === "small" && "px-2.5 py-1", + size === "medium" && "px-5 py-2", + size === "large" && "px-10 py-4", + outline && "hover:bg-accent focus:bg-accent", + !outline && "bg-accent hover:bg-background focus:bg-background", + className, )} + {...props} >

- outline ? theme.contrast : theme.alternate.contrast, - }, - ], - textProps, + className={cn( + outline && + cn( + "dark:text-slate-300", + "group-hover:text-slate-200 group-focus:text-slate-200", + ), + !outline && + cn( + "text-slate-200 dark:text-slate-300", + "group-hover:text-slate-600 group-focus:text-slate-600", + "dark:group-focus:text-slate-300 dark:group-hover:text-slate-300", + ), + size === "small" && "text-sm", )} > {capitalize(label)} @@ -86,42 +62,28 @@ export const Chip = ({ }; Chip.Loader = ({ - color, size = "medium", outline = false, + className, ...props }: { - color?: string; size?: "small" | "medium" | "large"; outline?: boolean; + className?: string; }) => { - const { css } = useYoshiki(); - const sizeMult = size === "medium" ? 1 : size === "small" ? 0.5 : 1.5; - return ( theme.accent), - borderStyle: "solid", - borderWidth: px(1), - }, - !outline && { - bg: color ?? ((theme: Theme) => theme.accent), - }, - ], - props, + className={cn( + "group justify-center overflow-hidden rounded-4xl border border-accent outline-0", + size === "small" && "px-2.5 py-1", + size === "medium" && "px-5 py-2", + size === "large" && "px-10 py-4", + !outline && "bg-accent", + className, )} + {...props} > - + ); }; diff --git a/front/src/primitives/divider.tsx b/front/src/primitives/divider.tsx index 9a5b24f0..dacaced4 100644 --- a/front/src/primitives/divider.tsx +++ b/front/src/primitives/divider.tsx @@ -12,7 +12,7 @@ export const HR = ({ return ( { const BaseIcon = withUniwind(IconWrapper, { stroke: { - fromClassName: "strokeClassName", + fromClassName: "className", styleProperty: "accentColor", }, fill: { - fromClassName: "fillClassName", - styleProperty: "accentColor", + fromClassName: "className", + styleProperty: "fill", }, width: { - fromClassName: "widthClassName", + fromClassName: "className", styleProperty: "width", }, height: { - fromClassName: "heightClassName", + fromClassName: "className", styleProperty: "height", }, }); export const Icon = ({ className, - fillClassName, - widthClassName, - heightClassName, ...props }: ComponentProps) => { return ( ); @@ -60,7 +55,7 @@ export const IconButton = ({ }: { as?: ComponentType; icon: Icon; - iconProps?: Exclude, "icon">; + iconProps?: Omit, "icon">; className?: string; } & AsProps) => { const Container = as ?? PressableFeedback; @@ -69,18 +64,18 @@ export const IconButton = ({ - + ); }; -const AIconButton = Animated.createAnimatedComponent(IconButton); +const Pressable = Animated.createAnimatedComponent(PressableFeedback); export const IconFab = ({ icon, @@ -88,21 +83,35 @@ export const IconFab = ({ iconProps, ...props }: ComponentProps>) => { + const [hover, setHover] = useState(false); + const [focus, setFocus] = useState(false); return ( - setHover(true)} + onHoverOut={() => setHover(false)} + onFocus={() => setFocus(true)} + onBlur={() => setFocus(false)} style={{ - transform: [{ scale: 1.3 }], + transform: hover || focus ? [{ scale: 1.3 }] : [], transitionProperty: "transform", - transitionDuration: 3000, + transitionDuration: "150ms", }} {...(props as AsProps)} - /> + > + + ); }; diff --git a/front/src/primitives/image-background.tsx b/front/src/primitives/image-background.tsx index 01bd63df..235e8ce2 100644 --- a/front/src/primitives/image-background.tsx +++ b/front/src/primitives/image-background.tsx @@ -8,7 +8,6 @@ import { useYoshiki } from "yoshiki/native"; import type { KImage } from "~/models"; import { useToken } from "~/providers/account-context"; import { cn } from "~/utils"; -import type { ImageLayout, YoshikiEnhanced } from "./image"; const ImgBg = withUniwind(EImageBackground); @@ -19,7 +18,6 @@ export const ImageBackground = ({ src, quality, alt, - layout, className, ...props }: { @@ -27,7 +25,6 @@ export const ImageBackground = ({ quality: "low" | "medium" | "high"; alt?: string; style?: ImageStyle; - layout?: ImageLayout; children: ReactNode; className?: string; }) => { @@ -57,21 +54,14 @@ export const ImageBackground = ({ }; export const PosterBackground = ({ alt, - layout, + className, ...props -}: Omit, "layout"> & { - style?: ImageStyle; - layout: YoshikiEnhanced< - { width: ImageStyle["width"] } | { height: ImageStyle["height"] } - >; -}) => { - const { css } = useYoshiki(); - +}: ComponentProps) => { return ( ); }; diff --git a/front/src/primitives/image.tsx b/front/src/primitives/image.tsx index 32d0482f..35ac523b 100644 --- a/front/src/primitives/image.tsx +++ b/front/src/primitives/image.tsx @@ -1,10 +1,11 @@ import { Image as EImage } from "expo-image"; import type { ComponentProps } from "react"; -import { type ImageStyle, Platform, type ViewStyle } from "react-native"; -import { useYoshiki } from "yoshiki/native"; +import { type ImageStyle, Platform } from "react-native"; +import { withUniwind } from "uniwind"; import type { YoshikiStyle } from "yoshiki/src/type"; import type { KImage } from "~/models"; import { useToken } from "~/providers/account-context"; +import { cn } from "~/utils"; import { Skeleton } from "./skeleton"; export type YoshikiEnhanced