Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

MaterialFloatingActionButton.tsx

46 lines1.4 KB

1import type { ComponentProps } from "react";
2import { Pressable } from "react-native";
3import type { MaterialFloatingActionButton as AndroidMaterialFloatingActionButton } from "./MaterialFloatingActionButton.android";
4import { AppText } from "./AppText";
5import { SymbolView } from "./AppSymbol";
6import { cn } from "../lib/cn";
7​
8export function MaterialFloatingActionButton(
9 props: ComponentProps<typeof AndroidMaterialFloatingActionButton>,
10) {
11 return (
12 <Pressable
13 accessibilityRole="button"
14 accessibilityLabel={props.label}
15 onPress={props.onPress}
16 className={cn(
17 "min-h-14 min-w-14 flex-row items-center justify-center gap-2 rounded-2xl px-4",
18 props.tone === "primary" ? "bg-primary" : "bg-thread-selected",
19 props.className,
20 )}
21 style={props.style}
22 >
23 <SymbolView
24 name={props.icon}
25 size={24}
26 tintColorClassName={
27 props.tone === "primary"
28 ? "accent-primary-foreground"
29 : "accent-thread-selected-foreground"
30 }
31 />
32 {props.variant === "extended" && props.expanded !== false ? (
33 <AppText
34 className={cn(
35 "text-sm",
36 props.tone === "primary"
37 ? "text-primary-foreground"
38 : "text-thread-selected-foreground",
39 )}
40 >
41 {props.label}
42 </AppText>
43 ) : null}
44 </Pressable>
45 );