Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

1.2 KB
Raw Blame
import type { ReactNode } from "react";
import { Stack } from "expo-router";
import { View } from "react-native";
import { CollectionHeader } from "@/components/collection-header";
import { Card, Screen, Text, useTheme } from "@/ui";

type SettingsPageProps = {
	title: string;
	children: ReactNode;
	root?: boolean;
	onRefresh?: (() => Promise<unknown>) | undefined;
};
export function SettingsPage({ title, children, root = false, onRefresh }: SettingsPageProps) {
	return (
		<Screen edges={root ? ["top"] : []} onRefresh={onRefresh}>
			<Stack.Screen options={{ title, headerShown: !root, headerLargeTitle: false }} />
			{root ? <CollectionHeader title={title} /> : null}
			{children}
		</Screen>
	);
}

type SettingsGroupProps = { title?: string; note?: string; children: ReactNode };
export function SettingsGroup({ title, note, children }: SettingsGroupProps) {
	const { space } = useTheme();
	return (
		<View style={{ gap: space.s2 }}>
			{title ? (
				<Text variant="caption" color="ink2">
					{title}
				</Text>
			) : null}
			<Card style={{ padding: 0, overflow: "hidden" }}>{children}</Card>
			{note ? (
				<Text variant="callout" color="ink3">
					{note}
				</Text>
			) : null}
		</View>
	);
}