diff --git a/front/packages/primitives/src/index.ts b/front/packages/primitives/src/index.ts index 629decb5..38c4c41d 100644 --- a/front/packages/primitives/src/index.ts +++ b/front/packages/primitives/src/index.ts @@ -33,6 +33,7 @@ export * from "./progress"; export * from "./slider"; export * from "./alert"; export * from "./menu"; +export * from "./popup"; export * from "./select"; export * from "./input"; export * from "./button"; diff --git a/front/packages/primitives/src/popup.tsx b/front/packages/primitives/src/popup.tsx new file mode 100644 index 00000000..36c9c3d6 --- /dev/null +++ b/front/packages/primitives/src/popup.tsx @@ -0,0 +1,62 @@ +/* + * Kyoo - A portable and vast media library solution. + * Copyright (c) Kyoo. + * + * See AUTHORS.md and LICENSE file in the project root for full license information. + * + * Kyoo is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * Kyoo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kyoo. If not, see . + */ + +import { ReactNode } from "react"; +import { Container } from "./container"; +import { Portal } from "@gorhom/portal"; +import { SwitchVariant, YoshikiFunc } from "./themes"; +import { View } from "react-native"; +import { imageBorderRadius } from "./constants"; +import { percent, px } from "yoshiki/native"; +import { ts } from "./utils"; + +export const Popup = ({ children }: { children: ReactNode | YoshikiFunc }) => { + return ( + + + {({ css, theme }) => ( + theme.themeOverlay, + })} + > + theme.background, + })} + > + {typeof children === "function" ? children({ css, theme }) : children} + + + )} + + + ); +}; diff --git a/front/packages/primitives/src/themes/theme.tsx b/front/packages/primitives/src/themes/theme.tsx index a34e8fa6..74f8ce68 100644 --- a/front/packages/primitives/src/themes/theme.tsx +++ b/front/packages/primitives/src/themes/theme.tsx @@ -155,7 +155,7 @@ export const ThemeSelector = ({ return {children}; }; -type YoshikiFunc = (props: ReturnType) => T; +export type YoshikiFunc = (props: ReturnType) => T; const YoshikiProvider = ({ children }: { children: YoshikiFunc }) => { const yoshiki = useYoshiki(); diff --git a/front/packages/ui/src/settings/index.tsx b/front/packages/ui/src/settings/index.tsx index 5bf97200..b18e3a1d 100644 --- a/front/packages/ui/src/settings/index.tsx +++ b/front/packages/ui/src/settings/index.tsx @@ -20,7 +20,6 @@ import { Account, - MutationParam, QueryIdentifier, QueryPage, User, @@ -38,6 +37,7 @@ import { Icon, Input, P, + Popup, Select, SubP, SwitchVariant, @@ -145,54 +145,32 @@ const ChangePopup = ({ const [value, setValue] = useState(inital); return ( - - - {({ css }) => ( - theme.themeOverlay, - })} - > - theme.background, - })} - > - - -

{label}

-
- setValue(v)} /> - -