feat: settings

This commit is contained in:
Fredrik Burmester
2024-08-14 15:04:31 +02:00
parent a76ed9be66
commit 2a34851fc6
5 changed files with 181 additions and 107 deletions

View File

@@ -1,22 +1,26 @@
import { PropsWithChildren, ReactNode } from "react";
import { View } from "react-native";
import { View, ViewProps } from "react-native";
import { Text } from "./common/Text";
type Props = {
interface Props extends ViewProps {
title?: string | null | undefined;
subTitle?: string | null | undefined;
children?: ReactNode;
iconAfter?: ReactNode;
};
}
export const ListItem: React.FC<PropsWithChildren<Props>> = ({
title,
subTitle,
iconAfter,
children,
...props
}) => {
return (
<View className="flex flex-row items-center justify-between bg-neutral-900 p-4">
<View
className="flex flex-row items-center justify-between bg-neutral-900 p-4"
{...props}
>
<View className="flex flex-col">
<Text className="font-bold ">{title}</Text>
{subTitle && <Text className="text-xs">{subTitle}</Text>}

View File

@@ -0,0 +1,20 @@
import { Switch, View } from "react-native";
import { Text } from "../common/Text";
import { useAtom } from "jotai";
import { useSettings } from "@/utils/atoms/settings";
export const SettingToggles: React.FC = () => {
const [settings, updateSettings] = useSettings();
return (
<View className="flex flex-col rounded-xl mb-4 overflow-hidden border-neutral-800 divide-y-2 divide-solid divide-neutral-800 ">
<View className="flex flex-row items-center justify-between bg-neutral-900 p-4">
<Text>Auto rotate</Text>
<Switch
value={settings?.autoRotate}
onValueChange={(value) => updateSettings({ autoRotate: value })}
/>
</View>
</View>
);
};