diff --git a/front/src/components/entries/select.tsx b/front/src/components/entries/select.tsx index 6dfc467d..e4e48776 100644 --- a/front/src/components/entries/select.tsx +++ b/front/src/components/entries/select.tsx @@ -1,15 +1,16 @@ -import { H1, P, Popup } from "~/primitives"; +import { P, Popup } from "~/primitives"; export const EntrySelect = ({ name, videos, + close, }: { name: string; videos: { slug: string; path: string }[]; + close?: () => void; }) => { return ( - -

{name}

+ {videos.map((x) => (

{x.path}

))} diff --git a/front/src/primitives/modal.tsx b/front/src/primitives/modal.tsx index 72c4711f..2e6c96e9 100644 --- a/front/src/primitives/modal.tsx +++ b/front/src/primitives/modal.tsx @@ -1,16 +1,15 @@ -import Close from "@material-symbols/svg-400/rounded/close.svg"; import { Stack, useRouter } from "expo-router"; import type { ReactNode } from "react"; -import { Pressable, ScrollView, View } from "react-native"; -import { cn } from "~/utils"; -import { IconButton } from "./icons"; -import { Heading } from "./text"; +import type { Icon } from "./icons"; +import { Overlay } from "./popup"; export const Modal = ({ + icon, title, children, scroll = true, }: { + icon?: Icon; title: string; children: ReactNode; scroll?: boolean; @@ -31,28 +30,9 @@ export const Modal = ({ }, }} /> - - e.preventDefault()} - > - - {title} - - - {scroll ? ( - {children} - ) : ( - {children} - )} - - + + {children} + ); }; diff --git a/front/src/primitives/popup.tsx b/front/src/primitives/popup.tsx index e5332b07..16fba948 100644 --- a/front/src/primitives/popup.tsx +++ b/front/src/primitives/popup.tsx @@ -1,65 +1,70 @@ import { usePortal } from "@gorhom/portal"; +import Close from "@material-symbols/svg-400/rounded/close.svg"; import { type ReactNode, useCallback, useEffect, useState } from "react"; -import { ScrollView, View } from "react-native"; -import { px, vh } from "yoshiki/native"; -import { Container } from "./container"; -import { ContrastArea, SwitchVariant, type YoshikiFunc } from "./theme"; -import { ts } from "./utils"; +import { Pressable, ScrollView, View } from "react-native"; +import { cn } from "~/utils"; +import { Icon, IconButton, type Icon as IconType } from "./icons"; +import { Heading } from "./text"; -export const Popup = ({ +export const Overlay = ({ + icon, + title, + close, children, - ...props + scroll = true, }: { - children: ReactNode | YoshikiFunc; + icon?: IconType; + title: string; + close?: () => void; + children: ReactNode; + scroll?: boolean; }) => { return ( - - - {({ css, theme }) => ( - theme.themeOverlay, - justifyContent: "center", - alignItems: "center", - })} - > - theme.background, - overflow: "hidden", - }, - props, - )} - > - - {typeof children === "function" - ? children({ css, theme }) - : children} - - - + + - + onPress={(e) => e.preventDefault()} + > + + + {icon && } + {title} + + {close && } + + {scroll ? ( + {children} + ) : ( + {children} + )} + + + ); +}; + +export const Popup = ({ + icon, + title, + close, + children, + scroll, +}: { + icon?: IconType; + title: string; + close?: () => void; + children: ReactNode; + scroll?: boolean; +}) => { + return ( + + {children} + ); }; diff --git a/front/src/ui/details/serie.tsx b/front/src/ui/details/serie.tsx index 81fdf845..204b55f7 100644 --- a/front/src/ui/details/serie.tsx +++ b/front/src/ui/details/serie.tsx @@ -108,16 +108,22 @@ export const SerieDetails = () => { const { scrollHandler, headerProps, headerHeight } = useScrollNavbar({ imageHeight, }); - const [setPopup] = usePopup(); + const [setPopup, closePopup] = usePopup(); const openEntrySelect = useCallback( (entry: { name: string | null; videos: { slug: string; path: string }[]; }) => { - setPopup(); + setPopup( + , + ); }, - [setPopup], + [setPopup, closePopup], ); return ( diff --git a/front/src/ui/settings/account.tsx b/front/src/ui/settings/account.tsx index 6497edb4..c24712cb 100644 --- a/front/src/ui/settings/account.tsx +++ b/front/src/ui/settings/account.tsx @@ -9,17 +9,14 @@ import { type ComponentProps, useState } from "react"; import { useTranslation } from "react-i18next"; import { View } from "react-native"; import { useUniwind } from "uniwind"; -import { rem } from "yoshiki/native"; import type { KyooError, User } from "~/models"; import { Alert, Button, - H1, - Icon, + type Icon, Input, P, Popup, - ts, usePopup, } from "~/primitives"; import { useAccount } from "~/providers/account-context"; @@ -226,43 +223,27 @@ const ChangePopup = ({ const [value, setValue] = useState(inital); return ( - - {({ css }) => ( - <> - - -

{label}

-
- setValue(v)} - /> - -