-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor initial load and add light and dark theme
- Loading branch information
Showing
10 changed files
with
409 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { | ||
AlarmClock, | ||
ChevronRight, | ||
ClipboardCopy, | ||
Mail, | ||
Palette, | ||
Pencil, | ||
X | ||
} from "@tamagui/lucide-icons"; | ||
import { H2, ListItem, Separator, YGroup } from "tamagui"; | ||
|
||
import SettingsDialog from "../../components/Dialog"; | ||
import { MyStack } from "../../components/MyStack"; | ||
import { SafeAreaView } from "../../components/SafeAreaView"; | ||
import ThemeContent from "../../components/settings/ThemeContent"; | ||
import ThemeItem from "../../components/settings/ThemeItem"; | ||
import { useSettings } from "../../contexts/settingsContext"; | ||
|
||
export default function Settings() { | ||
const { settings } = useSettings(); | ||
|
||
return ( | ||
<SafeAreaView> | ||
<MyStack justifyContent="flex-start"> | ||
<H2>Settings</H2> | ||
<YGroup | ||
alignSelf="center" | ||
bordered | ||
size="$5" | ||
separator={<Separator />} | ||
> | ||
<YGroup.Item> | ||
<SettingsDialog | ||
trigger={<ThemeItem settings={settings} />} | ||
content={<ThemeContent settings={settings} />} | ||
title="Theme" | ||
description="System, dark, or light mode" | ||
/> | ||
</YGroup.Item> | ||
|
||
{/* <YGroup.Item> | ||
<ListItem | ||
hoverTheme | ||
pressTheme | ||
title="Reminder" | ||
subTitle="Not set" | ||
icon={AlarmClock} | ||
iconAfter={ChevronRight} | ||
/> | ||
</YGroup.Item> */} | ||
</YGroup> | ||
<YGroup | ||
alignSelf="center" | ||
bordered | ||
size="$5" | ||
separator={<Separator />} | ||
> | ||
<YGroup.Item> | ||
<ListItem | ||
hoverTheme | ||
pressTheme | ||
title="Open default mail app" | ||
icon={Mail} | ||
iconAfter={ChevronRight} | ||
/> | ||
</YGroup.Item> | ||
<YGroup.Item> | ||
<ListItem | ||
hoverTheme | ||
pressTheme | ||
title="Copy email to clipboard" | ||
icon={ClipboardCopy} | ||
iconAfter={ChevronRight} | ||
/> | ||
</YGroup.Item> | ||
{/* <YGroup.Item> | ||
<ListItem | ||
hoverTheme | ||
pressTheme | ||
title="Write a review" | ||
icon={Pencil} | ||
iconAfter={ChevronRight} | ||
/> | ||
</YGroup.Item> */} | ||
</YGroup> | ||
</MyStack> | ||
</SafeAreaView> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import React from "react"; | ||
import { Adapt, Button, Dialog, Sheet, YStack } from "tamagui"; | ||
|
||
interface Props { | ||
trigger: React.JSX.Element; | ||
content: React.JSX.Element; | ||
title: string; | ||
description: string; | ||
} | ||
|
||
export default function SettingsDialog({ | ||
trigger, | ||
content, | ||
title, | ||
description | ||
}: Props) { | ||
return ( | ||
<Dialog modal> | ||
<Dialog.Trigger asChild>{trigger}</Dialog.Trigger> | ||
|
||
<Adapt | ||
when="sm" | ||
platform="touch" | ||
> | ||
<Sheet | ||
zIndex={200000} | ||
modal | ||
dismissOnSnapToBottom | ||
> | ||
<Sheet.Frame | ||
padding="$4" | ||
space | ||
> | ||
<Adapt.Contents /> | ||
</Sheet.Frame> | ||
<Sheet.Overlay /> | ||
</Sheet> | ||
</Adapt> | ||
|
||
<Dialog.Portal> | ||
<Dialog.Overlay | ||
key="overlay" | ||
animation="quick" | ||
o={0.5} | ||
enterStyle={{ o: 0 }} | ||
exitStyle={{ o: 0 }} | ||
/> | ||
|
||
<Dialog.Content | ||
bordered | ||
elevate | ||
key="content" | ||
animation={[ | ||
"quick", | ||
{ | ||
opacity: { | ||
overshootClamping: true | ||
} | ||
} | ||
]} | ||
enterStyle={{ x: 0, y: -20, opacity: 0, scale: 0.9 }} | ||
exitStyle={{ x: 0, y: 10, opacity: 0, scale: 0.95 }} | ||
space | ||
> | ||
<Dialog.Title>{title}</Dialog.Title> | ||
<Dialog.Description>{description}</Dialog.Description> | ||
{content} | ||
{/* <Fieldset> | ||
<Label htmlFor="name">Name</Label> | ||
<Input | ||
id="name" | ||
defaultValue="Nate Wienert" | ||
/> | ||
</Fieldset> */} | ||
|
||
<YStack marginTop="$2"> | ||
<Dialog.Close | ||
displayWhenAdapted | ||
asChild | ||
> | ||
<Button aria-label="Close">Close</Button> | ||
</Dialog.Close> | ||
</YStack> | ||
</Dialog.Content> | ||
</Dialog.Portal> | ||
</Dialog> | ||
); | ||
} |
Oops, something went wrong.