mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
feat: added windows support for shortcut
This commit is contained in:
parent
481c60ac09
commit
cbc23a63a1
13
components/PlatformDisplay.tsx
Normal file
13
components/PlatformDisplay.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { ReactNode } from 'react'
|
||||||
|
|
||||||
|
const PlatformDisplay = ({ osx, children }:PlatformDisplayProps): JSX.Element => {
|
||||||
|
const isOSX = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)
|
||||||
|
return <>{isOSX ? osx ?? children : children}</>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PlatformDisplayProps {
|
||||||
|
osx?: ReactNode
|
||||||
|
children: ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PlatformDisplay
|
||||||
@ -24,6 +24,7 @@ import 'core-js/es/map'
|
|||||||
import '../app.css'
|
import '../app.css'
|
||||||
import '../github-markdown.css'
|
import '../github-markdown.css'
|
||||||
import '@fortawesome/fontawesome-free/css/all.css'
|
import '@fortawesome/fontawesome-free/css/all.css'
|
||||||
|
import PlatformDisplay from '@components/PlatformDisplay'
|
||||||
|
|
||||||
init()
|
init()
|
||||||
|
|
||||||
@ -83,11 +84,20 @@ export default function App({ Component, pageProps, err }: KoreanbotsProps): JSX
|
|||||||
<ul>
|
<ul>
|
||||||
<li className='pt-2'>
|
<li className='pt-2'>
|
||||||
<h4 className='text-gray-500 dark:text-gray-400 text-xs'>단축키 도움말 표시</h4>
|
<h4 className='text-gray-500 dark:text-gray-400 text-xs'>단축키 도움말 표시</h4>
|
||||||
<kbd>CMD</kbd> <kbd>/</kbd>
|
<kbd>
|
||||||
|
<PlatformDisplay osx='CMD'>
|
||||||
|
Ctrl
|
||||||
|
</PlatformDisplay>
|
||||||
|
</kbd> <kbd>/</kbd>
|
||||||
</li>
|
</li>
|
||||||
<li className='pt-2'>
|
<li className='pt-2'>
|
||||||
<h4 className='text-gray-500 dark:text-gray-400 text-xs'>다크모드 전환</h4>
|
<h4 className='text-gray-500 dark:text-gray-400 text-xs'>다크모드 전환</h4>
|
||||||
<kbd>CMD</kbd> <kbd>K</kbd>
|
<kbd>
|
||||||
|
<PlatformDisplay osx='CMD'>
|
||||||
|
Ctrl
|
||||||
|
</PlatformDisplay>
|
||||||
|
</kbd>
|
||||||
|
<kbd>Shift</kbd> <kbd>D</kbd>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -95,11 +105,13 @@ export default function App({ Component, pageProps, err }: KoreanbotsProps): JSX
|
|||||||
<GlobalHotKeys keyMap={shortcutKeyMap} handlers={{
|
<GlobalHotKeys keyMap={shortcutKeyMap} handlers={{
|
||||||
SHORTCUT_HELP: () => {
|
SHORTCUT_HELP: () => {
|
||||||
setShortcutModal(value => !value)
|
setShortcutModal(value => !value)
|
||||||
|
return
|
||||||
},
|
},
|
||||||
CHANGE_THEME: () => {
|
CHANGE_THEME: () => {
|
||||||
const overwrite = (localStorage.theme || systemTheme()) === 'dark' ? 'light' : 'dark'
|
const overwrite = (localStorage.theme || systemTheme()) === 'dark' ? 'light' : 'dark'
|
||||||
setTheme(overwrite)
|
setTheme(overwrite)
|
||||||
localStorage.setItem('theme', overwrite)
|
localStorage.setItem('theme', overwrite)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}} />
|
}} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -216,7 +216,8 @@ export const KoreanbotsEmoji = [{
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
export const shortcutKeyMap: KeyMap = {
|
export const shortcutKeyMap: KeyMap = {
|
||||||
CHANGE_THEME: 'command+k'
|
SHORTCUT_HELP: ['command+/', 'ctrl+/'],
|
||||||
|
CHANGE_THEME: ['command+shift+d', 'ctrl+shift+d']
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ErrorText = {
|
export const ErrorText = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user