mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 07:01:04 +03:00
feat: add shortcut text hint to the search field (#3269)
* feat: add shortcut text hint to the search field * fix: search box width to fit the shortcut hint text * fix: error when not running on Mac due to an undefined `os` variable
This commit is contained in:
committed by
GitHub
parent
d3c5abf8be
commit
da0a15eee1
@@ -10,6 +10,12 @@ import { StyledFab } from '@/ui-component/button/StyledFab'
|
|||||||
import { IconSearch, IconArrowLeft, IconEdit } from '@tabler/icons-react'
|
import { IconSearch, IconArrowLeft, IconEdit } from '@tabler/icons-react'
|
||||||
|
|
||||||
import useSearchShorcut from '@/hooks/useSearchShortcut'
|
import useSearchShorcut from '@/hooks/useSearchShortcut'
|
||||||
|
import { getOS } from '@/utils/genericHelper'
|
||||||
|
|
||||||
|
const os = getOS()
|
||||||
|
const isMac = os === 'macos'
|
||||||
|
const isDesktop = isMac || os === 'windows' || os === 'linux'
|
||||||
|
const keyboardShortcut = isMac ? '[ ⌘ + F ]' : '[ Ctrl + F ]'
|
||||||
|
|
||||||
const ViewHeader = ({
|
const ViewHeader = ({
|
||||||
children,
|
children,
|
||||||
@@ -93,7 +99,7 @@ const ViewHeader = ({
|
|||||||
inputRef={searchInputRef}
|
inputRef={searchInputRef}
|
||||||
size='small'
|
size='small'
|
||||||
sx={{
|
sx={{
|
||||||
width: '280px',
|
width: '325px',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
display: { xs: 'none', sm: 'flex' },
|
display: { xs: 'none', sm: 'flex' },
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
@@ -103,7 +109,7 @@ const ViewHeader = ({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
variant='outlined'
|
variant='outlined'
|
||||||
placeholder={searchPlaceholder}
|
placeholder={`${searchPlaceholder} ${isDesktop ? keyboardShortcut : ''}`}
|
||||||
onChange={onSearchChange}
|
onChange={onSearchChange}
|
||||||
startAdornment={
|
startAdornment={
|
||||||
<Box
|
<Box
|
||||||
|
|||||||
Reference in New Issue
Block a user