mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 23:45:48 +01:00
� Update search bar styling
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user