Skip to content

Commit 66bac1b

Browse files
committed
feat(radio-group): add touchable hover mixin
1 parent 3fa719c commit 66bac1b

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

packages/bezier-react/src/components/Forms/RadioGroup/RadioGroup.styled.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'
33

44
/* Internal dependencies */
5-
import { styled, Typography } from 'Foundation'
5+
import { styled, css, Typography } from 'Foundation'
66
import DisabledOpacity from 'Constants/DisabledOpacity'
7+
import { touchableHover } from 'Utils/styleUtils'
78
import { Text } from 'Components/Text'
89
import { FormFieldSize } from 'Components/Forms'
910
import { focusedInputWrapperStyle } from 'Components/Forms/Inputs/mixins'
@@ -68,15 +69,15 @@ export const RadioGroupPrimitiveItem = styled(RadioGroupPrimitive.Item)<RadioPro
6869
}
6970
}
7071
71-
&:hover {
72+
${touchableHover(css`
7273
&:not([data-disabled])[data-state='checked']::before {
7374
background-color: var(--bgtxt-green-dark);
7475
}
7576
7677
&:not([data-disabled]):not([data-state='checked'])::after {
7778
background-color: var(--bg-black-dark);
7879
}
79-
}
80+
`)}
8081
8182
&:focus-visible {
8283
&::before {

packages/bezier-react/src/utils/styleUtils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,19 @@ export function gap(spacing: number): InjectedInterpolation {
9999
}
100100
`
101101
}
102+
103+
export function touchableHover(interpolation: InjectedInterpolation): InjectedInterpolation {
104+
return css`
105+
@media (hover: hover) {
106+
&:hover {
107+
${interpolation}
108+
}
109+
}
110+
111+
@media (hover: none) {
112+
&:active {
113+
${interpolation}
114+
}
115+
}
116+
`
117+
}

0 commit comments

Comments
 (0)