(search): modal triggers on ctrl k

This commit is contained in:
ManishMadan2882
2024-11-18 17:00:56 +05:30
parent f58e7cc154
commit 1a9f31174d

View File

@@ -150,8 +150,8 @@ const Toolkit = styled.kbd`
top: 4px; top: 4px;
background-color: ${(props) => props.theme.primary.bg}; background-color: ${(props) => props.theme.primary.bg};
color: ${(props) => props.theme.secondary.text}; color: ${(props) => props.theme.secondary.text};
font-size: 9px; font-size: 10px;
padding: 2px; padding: 3px;
border: 1px solid ${(props) => props.theme.secondary.text}; border: 1px solid ${(props) => props.theme.secondary.text};
border-radius: 4px; border-radius: 4px;
` `
@@ -193,7 +193,8 @@ export const SearchBar = ({
}, [input]) }, [input])
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => { const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter') { event.preventDefault();
if (event.ctrlKey && event.key === 'k'){
setIsWidgetOpen(true); setIsWidgetOpen(true);
} }
}; };
@@ -231,7 +232,7 @@ export const SearchBar = ({
</SearchResults> </SearchResults>
) )
} }
<Toolkit title='Press Enter to Ask AI'>Enter</Toolkit> <Toolkit title='Press Ctrl + K to Ask AI'>Ctrl K</Toolkit>
</Container> </Container>
<WidgetCore <WidgetCore
theme={theme} theme={theme}