� Update search bar styling

This commit is contained in:
Aj - Thomas
2022-05-16 15:56:01 +02:00
committed by ajnart
parent 8392dcef20
commit ebc7ba9684

View File

@@ -1,9 +1,19 @@
import { TextInput, Text, Popover, Kbd, Group } 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 { 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';
const useStyles = createStyles((theme) => ({
hide: {
[theme.fn.smallerThan('sm')]: {
display: 'none',
},
display: 'flex',
alignItems: 'center',
},
}));
export default function SearchBar(props: any) { export default function SearchBar(props: any) {
const { config, setConfig } = useConfig(); const { config, setConfig } = useConfig();
const [opened, setOpened] = useState(false); const [opened, setOpened] = useState(false);
@@ -12,8 +22,10 @@ export default function SearchBar(props: any) {
const textInput: any = useRef(null); const textInput: any = useRef(null);
useHotkeys([['ctrl+K', () => textInput.current.focus()]]); useHotkeys([['ctrl+K', () => textInput.current.focus()]]);
const { classes, cx } = useStyles();
const theme = useMantineTheme();
const rightSection = ( const rightSection = (
<div style={{ display: 'flex', alignItems: 'center' }}> <div className={classes.hide}>
<Kbd>Ctrl</Kbd> <Kbd>Ctrl</Kbd>
<span style={{ margin: '0 5px' }}>+</span> <span style={{ margin: '0 5px' }}>+</span>
<Kbd>K</Kbd> <Kbd>K</Kbd>
@@ -71,9 +83,7 @@ export default function SearchBar(props: any) {
onFocusCapture={() => setOpened(true)} onFocusCapture={() => setOpened(true)}
onBlurCapture={() => setOpened(false)} onBlurCapture={() => setOpened(false)}
target={ target={
<Group direction="row">
<TextInput <TextInput
width={'100%'}
variant="filled" variant="filled"
icon={icon} icon={icon}
ref={textInput} ref={textInput}
@@ -86,7 +96,6 @@ export default function SearchBar(props: any) {
{...props} {...props}
{...form.getInputProps('query')} {...form.getInputProps('query')}
/> />
</Group>
} }
> >
<Text> <Text>