Compare commits

...

1 Commits

Author SHA1 Message Date
Eric Bailey d272589bdc Add StackedButton component 2025-09-30 16:08:56 -05:00
3 changed files with 70 additions and 0 deletions
+1
View File
@@ -37,6 +37,7 @@ module.exports = {
'Toast.Action',
'AgeAssuranceAdmonition',
'Span',
'StackedButton',
],
impliedTextProps: [],
suggestedTextWrappers: {
+44
View File
@@ -837,3 +837,47 @@ export function ButtonIcon({
</View>
)
}
export type StackedButtonProps = Omit<
ButtonProps,
keyof VariantProps | 'children'
> &
Pick<VariantProps, 'color'> & {
children: React.ReactNode
icon: React.ComponentType<SVGIconProps>
}
export function StackedButton({children, ...props}: StackedButtonProps) {
return (
<Button
{...props}
size="tiny"
style={[
a.flex_col,
{
height: 72,
paddingHorizontal: 16,
borderRadius: 20,
gap: 4,
},
props.style,
]}>
<StackedButtonInnerText icon={props.icon}>
{children}
</StackedButtonInnerText>
</Button>
)
}
function StackedButtonInnerText({
children,
icon: Icon,
}: Pick<StackedButtonProps, 'icon' | 'children'>) {
const textStyles = useSharedButtonTextStyles()
return (
<>
<Icon width={24} fill={textStyles.color} />
<ButtonText>{children}</ButtonText>
</>
)
}
+25
View File
@@ -8,6 +8,7 @@ import {
ButtonIcon,
type ButtonSize,
ButtonText,
StackedButton,
} from '#/components/Button'
import {ChevronLeft_Stroke2_Corner0_Rounded as ChevronLeft} from '#/components/icons/Chevron'
import {Globe_Stroke2_Corner0_Rounded as Globe} from '#/components/icons/Globe'
@@ -18,6 +19,30 @@ export function Buttons() {
<View style={[a.gap_md]}>
<Text style={[a.font_bold, a.text_5xl]}>Buttons</Text>
<View style={[a.flex_row, a.gap_md, a.align_start, {maxWidth: 350}]}>
<StackedButton
label="stacked"
icon={Globe}
color="secondary"
style={[a.flex_1]}>
Bop it
</StackedButton>
<StackedButton
label="stacked"
icon={Globe}
color="negative_subtle"
style={[a.flex_1]}>
Twist it
</StackedButton>
<StackedButton
label="stacked"
icon={Globe}
color="primary"
style={[a.flex_1]}>
Pull it
</StackedButton>
</View>
{[
'primary',
'secondary',