Remove theme specific colors from Button, improves secondary solid on dark mode
This commit is contained in:
+11
-25
@@ -152,7 +152,6 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
const {baseStyles, hoverStyles} = React.useMemo(() => {
|
const {baseStyles, hoverStyles} = React.useMemo(() => {
|
||||||
const baseStyles: ViewStyle[] = []
|
const baseStyles: ViewStyle[] = []
|
||||||
const hoverStyles: ViewStyle[] = []
|
const hoverStyles: ViewStyle[] = []
|
||||||
const light = t.name === 'light'
|
|
||||||
|
|
||||||
if (color === 'primary') {
|
if (color === 'primary') {
|
||||||
if (variant === 'solid') {
|
if (variant === 'solid') {
|
||||||
@@ -165,7 +164,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
baseStyles.push({
|
baseStyles.push({
|
||||||
backgroundColor: t.palette.primary_700,
|
backgroundColor: t.palette.primary_300,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (variant === 'outline') {
|
} else if (variant === 'outline') {
|
||||||
@@ -178,24 +177,18 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
borderColor: t.palette.primary_500,
|
borderColor: t.palette.primary_500,
|
||||||
})
|
})
|
||||||
hoverStyles.push(a.border, {
|
hoverStyles.push(a.border, {
|
||||||
backgroundColor: light
|
backgroundColor: t.palette.primary_50,
|
||||||
? t.palette.primary_50
|
|
||||||
: t.palette.primary_950,
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
baseStyles.push(a.border, {
|
baseStyles.push(a.border, {
|
||||||
borderColor: light
|
borderColor: t.palette.primary_200,
|
||||||
? t.palette.primary_200
|
|
||||||
: t.palette.primary_900,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (variant === 'ghost') {
|
} else if (variant === 'ghost') {
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
baseStyles.push(t.atoms.bg)
|
baseStyles.push(t.atoms.bg)
|
||||||
hoverStyles.push({
|
hoverStyles.push({
|
||||||
backgroundColor: light
|
backgroundColor: t.palette.primary_100,
|
||||||
? t.palette.primary_100
|
|
||||||
: t.palette.primary_900,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,14 +196,14 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
if (variant === 'solid') {
|
if (variant === 'solid') {
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
baseStyles.push({
|
baseStyles.push({
|
||||||
backgroundColor: t.palette.contrast_25,
|
backgroundColor: t.palette.contrast_100,
|
||||||
})
|
})
|
||||||
hoverStyles.push({
|
hoverStyles.push({
|
||||||
backgroundColor: t.palette.contrast_50,
|
backgroundColor: t.palette.contrast_200,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
baseStyles.push({
|
baseStyles.push({
|
||||||
backgroundColor: t.palette.contrast_100,
|
backgroundColor: t.palette.contrast_25,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (variant === 'outline') {
|
} else if (variant === 'outline') {
|
||||||
@@ -297,24 +290,18 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
borderColor: t.palette.negative_500,
|
borderColor: t.palette.negative_500,
|
||||||
})
|
})
|
||||||
hoverStyles.push(a.border, {
|
hoverStyles.push(a.border, {
|
||||||
backgroundColor: light
|
backgroundColor: t.palette.negative_50,
|
||||||
? t.palette.negative_50
|
|
||||||
: t.palette.negative_975,
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
baseStyles.push(a.border, {
|
baseStyles.push(a.border, {
|
||||||
borderColor: light
|
borderColor: t.palette.negative_200,
|
||||||
? t.palette.negative_200
|
|
||||||
: t.palette.negative_900,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (variant === 'ghost') {
|
} else if (variant === 'ghost') {
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
baseStyles.push(t.atoms.bg)
|
baseStyles.push(t.atoms.bg)
|
||||||
hoverStyles.push({
|
hoverStyles.push({
|
||||||
backgroundColor: light
|
backgroundColor: t.palette.negative_100,
|
||||||
? t.palette.negative_100
|
|
||||||
: t.palette.negative_975,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -482,7 +469,6 @@ export function useSharedButtonTextStyles() {
|
|||||||
const {color, variant, disabled, size} = useButtonContext()
|
const {color, variant, disabled, size} = useButtonContext()
|
||||||
return React.useMemo(() => {
|
return React.useMemo(() => {
|
||||||
const baseStyles: TextStyle[] = []
|
const baseStyles: TextStyle[] = []
|
||||||
const light = t.name === 'light'
|
|
||||||
|
|
||||||
if (color === 'primary') {
|
if (color === 'primary') {
|
||||||
if (variant === 'solid') {
|
if (variant === 'solid') {
|
||||||
@@ -494,7 +480,7 @@ export function useSharedButtonTextStyles() {
|
|||||||
} else if (variant === 'outline') {
|
} else if (variant === 'outline') {
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
baseStyles.push({
|
baseStyles.push({
|
||||||
color: light ? t.palette.primary_600 : t.palette.primary_500,
|
color: t.palette.primary_600,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
baseStyles.push({color: t.palette.primary_600, opacity: 0.5})
|
baseStyles.push({color: t.palette.primary_600, opacity: 0.5})
|
||||||
|
|||||||
Reference in New Issue
Block a user