Remove focused overrides from toggles

This commit is contained in:
Eric Bailey
2024-03-09 17:54:53 -06:00
parent af124516b3
commit ee08469b4d
2 changed files with 8 additions and 16 deletions
+7 -15
View File
@@ -5,7 +5,6 @@ import {HITSLOP_10} from 'lib/constants'
import { import {
useTheme, useTheme,
atoms as a, atoms as a,
web,
native, native,
flatten, flatten,
ViewStyleProp, ViewStyleProp,
@@ -228,13 +227,7 @@ export function Item({
onPressOut={onPressOut} onPressOut={onPressOut}
onFocus={onFocus} onFocus={onFocus}
onBlur={onBlur} onBlur={onBlur}
style={[ style={[a.flex_row, a.align_center, a.gap_sm, flatten(style)]}>
a.flex_row,
a.align_center,
a.gap_sm,
focused ? web({outline: 'none'}) : {},
flatten(style),
]}>
{typeof children === 'function' ? children(state) : children} {typeof children === 'function' ? children(state) : children}
</Pressable> </Pressable>
</ItemContext.Provider> </ItemContext.Provider>
@@ -271,7 +264,6 @@ export function Label({
export function createSharedToggleStyles({ export function createSharedToggleStyles({
theme: t, theme: t,
hovered, hovered,
focused,
selected, selected,
disabled, disabled,
isInvalid, isInvalid,
@@ -294,7 +286,7 @@ export function createSharedToggleStyles({
borderColor: t.palette.primary_500, borderColor: t.palette.primary_500,
}) })
if (hovered || focused) { if (hovered) {
baseHover.push({ baseHover.push({
backgroundColor: backgroundColor:
t.name === 'light' ? t.palette.primary_100 : t.palette.primary_800, t.name === 'light' ? t.palette.primary_100 : t.palette.primary_800,
@@ -303,7 +295,7 @@ export function createSharedToggleStyles({
}) })
} }
} else { } else {
if (hovered || focused) { if (hovered) {
baseHover.push({ baseHover.push({
backgroundColor: backgroundColor:
t.name === 'light' ? t.palette.contrast_50 : t.palette.contrast_100, t.name === 'light' ? t.palette.contrast_50 : t.palette.contrast_100,
@@ -320,7 +312,7 @@ export function createSharedToggleStyles({
t.name === 'light' ? t.palette.negative_300 : t.palette.negative_800, t.name === 'light' ? t.palette.negative_300 : t.palette.negative_800,
}) })
if (hovered || focused) { if (hovered) {
baseHover.push({ baseHover.push({
backgroundColor: backgroundColor:
t.name === 'light' ? t.palette.negative_25 : t.palette.negative_900, t.name === 'light' ? t.palette.negative_25 : t.palette.negative_900,
@@ -367,7 +359,7 @@ export function Checkbox() {
width: 20, width: 20,
}, },
baseStyles, baseStyles,
hovered || focused ? baseHoverStyles : {}, hovered ? baseHoverStyles : {},
]}> ]}>
{selected ? <Checkmark size="xs" fill={t.palette.primary_500} /> : null} {selected ? <Checkmark size="xs" fill={t.palette.primary_500} /> : null}
</View> </View>
@@ -399,7 +391,7 @@ export function Switch() {
width: 30, width: 30,
}, },
baseStyles, baseStyles,
hovered || focused ? baseHoverStyles : {}, hovered ? baseHoverStyles : {},
]}> ]}>
<View <View
style={[ style={[
@@ -451,7 +443,7 @@ export function Radio() {
width: 20, width: 20,
}, },
baseStyles, baseStyles,
hovered || focused ? baseHoverStyles : {}, hovered ? baseHoverStyles : {},
]}> ]}>
{selected ? ( {selected ? (
<View <View
+1 -1
View File
@@ -108,7 +108,7 @@ function ButtonInner({children}: React.PropsWithChildren<{}>) {
t.atoms.border_contrast_low, t.atoms.border_contrast_low,
baseStyles, baseStyles,
activeStyles, activeStyles,
(state.hovered || state.focused || state.pressed) && hoverStyles, (state.hovered || state.pressed) && hoverStyles,
]}> ]}>
{typeof children === 'string' ? ( {typeof children === 'string' ? (
<Text <Text