From 61b48dcdb9ccaf2fef8f6834cdb8785bf243fd38 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 30 Jul 2025 14:23:17 -0500 Subject: [PATCH] Remove gradient support entirely --- src/components/Button.tsx | 70 ++++----------------------------------- 1 file changed, 6 insertions(+), 64 deletions(-) diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 9a2f9b7d70..921bf93701 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -14,13 +14,12 @@ import { View, type ViewStyle, } from 'react-native' -import {LinearGradient} from 'expo-linear-gradient' -import {atoms as a, flatten, select, tokens, useTheme} from '#/alf' +import {atoms as a, flatten, select, useTheme} from '#/alf' import {type Props as SVGIconProps} from '#/components/icons/common' import {Text} from '#/components/Typography' -export type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'gradient' +export type ButtonVariant = 'solid' | 'outline' | 'ghost' export type ButtonColor = | 'primary' | 'secondary' @@ -464,42 +463,6 @@ export const Button = React.forwardRef( } }, [t, variant, color, size, shape, disabled]) - const gradientValues = React.useMemo(() => { - const gradient = { - primary: tokens.gradients.sky, - secondary: tokens.gradients.sky, - secondary_inverted: tokens.gradients.sky, - negative: tokens.gradients.sky, - negative_secondary: tokens.gradients.sky, - }[color || 'primary'] - - if (variant === 'gradient') { - if (gradient.values.length < 2) { - throw new Error( - 'Gradient buttons must have at least two colors in the gradient', - ) - } - - return { - colors: gradient.values.map(([_, color]) => color) as [ - string, - string, - ...string[], - ], - hoverColors: gradient.values.map(_ => gradient.hover_value) as [ - string, - string, - ...string[], - ], - locations: gradient.values.map(([location, _]) => location) as [ - number, - number, - ...number[], - ], - } - } - }, [variant, color]) - const context = React.useMemo( () => ({ ...state, @@ -542,27 +505,6 @@ export const Button = React.forwardRef( onHoverOut={onHoverOut} onFocus={onFocus} onBlur={onBlur}> - {variant === 'gradient' && gradientValues && ( - - - - )} {typeof children === 'function' ? children(context) : children} @@ -601,7 +543,7 @@ export function useSharedButtonTextStyles() { } } } else if (color === 'secondary') { - if (variant === 'solid' || variant === 'gradient') { + if (variant === 'solid') { if (!disabled) { baseStyles.push({ color: t.palette.contrast_700, @@ -633,7 +575,7 @@ export function useSharedButtonTextStyles() { } } } else if (color === 'secondary_inverted') { - if (variant === 'solid' || variant === 'gradient') { + if (variant === 'solid') { if (!disabled) { baseStyles.push({ color: t.palette.contrast_50, @@ -665,7 +607,7 @@ export function useSharedButtonTextStyles() { } } } else if (color === 'negative') { - if (variant === 'solid' || variant === 'gradient') { + if (variant === 'solid') { if (!disabled) { baseStyles.push({color: t.palette.white}) } else { @@ -685,7 +627,7 @@ export function useSharedButtonTextStyles() { } } } else if (color === 'negative_secondary') { - if (variant === 'solid' || variant === 'gradient') { + if (variant === 'solid') { if (!disabled) { baseStyles.push({ color: select(t.name, {