🏷️ Update types for the SearchBar

This commit is contained in:
ajnart
2022-05-17 01:52:43 +02:00
parent a474f3e4ee
commit d4ce2a3ed6

View File

@@ -1,6 +1,6 @@
import { TextInput, Kbd, createStyles, useMantineTheme, Text, Popover } from '@mantine/core'; import { TextInput, Kbd, createStyles, useMantineTheme, Text, Popover } from '@mantine/core';
import { useForm, useHotkeys } from '@mantine/hooks'; import { useForm, useHotkeys } from '@mantine/hooks';
import { MutableRefObject, useRef, useState } from 'react'; import { useRef, useState } from 'react';
import { Search, BrandYoutube, Download } from 'tabler-icons-react'; import { Search, BrandYoutube, Download } from 'tabler-icons-react';
import { useConfig } from '../../tools/state'; import { useConfig } from '../../tools/state';
@@ -20,7 +20,7 @@ export default function SearchBar(props: any) {
const [icon, setIcon] = useState(<Search />); const [icon, setIcon] = useState(<Search />);
const queryUrl = config.settings.searchUrl || 'https://www.google.com/search?q='; const queryUrl = config.settings.searchUrl || 'https://www.google.com/search?q=';
const textInput = useRef<HTMLInputElement>(); const textInput = useRef<HTMLInputElement>();
useHotkeys([['ctrl+K', () => textInput.current.focus()]]); useHotkeys([['ctrl+K', () => textInput.current && textInput.current.focus()]]);
const { classes, cx } = useStyles(); const { classes, cx } = useStyles();
const theme = useMantineTheme(); const theme = useMantineTheme();