Add secondary_inverted button color
This commit is contained in:
@@ -21,6 +21,7 @@ export type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'gradient'
|
|||||||
export type ButtonColor =
|
export type ButtonColor =
|
||||||
| 'primary'
|
| 'primary'
|
||||||
| 'secondary'
|
| 'secondary'
|
||||||
|
| 'secondary_inverted'
|
||||||
| 'negative'
|
| 'negative'
|
||||||
| 'gradient_sky'
|
| 'gradient_sky'
|
||||||
| 'gradient_midnight'
|
| 'gradient_midnight'
|
||||||
@@ -217,6 +218,43 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push(a.border, {
|
||||||
|
borderColor: t.palette.contrast_300,
|
||||||
|
})
|
||||||
|
hoverStyles.push(t.atoms.bg_contrast_50)
|
||||||
|
} else {
|
||||||
|
baseStyles.push(a.border, {
|
||||||
|
borderColor: t.palette.contrast_200,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (variant === 'ghost') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push(t.atoms.bg)
|
||||||
|
hoverStyles.push({
|
||||||
|
backgroundColor: t.palette.contrast_25,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (color === 'secondary_inverted') {
|
||||||
|
if (variant === 'solid') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push({
|
||||||
|
backgroundColor: t.palette.contrast_900,
|
||||||
|
})
|
||||||
|
hoverStyles.push({
|
||||||
|
backgroundColor: t.palette.contrast_950,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
baseStyles.push({
|
||||||
|
backgroundColor: t.palette.contrast_700,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} 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.contrast_300,
|
borderColor: t.palette.contrast_300,
|
||||||
@@ -344,6 +382,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
const gradient = {
|
const gradient = {
|
||||||
primary: tokens.gradients.sky,
|
primary: tokens.gradients.sky,
|
||||||
secondary: tokens.gradients.sky,
|
secondary: tokens.gradients.sky,
|
||||||
|
secondary_inverted: tokens.gradients.sky,
|
||||||
negative: tokens.gradients.sky,
|
negative: tokens.gradients.sky,
|
||||||
gradient_sky: tokens.gradients.sky,
|
gradient_sky: tokens.gradients.sky,
|
||||||
gradient_midnight: tokens.gradients.midnight,
|
gradient_midnight: tokens.gradients.midnight,
|
||||||
@@ -499,6 +538,38 @@ export function useSharedButtonTextStyles() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (color === 'secondary_inverted') {
|
||||||
|
if (variant === 'solid' || variant === 'gradient') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push({
|
||||||
|
color: t.palette.white,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
baseStyles.push({
|
||||||
|
color: t.palette.contrast_400,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (variant === 'outline') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push({
|
||||||
|
color: t.palette.contrast_600,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
baseStyles.push({
|
||||||
|
color: t.palette.contrast_300,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (variant === 'ghost') {
|
||||||
|
if (!disabled) {
|
||||||
|
baseStyles.push({
|
||||||
|
color: t.palette.contrast_600,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
baseStyles.push({
|
||||||
|
color: t.palette.contrast_300,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (color === 'negative') {
|
} else if (color === 'negative') {
|
||||||
if (variant === 'solid' || variant === 'gradient') {
|
if (variant === 'solid' || variant === 'gradient') {
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ 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', 'negative'].map(color => (
|
{['primary', 'secondary', 'secondary_inverted'].map(color => (
|
||||||
<View key={color} style={[a.gap_md, a.align_start]}>
|
<View key={color} style={[a.gap_md, a.align_start]}>
|
||||||
{['solid', 'outline', 'ghost'].map(variant => (
|
{['solid', 'outline', 'ghost'].map(variant => (
|
||||||
<React.Fragment key={variant}>
|
<React.Fragment key={variant}>
|
||||||
|
|||||||
Reference in New Issue
Block a user