Skip to content

Commit 0f5d5c3

Browse files
committed
Revert "feat(KeybindingHint): Convert to CSS modules behind feature flag (#5326)"
This reverts commit 1d79cc5.
1 parent 45b3149 commit 0f5d5c3

File tree

5 files changed

+23
-66
lines changed

5 files changed

+23
-66
lines changed

.changeset/gentle-apes-do.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/react/src/KeybindingHint/KeybindingHint.module.css

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/react/src/KeybindingHint/KeybindingHint.tsx

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,34 @@ import {memo} from 'react'
33
import Text from '../Text'
44
import type {KeybindingHintProps} from './props'
55
import {accessibleSequenceString, Sequence} from './components/Sequence'
6-
import {useFeatureFlag} from '../FeatureFlags'
7-
8-
import classes from './KeybindingHint.module.css'
9-
import {clsx} from 'clsx'
106

117
/** `kbd` element with style resets. */
12-
const Kbd = ({children, className}: {children: ReactNode; className?: string}) => {
13-
const enabled = useFeatureFlag('primer_react_css_modules_team')
14-
15-
return (
16-
<Text
17-
as={'kbd' as 'span'}
18-
className={clsx(className, enabled && classes.KeybindingHint)}
19-
data-testid="keybinding-hint"
20-
sx={
21-
enabled
22-
? undefined
23-
: {
24-
color: 'inherit',
25-
fontFamily: 'inherit',
26-
fontSize: 'inherit',
27-
border: 'none',
28-
background: 'none',
29-
boxShadow: 'none',
30-
p: 0,
31-
lineHeight: 'unset',
32-
position: 'relative',
33-
overflow: 'visible',
34-
verticalAlign: 'baseline',
35-
textWrap: 'nowrap',
36-
}
37-
}
38-
>
39-
{children}
40-
</Text>
41-
)
42-
}
8+
const Kbd = ({children}: {children: ReactNode}) => (
9+
<Text
10+
as={'kbd' as 'span'}
11+
sx={{
12+
color: 'inherit',
13+
fontFamily: 'inherit',
14+
fontSize: 'inherit',
15+
border: 'none',
16+
background: 'none',
17+
boxShadow: 'none',
18+
p: 0,
19+
lineHeight: 'unset',
20+
position: 'relative',
21+
overflow: 'visible',
22+
verticalAlign: 'baseline',
23+
textWrap: 'nowrap',
24+
}}
25+
>
26+
{children}
27+
</Text>
28+
)
4329

4430
/** Indicates the presence of an available keybinding. */
4531
// KeybindingHint is a good candidate for memoizing since props will rarely change
46-
export const KeybindingHint = memo(({className, ...props}: KeybindingHintProps) => (
47-
<Kbd className={className}>
32+
export const KeybindingHint = memo((props: KeybindingHintProps) => (
33+
<Kbd>
4834
<Sequence {...props} />
4935
</Kbd>
5036
))

packages/react/src/KeybindingHint/props.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,4 @@ export interface KeybindingHintProps {
3131
* Control the size of the hint.
3232
*/
3333
size?: 'small' | 'normal'
34-
/**
35-
* Additional class name to apply to the hint.
36-
*/
37-
className?: string
3834
}

packages/react/src/__tests__/KeybindingHint.test.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ describe('KeybindingHint', () => {
7474
expect(el).toBeInTheDocument()
7575
expect(el).not.toHaveAttribute('aria-hidden')
7676
})
77-
78-
it('accepts className prop', () => {
79-
render(<KeybindingHint keys="Control" className="test-class" />)
80-
expect(screen.getByTestId('keybinding-hint')).toHaveClass('test-class')
81-
})
8277
})
8378

8479
describe('getAccessibleKeybindingHintString', () => {

0 commit comments

Comments
 (0)