add negative_secondary button color
This commit is contained in:
+76
-11
@@ -1,23 +1,23 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {
|
import {
|
||||||
AccessibilityProps,
|
type AccessibilityProps,
|
||||||
GestureResponderEvent,
|
type GestureResponderEvent,
|
||||||
MouseEvent,
|
type MouseEvent,
|
||||||
NativeSyntheticEvent,
|
type NativeSyntheticEvent,
|
||||||
Pressable,
|
Pressable,
|
||||||
PressableProps,
|
type PressableProps,
|
||||||
StyleProp,
|
type StyleProp,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
TargetedEvent,
|
type TargetedEvent,
|
||||||
TextProps,
|
type TextProps,
|
||||||
TextStyle,
|
type TextStyle,
|
||||||
View,
|
View,
|
||||||
ViewStyle,
|
type ViewStyle,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import {LinearGradient} from 'expo-linear-gradient'
|
import {LinearGradient} from 'expo-linear-gradient'
|
||||||
|
|
||||||
import {atoms as a, flatten, select, tokens, useTheme} from '#/alf'
|
import {atoms as a, flatten, select, tokens, useTheme} from '#/alf'
|
||||||
import {Props as SVGIconProps} from '#/components/icons/common'
|
import {type Props as SVGIconProps} from '#/components/icons/common'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
export type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'gradient'
|
export type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'gradient'
|
||||||
@@ -26,6 +26,7 @@ export type ButtonColor =
|
|||||||
| 'secondary'
|
| 'secondary'
|
||||||
| 'secondary_inverted'
|
| 'secondary_inverted'
|
||||||
| 'negative'
|
| 'negative'
|
||||||
|
| 'negative_secondary'
|
||||||
| 'gradient_primary'
|
| 'gradient_primary'
|
||||||
| 'gradient_sky'
|
| 'gradient_sky'
|
||||||
| 'gradient_midnight'
|
| 'gradient_midnight'
|
||||||
@@ -336,6 +337,49 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push(a.border, {
|
||||||
|
borderColor: t.palette.negative_500,
|
||||||
|
})
|
||||||
|
hoverStyles.push(a.border, {
|
||||||
|
backgroundColor: t.palette.negative_50,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
baseStyles.push(a.border, {
|
||||||
|
borderColor: t.palette.negative_200,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (variant === 'ghost') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push(t.atoms.bg)
|
||||||
|
hoverStyles.push({
|
||||||
|
backgroundColor: t.palette.negative_100,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (color === 'negative_secondary') {
|
||||||
|
if (variant === 'solid') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push({
|
||||||
|
backgroundColor: t.palette.negative_50,
|
||||||
|
})
|
||||||
|
hoverStyles.push({
|
||||||
|
backgroundColor: t.palette.negative_100,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
baseStyles.push({
|
||||||
|
backgroundColor: select(t.name, {
|
||||||
|
light: t.palette.negative_50,
|
||||||
|
dim: t.palette.negative_50,
|
||||||
|
dark: t.palette.negative_50,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (variant === 'outline') {
|
||||||
|
baseStyles.push(a.border, t.atoms.bg, {
|
||||||
|
borderWidth: 1,
|
||||||
|
})
|
||||||
|
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
baseStyles.push(a.border, {
|
baseStyles.push(a.border, {
|
||||||
borderColor: t.palette.negative_500,
|
borderColor: t.palette.negative_500,
|
||||||
@@ -425,6 +469,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
secondary: tokens.gradients.sky,
|
secondary: tokens.gradients.sky,
|
||||||
secondary_inverted: tokens.gradients.sky,
|
secondary_inverted: tokens.gradients.sky,
|
||||||
negative: tokens.gradients.sky,
|
negative: tokens.gradients.sky,
|
||||||
|
negative_secondary: tokens.gradients.sky,
|
||||||
gradient_primary: tokens.gradients.primary,
|
gradient_primary: tokens.gradients.primary,
|
||||||
gradient_sky: tokens.gradients.sky,
|
gradient_sky: tokens.gradients.sky,
|
||||||
gradient_midnight: tokens.gradients.midnight,
|
gradient_midnight: tokens.gradients.midnight,
|
||||||
@@ -645,6 +690,26 @@ export function useSharedButtonTextStyles() {
|
|||||||
baseStyles.push({color: t.palette.negative_400, opacity: 0.5})
|
baseStyles.push({color: t.palette.negative_400, opacity: 0.5})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (color === 'negative_secondary') {
|
||||||
|
if (variant === 'solid' || variant === 'gradient') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push({color: t.palette.negative_500})
|
||||||
|
} else {
|
||||||
|
baseStyles.push({color: t.palette.negative_400, opacity: 0.5})
|
||||||
|
}
|
||||||
|
} else if (variant === 'outline') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push({color: t.palette.negative_400})
|
||||||
|
} else {
|
||||||
|
baseStyles.push({color: t.palette.negative_400, opacity: 0.5})
|
||||||
|
}
|
||||||
|
} else if (variant === 'ghost') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push({color: t.palette.negative_400})
|
||||||
|
} else {
|
||||||
|
baseStyles.push({color: t.palette.negative_400, opacity: 0.5})
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
baseStyles.push({color: t.palette.white})
|
baseStyles.push({color: t.palette.white})
|
||||||
|
|||||||
@@ -211,8 +211,8 @@ function DialogInner({
|
|||||||
label={replyToUri ? _(msg`Discard reply`) : _(msg`Discard post`)}
|
label={replyToUri ? _(msg`Discard reply`) : _(msg`Discard post`)}
|
||||||
onPress={() => control.close(discardReply)}
|
onPress={() => control.close(discardReply)}
|
||||||
size="large"
|
size="large"
|
||||||
color="negative"
|
color="negative_secondary"
|
||||||
variant="outline">
|
variant="solid">
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
{replyToUri ? (
|
{replyToUri ? (
|
||||||
<Trans>Discard reply</Trans>
|
<Trans>Discard reply</Trans>
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import {View} from 'react-native'
|
|||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
ButtonColor,
|
type ButtonColor,
|
||||||
ButtonIcon,
|
ButtonIcon,
|
||||||
ButtonText,
|
ButtonText,
|
||||||
ButtonVariant,
|
type ButtonVariant,
|
||||||
} from '#/components/Button'
|
} from '#/components/Button'
|
||||||
import {ChevronLeft_Stroke2_Corner0_Rounded as ChevronLeft} from '#/components/icons/Chevron'
|
import {ChevronLeft_Stroke2_Corner0_Rounded as ChevronLeft} from '#/components/icons/Chevron'
|
||||||
import {Globe_Stroke2_Corner0_Rounded as Globe} from '#/components/icons/Globe'
|
import {Globe_Stroke2_Corner0_Rounded as Globe} from '#/components/icons/Globe'
|
||||||
@@ -19,31 +19,35 @@ export function Buttons() {
|
|||||||
<H1>Buttons</H1>
|
<H1>Buttons</H1>
|
||||||
|
|
||||||
<View style={[a.flex_row, a.flex_wrap, a.gap_md, a.align_start]}>
|
<View style={[a.flex_row, a.flex_wrap, a.gap_md, a.align_start]}>
|
||||||
{['primary', 'secondary', 'secondary_inverted', 'negative'].map(
|
{[
|
||||||
color => (
|
'primary',
|
||||||
<View key={color} style={[a.gap_md, a.align_start]}>
|
'secondary',
|
||||||
{['solid', 'outline', 'ghost'].map(variant => (
|
'secondary_inverted',
|
||||||
<React.Fragment key={variant}>
|
'negative',
|
||||||
<Button
|
'negative_secondary',
|
||||||
variant={variant as ButtonVariant}
|
].map(color => (
|
||||||
color={color as ButtonColor}
|
<View key={color} style={[a.gap_md, a.align_start]}>
|
||||||
size="large"
|
{['solid', 'outline', 'ghost'].map(variant => (
|
||||||
label="Click here">
|
<React.Fragment key={variant}>
|
||||||
<ButtonText>Button</ButtonText>
|
<Button
|
||||||
</Button>
|
variant={variant as ButtonVariant}
|
||||||
<Button
|
color={color as ButtonColor}
|
||||||
disabled
|
size="large"
|
||||||
variant={variant as ButtonVariant}
|
label="Click here">
|
||||||
color={color as ButtonColor}
|
<ButtonText>Button</ButtonText>
|
||||||
size="large"
|
</Button>
|
||||||
label="Click here">
|
<Button
|
||||||
<ButtonText>Button</ButtonText>
|
disabled
|
||||||
</Button>
|
variant={variant as ButtonVariant}
|
||||||
</React.Fragment>
|
color={color as ButtonColor}
|
||||||
))}
|
size="large"
|
||||||
</View>
|
label="Click here">
|
||||||
),
|
<ButtonText>Button</ButtonText>
|
||||||
)}
|
</Button>
|
||||||
|
</React.Fragment>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
|
||||||
<View style={[a.flex_row, a.gap_md, a.align_start]}>
|
<View style={[a.flex_row, a.gap_md, a.align_start]}>
|
||||||
<View style={[a.gap_md, a.align_start]}>
|
<View style={[a.gap_md, a.align_start]}>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react'
|
|||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
import {NavigationProp} from '#/lib/routes/types'
|
import {type NavigationProp} from '#/lib/routes/types'
|
||||||
import {useSetThemePrefs} from '#/state/shell'
|
import {useSetThemePrefs} from '#/state/shell'
|
||||||
import {ListContained} from '#/view/screens/Storybook/ListContained'
|
import {ListContained} from '#/view/screens/Storybook/ListContained'
|
||||||
import {atoms as a, ThemeProvider} from '#/alf'
|
import {atoms as a, ThemeProvider} from '#/alf'
|
||||||
@@ -115,7 +115,6 @@ function StorybookInner() {
|
|||||||
<Typography />
|
<Typography />
|
||||||
<Spacing />
|
<Spacing />
|
||||||
<Shadows />
|
<Shadows />
|
||||||
<Buttons />
|
|
||||||
<Icons />
|
<Icons />
|
||||||
<Links />
|
<Links />
|
||||||
<Dialogs />
|
<Dialogs />
|
||||||
|
|||||||
Reference in New Issue
Block a user