File tree 3 files changed +27
-4
lines changed
3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,14 @@ function Hit({hit, children}: any) {
30
30
) ;
31
31
}
32
32
33
- function Kbd ( props : { children ?: React . ReactNode } ) {
33
+ function Kbd ( props : { children ?: React . ReactNode ; wide ?: boolean } ) {
34
+ const { wide, ...rest } = props ;
35
+ const width = wide ? 'w-10' : 'w-5' ;
36
+
34
37
return (
35
38
< kbd
36
- className = " h-5 w-5 border border-transparent mr-1 bg-wash dark:bg-wash-dark text-gray-30 align-middle p-0 inline-flex justify-center items-center text-xs text-center rounded-md"
37
- { ...props }
39
+ className = { ` ${ width } h-5 border border-transparent mr-1 bg-wash dark:bg-wash-dark text-gray-30 align-middle p-0 inline-flex justify-center items-center text-xs text-center rounded-md` }
40
+ { ...rest }
38
41
/>
39
42
) ;
40
43
}
@@ -168,7 +171,10 @@ export function Search({
168
171
< IconSearch className = "mr-3 align-middle text-gray-30 shrink-0 group-betterhover:hover:text-gray-70" />
169
172
Search
170
173
< span className = "ml-auto hidden sm:flex item-center mr-1" >
171
- < Kbd > ⌘</ Kbd >
174
+ < Kbd data-platform = "mac" > ⌘</ Kbd >
175
+ < Kbd data-platform = "win" wide >
176
+ Ctrl
177
+ </ Kbd >
172
178
< Kbd > K</ Kbd >
173
179
</ span >
174
180
</ button >
Original file line number Diff line number Diff line change @@ -49,6 +49,14 @@ const MyDocument = () => {
49
49
setTheme(e.matches ? 'dark' : 'light');
50
50
}
51
51
});
52
+
53
+ // Detect whether the browser is Mac to display platform specific content
54
+ // An example of such content can be the keyboard shortcut displayed in the search bar
55
+ document.documentElement.classList.add(
56
+ window.navigator.platform.includes('Mac')
57
+ ? "platform-mac"
58
+ : "platform-win"
59
+ );
52
60
})();
53
61
` ,
54
62
} }
Original file line number Diff line number Diff line change 97
97
display : none;
98
98
}
99
99
100
+ /* Hide all content that's relevant only to a specific platform */
101
+ html .platform-mac [data-platform = 'win' ] {
102
+ display : none;
103
+ }
104
+
105
+ html .platform-win [data-platform = 'mac' ] {
106
+ display : none;
107
+ }
108
+
100
109
html ,
101
110
body {
102
111
padding : 0 ;
You can’t perform that action at this time.
0 commit comments