1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-14 19:39:47 +00:00

Allow meta + K shortcut for search, use npm not yarn.

This commit is contained in:
Brenden Matthews 2022-10-04 21:46:14 -05:00 committed by Brenden Matthews
parent 30f113cdb9
commit 1051acbe88
5 changed files with 26307 additions and 8671 deletions

View File

@ -77,7 +77,14 @@ const Search: React.FunctionComponent<SearchProps> = (props) => {
const [isOpen, setIsOpen] = useState(false) const [isOpen, setIsOpen] = useState(false)
const handleKeyPress = useCallback( const handleKeyPress = useCallback(
(event: KeyboardEvent) => { (event: KeyboardEvent) => {
if (event.key == '/' && !isOpen) { if (event.key === 'k' && (event.metaKey || event.ctrlKey) && isOpen) {
setIsOpen(false)
event.preventDefault()
} else if (
(event.key == '/' ||
(event.key === 'k' && (event.metaKey || event.ctrlKey))) &&
!isOpen
) {
setIsOpen(true) setIsOpen(true)
event.preventDefault() event.preventDefault()
} }
@ -127,7 +134,7 @@ const Search: React.FunctionComponent<SearchProps> = (props) => {
return ( return (
<> <>
<div className="flex items-center ml-2"> <div className="flex items-center ml-2">
<button onClick={openModal} title="Search (/)"> <button onClick={openModal} title="Search (/ or ⌘K)">
<SearchIcon size={32} /> <SearchIcon size={32} />
</button> </button>
</div> </div>
@ -158,7 +165,7 @@ const Search: React.FunctionComponent<SearchProps> = (props) => {
<SearchIcon size={32} /> <SearchIcon size={32} />
</Combobox.Label> </Combobox.Label>
<Combobox.Input <Combobox.Input
placeholder="Search docs (/)" placeholder="Search docs (/ or ⌘K)"
className="mx-1 p-2 w-full bg-gray-200 dark:bg-gray-800 outline-none" className="mx-1 p-2 w-full bg-gray-200 dark:bg-gray-800 outline-none"
onChange={(e) => setSearch(e.target.value)} onChange={(e) => setSearch(e.target.value)}
/> />

View File

@ -1,5 +1,5 @@
[build] [build]
command = "yarn run build" command = "npm run build"
publish = ".next" publish = ".next"
# Include the doc dir in the build ignore command # Include the doc dir in the build ignore command

26295
web/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-mdx": "^2.0.5", "eslint-plugin-mdx": "^2.0.5",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"netlify-plugin-cypress": "~2.2.0", "netlify-plugin-cypress": "^2.2.0",
"next-mdx-remote": "^4.1.0", "next-mdx-remote": "^4.1.0",
"next-remote-watch": "2.0.0", "next-remote-watch": "2.0.0",
"postcss": "^8.4.4", "postcss": "^8.4.4",
@ -58,7 +58,6 @@
"remark-gfm": "^3.0.1", "remark-gfm": "^3.0.1",
"tailwindcss": "^3.1.0", "tailwindcss": "^3.1.0",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-airbnb": "^5.11.2",
"typescript": "^4.8.3" "typescript": "^4.8.3"
} }
} }

File diff suppressed because it is too large Load Diff