-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.tsx
40 lines (35 loc) · 937 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import 'react-app-polyfill/ie11';
import * as React from 'react';
import { KeyBindProvider, ShortcutType } from '../.';
import ShowShortcuts from './components/ShowShortcuts';
import RegisterShortcut from './components/RegisterShortcut';
import { createRoot } from 'react-dom/client';
import RegisterOnMount from './components/RegisterOnMount';
const GLOBAL_COMMANDS: ShortcutType[] = [
{
keys: {
Mac: ['Control', 'Shift', 'P'],
Windows: ['Control', 'Shift', 'P'],
},
label: 'Test command',
callback: () => {
// eslint-disable-next-line no-alert
alert('Hello world');
},
},
];
const App = () => {
return (
<div>
<ShowShortcuts />
<RegisterShortcut />
<RegisterOnMount />
</div>
);
};
const root = createRoot(document.getElementById('root') as HTMLElement);
root.render(
<KeyBindProvider shortcuts={GLOBAL_COMMANDS}>
<App />
</KeyBindProvider>
);