Open History to see the last commit
1import { Pressable, View } from "react-native";
2
3import { AppText as Text } from "./AppText";
4
5export function EmptyState(props: {
6 readonly title: string;
7 readonly detail: string;
8 readonly actionLabel?: string;
9 readonly onAction?: () => void;
10 readonly variant?: "card" | "plain";
11}) {
12 if (props.variant === "plain") {
13 return (
14 <View className="items-center px-8 py-8">
15 <Text className="text-center text-xl font-t3-bold text-foreground">{props.title}</Text>
16 <Text className="mt-2 text-center font-sans text-base leading-normal text-foreground-muted">
17 {props.detail}
18 </Text>
19 {props.actionLabel && props.onAction ? (
20 <Pressable
21 className="mt-5 rounded-full bg-primary px-5 py-3 active:opacity-70"
22 onPress={props.onAction}
23 >
24 <Text className="text-sm font-t3-bold text-primary-foreground">
25 {props.actionLabel}
26 </Text>
27 </Pressable>
28 ) : null}
29 </View>
30 );
31 }
32
33 return (
34 <View className="rounded-[22px] border border-border bg-card p-5">
35 <Text className="font-t3-bold text-lg text-foreground">{props.title}</Text>
36 <Text className="mt-2 font-sans text-sm leading-relaxed text-foreground-muted">
37 {props.detail}
38 </Text>
39 {props.actionLabel && props.onAction ? (
40 <Pressable
41 className="mt-4 self-start rounded-full bg-primary px-4 py-2.5 active:opacity-70"
42 onPress={props.onAction}
43 >
44 <Text className="text-sm font-t3-bold text-primary-foreground">{props.actionLabel}</Text>
45 </Pressable>
46 ) : null}
47 </View>
48 );
49}