add keyboard shortcuts

This commit is contained in:
Sanster
2022-02-07 22:25:24 +08:00
parent 56238c5068
commit 3db21e7e95
4 changed files with 91 additions and 6 deletions

View File

@@ -1,12 +1,14 @@
import { ArrowLeftIcon } from '@heroicons/react/outline'
import React, { useState } from 'react'
import { useWindowSize } from 'react-use'
import { useToggle, useWindowSize } from 'react-use'
import Button from './components/Button'
import FileSelect from './components/FileSelect'
import ShortcutsModal from './components/ShortcutsModal'
import Editor from './Editor'
function App() {
const [file, setFile] = useState<File>()
const [showShortcuts, toggleShowShortcuts] = useToggle(false)
const windowSize = useWindowSize()
return (
@@ -27,6 +29,7 @@ function App() {
{file ? (
<Button
onClick={toggleShowShortcuts}
icon={
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -57,6 +60,8 @@ function App() {
)}
</header>
{showShortcuts && <ShortcutsModal onClose={toggleShowShortcuts} />}
<main
className={[
'h-full flex flex-1 flex-col sm:items-center sm:justify-center overflow-hidden',