| 1 | import type { ComponentProps } from "react"; |
| 2 | import { Pressable } from "react-native"; |
| 3 | |
| 4 | import { AppText as Text } from "../../components/AppText"; |
| 5 | import { cn } from "../../lib/cn"; |
| 6 | |
| 7 | /** Primary actions in the cards that replace the thread composer. */ |
| 8 | export function RequestActionButton({ |
| 9 | label, |
| 10 | tone = "primary", |
| 11 | size = "default", |
| 12 | disabled, |
| 13 | ...props |
| 14 | }: Omit<ComponentProps<typeof Pressable>, "children" | "className" | "style"> & { |
| 15 | label: string; |
| 16 | tone?: "primary" | "secondary" | "danger"; |
| 17 | size?: "default" | "large"; |
| 18 | }) { |
| 19 | return ( |
| 20 | <Pressable |
| 21 | {...props} |
| 22 | accessibilityRole="button" |
| 23 | accessibilityState={{ ...props.accessibilityState, disabled: Boolean(disabled) }} |
| 24 | disabled={disabled} |
| 25 | className={cn( |
| 26 | "items-center justify-center active:opacity-70 disabled:opacity-50", |
| 27 | size === "large" ? "rounded-2xl px-4 py-3.5" : "rounded-[14px] px-3.5 py-3", |
| 28 | tone === "primary" ? "bg-primary" : tone === "danger" ? "bg-danger" : "bg-subtle-strong", |
| 29 | )} |
| 30 | > |
| 31 | <Text |
| 32 | className={cn( |
| 33 | "text-sm", |
| 34 | tone === "primary" |
| 35 | ? "font-t3-extrabold text-primary-foreground" |
| 36 | : tone === "danger" |
| 37 | ? "font-t3-bold text-danger-foreground" |
| 38 | : "font-t3-bold text-foreground", |
| 39 | )} |
| 40 | > |
| 41 | {label} |
| 42 | </Text> |
| 43 | </Pressable> |
| 44 | ); |
| 45 | } |