1import { Pressable, type StyleProp, type ViewStyle } from "react-native";
2
3import { cn } from "../lib/cn";
4import { AppText } from "./AppText";
5import { SymbolView } from "./AppSymbol";
6
7/** Shared compose action for the floating button and empty workspace. */
8export function MaterialNewThreadButton(props: {
9 readonly onPress: () => void;
10 readonly extended?: boolean;
11 readonly expanded?: boolean;
12 readonly className?: string;
13 readonly style?: StyleProp<ViewStyle>;
14}) {
15 return (
16 <Pressable
17 accessibilityLabel="New thread"
18 accessibilityRole="button"
19 onPress={props.onPress}
20 className={cn(
21 "items-center justify-center bg-primary shadow-lg active:opacity-70",
22 props.extended
23 ? "h-[56px] flex-row gap-[8px] rounded-[16px] px-[16px]"
24 : "size-[80px] rounded-[20px]",
25 props.className,
26 )}
27 style={props.style}
28 >
29 <SymbolView
30 name="square.and.pencil"
31 size={props.extended ? 24 : 28}
32 tintColorClassName="accent-primary-foreground"
33 type="monochrome"
34 />
35 {props.extended && props.expanded !== false ? (
36 <AppText className="text-[16px] font-t3-medium text-primary-foreground">New thread</AppText>
37 ) : null}
38 </Pressable>
39 );
40}