diff --git a/front/packages/primitives/src/button.tsx b/front/packages/primitives/src/button.tsx index a00fe936..d38cca8d 100644 --- a/front/packages/primitives/src/button.tsx +++ b/front/packages/primitives/src/button.tsx @@ -28,7 +28,7 @@ export const Button = ({ text, ...props }: { text: string } & ComponentProps) => { - const { css } = useYoshiki(); + const { css } = useYoshiki("button"); return ( . */ -import { px, rem, Stylable, Theme, useYoshiki } from "yoshiki/native"; +import { px, rem, Theme, useYoshiki } from "yoshiki/native"; +import { Link } from "./links"; import { P } from "./text"; -import { ts } from "./utils"; -import { A } from "./links"; -import { ComponentType } from "react"; +import { capitalize, ts } from "./utils"; +import { EnhancedStyle } from "yoshiki/src/native/type"; +import { TextProps, TextStyle, ViewStyle } from "react-native"; +import { Skeleton } from "./skeleton"; -export const Chip = ({ +export const Chip = ({ color, size = "medium", outline = false, - as, + label, + href, + replace, + target, + textProps, ...props }: { color?: string; size?: "small" | "medium" | "large"; outline?: boolean; - as?: ComponentType; -} & AsProps) => { - const { css } = useYoshiki(); + label?: string; + href?: string; + replace?: boolean; + target?: string; + textProps?: TextProps; +}) => { + const { css } = useYoshiki("chip"); + + textProps ??= {}; const sizeMult = size == "medium" ? 1 : size == "small" ? 0.5 : 1.5; - const As = as ?? (P as any); - // @ts-ignore backward compatibilty - if (!as && props.label) props.children = props.label; - return ( - theme.alternate.contrast, - bg: color ?? ((theme: Theme) => theme.accent), + overflow: "hidden", }, outline && { borderColor: color ?? ((theme: Theme) => 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, )} - /> + > +

(outline ? theme.contrast : theme.alternate.contrast), + }, + ], + textProps, + )} + > + {label ? capitalize(label) : } +

+ ); }; diff --git a/front/packages/primitives/src/links.tsx b/front/packages/primitives/src/links.tsx index d93e31e7..c59994be 100644 --- a/front/packages/primitives/src/links.tsx +++ b/front/packages/primitives/src/links.tsx @@ -19,7 +19,7 @@ */ import { forwardRef, ReactNode } from "react"; -import { Platform, Pressable, TextProps, View, PressableProps } from "react-native"; +import { Platform, Pressable, TextProps, View, PressableProps, Linking } from "react-native"; import { TextLink, useLink } from "solito/link"; import { useTheme, useYoshiki } from "yoshiki/native"; import { alpha } from "./themes"; @@ -107,7 +107,16 @@ export const Link = ({ // @ts-ignore Missing hrefAttrs type definition. linkProps.hrefAttrs = { ...linkProps.hrefAttrs, target }; return ( - + { + props?.onPress?.(e); + if (e?.defaultPrevented) return; + if (Platform.OS !== "web" && href?.includes("://")) Linking.openURL(href); + else linkProps.onPress(e); + }} + > {children} ); diff --git a/front/packages/ui/src/components/rating.tsx b/front/packages/ui/src/components/rating.tsx index e6ac1801..19817265 100644 --- a/front/packages/ui/src/components/rating.tsx +++ b/front/packages/ui/src/components/rating.tsx @@ -30,7 +30,7 @@ export const Rating = ({ rating, color }: { rating?: number; color: Breakpoint - {rating !== undefined &&

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

} + {rating !== undefined &&

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

}
); diff --git a/front/packages/ui/src/details/episode.tsx b/front/packages/ui/src/details/episode.tsx index fa4f93d6..b26c5b09 100644 --- a/front/packages/ui/src/details/episode.tsx +++ b/front/packages/ui/src/details/episode.tsx @@ -172,7 +172,7 @@ export const EpisodeLine = ({ watchedStatus: WatchStatusV | null; }> & Stylable) => { - const { css } = useYoshiki(); + const { css } = useYoshiki("episode-line"); const { t } = useTranslation(); return ( diff --git a/front/packages/ui/src/details/header.tsx b/front/packages/ui/src/details/header.tsx index 124eeb4e..7ffac9ae 100644 --- a/front/packages/ui/src/details/header.tsx +++ b/front/packages/ui/src/details/header.tsx @@ -52,7 +52,7 @@ import { } from "@kyoo/primitives"; import { Fragment } from "react"; import { useTranslation } from "react-i18next"; -import { ImageStyle, Platform, View } from "react-native"; +import { ImageStyle, Platform, Text, View } from "react-native"; import { Theme, md, @@ -458,28 +458,17 @@ export const Header = ({

{t("show.links")}:

{(!isLoading ? Object.entries(data.externalId!).filter(([_, data]) => data.link) - : [...Array(3)].map((_, i) => [i, undefined] as const) - ).map(([name, data]) => ( + : [...Array(3)].map((_) => [undefined, undefined] as const) + ).map(([name, data], i) => ( theme.contrast, - fover: { - self: { - color: (theme: Theme) => theme.alternate.contrast, - bg: (theme: Theme) => theme.accent, - }, - }, - }) as any)} - > - {data ? capitalize(name) : } - + {...css({ m: ts(0.5) })} + /> ))} {type === "show" && (data.watchStatus as ShowWatchStatus)?.nextEpisode && ( diff --git a/front/packages/ui/src/home/recommanded.tsx b/front/packages/ui/src/home/recommanded.tsx index ddd6b098..226925b2 100644 --- a/front/packages/ui/src/home/recommanded.tsx +++ b/front/packages/ui/src/home/recommanded.tsx @@ -166,9 +166,7 @@ export const ItemDetails = ({ {(isLoading || genres) && ( {(genres || [...Array(3)])?.map((x, i) => ( - - {x ?? } - + ))} )}