File tree Expand file tree Collapse file tree 2 files changed +9
-23
lines changed Expand file tree Collapse file tree 2 files changed +9
-23
lines changed Original file line number Diff line number Diff line change @@ -32,26 +32,9 @@ export const HotKeyLabel = ({
32
32
const item = reduceHotKey ( { keyCombo } ) ;
33
33
34
34
const label = [ ] ;
35
- const controls = [ ] ;
36
- if ( item . alt )
37
- controls . push (
38
- < span key = "alt" className = "text-[0.875rem]" >
39
- ⌥
40
- </ span > ,
41
- ) ;
42
- if ( item . ctrl )
43
- controls . push (
44
- < span key = "ctrl" className = "text-[0.875rem]" >
45
- ⌃
46
- </ span > ,
47
- ) ;
48
- if ( item . meta )
49
- controls . push (
50
- < span key = "meta" className = "text-[0.875rem]" >
51
- ⌘
52
- </ span > ,
53
- ) ;
54
-
35
+ if ( item . alt ) label . push ( "ALT" ) ;
36
+ if ( item . ctrl ) label . push ( "CTRL" ) ;
37
+ if ( item . meta ) label . push ( "META" ) ;
55
38
if ( item . shift ) label . push ( "SHFT" ) ;
56
39
if ( item . key . toLowerCase ( ) === "tab" ) label . push ( "TAB" ) ;
57
40
else if ( item . key . toLowerCase ( ) === "space" ) label . push ( "SPC" ) ;
@@ -64,14 +47,14 @@ export const HotKeyLabel = ({
64
47
else if ( item . key . toLowerCase ( ) === "escape" ) label . push ( "ESC" ) ;
65
48
else if ( item . key . toLowerCase ( ) === "backspace" ) label . push ( "BKSPC" ) ;
66
49
else label . push ( item . key . toUpperCase ( ) ) ;
67
- return [ ... controls , < span key = "label" > { label . join ( " " ) } </ span > ] ;
50
+ return [ < span key = "label" > { label . join ( " " ) } </ span > ] ;
68
51
} ,
69
52
[ keyCombo ] ,
70
53
"HotKey label" ,
71
54
) ;
72
55
73
56
return (
74
- < kbd className = "hotkey-label inline-flex gap-1 items-center text-[0.625rem] leading-4 bg-tint-900 /10 text-base/50 whitespace-nowrap rounded px-2 mx-1" >
57
+ < kbd className = "hotkey-label inline-flex gap-1 select-none self-center font-mono items-center text-[0.625rem] leading-4 bg-tint-500 /10 text-base/50 whitespace-nowrap rounded px-2 mx-1" >
75
58
{ label }
76
59
</ kbd >
77
60
) ;
Original file line number Diff line number Diff line change 24
24
import type { Meta , StoryObj } from "@storybook/react" ;
25
25
import { fn } from "@storybook/test" ;
26
26
import { Search } from "../../src" ;
27
+ import { HotKeyLabel } from "@react-fabric/core" ;
27
28
28
29
const meta : Meta = {
29
30
component : Search ,
@@ -46,7 +47,9 @@ type SearchStory = StoryObj<typeof Search>;
46
47
47
48
export const _Search : SearchStory = {
48
49
render : ( args ) => {
49
- return < Search { ...args } /> ;
50
+ return (
51
+ < Search { ...args } decorateEnd = { < HotKeyLabel keyCombo = "shift+/" /> } />
52
+ ) ;
50
53
} ,
51
54
args : {
52
55
label : "Search input" ,
You can’t perform that action at this time.
0 commit comments