Skip to content

Commit 807f32a

Browse files
Pavithra KodmadPavithra Kodmad
authored andcommitted
Add focus and hover colors to all themes using functional variables
1 parent 94c6122 commit 807f32a

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

src/ActionList/Item.tsx

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {ItemInput} from './List'
77
import styled from 'styled-components'
88
import {StyledHeader} from './Header'
99
import {StyledDivider} from './Divider'
10-
import {useColorSchemeVar, useTheme} from '../ThemeProvider'
10+
import {useTheme} from '../ThemeProvider'
1111
import {
1212
activeDescendantActivatedDirectly,
1313
activeDescendantActivatedIndirectly,
@@ -17,33 +17,14 @@ import {useSSRSafeId} from '@react-aria/ssr'
1717
import {ForwardRefComponent as PolymorphicForwardRefComponent} from '@radix-ui/react-polymorphic'
1818
import {AriaRole} from '../utils/types'
1919

20-
/**
21-
* These colors are not yet in our default theme. Need to remove this once they are added.
22-
*/
2320
const customItemThemes = {
2421
default: {
25-
hover: {
26-
light: 'rgba(46, 77, 108, 0.06)',
27-
dark: 'rgba(201, 206, 212, 0.12)',
28-
dark_dimmed: 'rgba(201, 206, 212, 0.12)'
29-
},
30-
focus: {
31-
light: 'rgba(54, 77, 100, 0.16)',
32-
dark: 'rgba(201, 206, 212, 0.24)',
33-
dark_dimmed: 'rgba(201, 206, 212, 0.24)'
34-
}
22+
hover: get('colors.neutral.subtle'),
23+
focus: get('colors.neutral.muted')
3524
},
3625
danger: {
37-
hover: {
38-
light: 'rgba(234, 74, 90, 0.08)',
39-
dark: 'rgba(248, 81, 73, 0.16)',
40-
dark_dimmed: 'rgba(248, 81, 73, 0.16)'
41-
},
42-
focus: {
43-
light: 'rgba(234, 74, 90, 0.14)',
44-
dark: 'rgba(248, 81, 73, 0.24)',
45-
dark_dimmed: 'rgba(248, 81, 73, 0.24)'
46-
}
26+
hover: get('colors.danger.subtle'),
27+
focus: get('colors.danger.muted')
4728
}
4829
} as const
4930

@@ -397,10 +378,9 @@ export const Item = React.forwardRef((itemProps, ref) => {
397378
},
398379
[onAction, disabled, itemProps, onClick]
399380
)
400-
401381
const customItemTheme = customItemThemes[variant]
402-
const hoverBackground = useColorSchemeVar(customItemTheme.hover, 'inherit')
403-
const focusBackground = useColorSchemeVar(customItemTheme.focus, 'inherit')
382+
const hoverBackground = customItemTheme.hover
383+
const focusBackground = customItemTheme.focus
404384

405385
const {theme} = useTheme()
406386

0 commit comments

Comments
 (0)