chore: update style

This commit is contained in:
JimmFly
2023-02-07 12:31:06 +08:00
parent a54bc69d46
commit fd72f69303
2 changed files with 46 additions and 37 deletions

View File

@@ -30,7 +30,9 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => {
const [publishWorkspaceName, setPublishWorkspaceName] = useState(''); const [publishWorkspaceName, setPublishWorkspaceName] = useState('');
const [showCreatePage, setShowCreatePage] = useState(true); const [showCreatePage, setShowCreatePage] = useState(true);
const { triggerQuickSearchModal } = useModal(); const { triggerQuickSearchModal } = useModal();
const isPublicAndNoQuery = () => {
return isPublic && query.length === 0;
};
// Add ‘⌘+K’ shortcut keys as switches // Add ‘⌘+K’ shortcut keys as switches
useEffect(() => { useEffect(() => {
const down = (e: KeyboardEvent) => { const down = (e: KeyboardEvent) => {
@@ -72,7 +74,7 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => {
width={620} width={620}
style={{ style={{
maxHeight: '80vh', maxHeight: '80vh',
minHeight: isPublic && query.length === 0 ? '72px' : '350px', minHeight: isPublicAndNoQuery() ? '72px' : '350px',
top: '12vh', top: '12vh',
}} }}
> >
@@ -100,11 +102,14 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => {
/> />
<StyledShortcut>{isMac() ? '⌘ + K' : 'Ctrl + K'}</StyledShortcut> <StyledShortcut>{isMac() ? '⌘ + K' : 'Ctrl + K'}</StyledShortcut>
</StyledModalHeader> </StyledModalHeader>
{isPublic && query.length === 0 ? null : (
<> <>
<StyledModalDivider /> <StyledModalDivider
style={{ display: isPublicAndNoQuery() ? 'none' : '' }}
/>
<Command.List> <Command.List>
<StyledContent> <StyledContent
style={{ display: isPublicAndNoQuery() ? 'none' : '' }}
>
{!isPublic ? ( {!isPublic ? (
<Results <Results
query={query} query={query}
@@ -130,11 +135,14 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => {
<Footer query={query} /> <Footer query={query} />
</StyledModalFooter> </StyledModalFooter>
</> </>
) : null ) : (
) : null} <></>
)
) : (
<></>
)}
</Command.List> </Command.List>
</> </>
)}
</Command> </Command>
</ModalWrapper> </ModalWrapper>
</Modal> </Modal>

View File

@@ -9,6 +9,7 @@ export const StyledContent = styled('div')(({ theme }) => {
marginBottom: '10px', marginBottom: '10px',
...displayFlex('center', 'flex-start'), ...displayFlex('center', 'flex-start'),
color: theme.colors.popoverColor, color: theme.colors.popoverColor,
transition: 'all 0.15s',
letterSpacing: '0.06em', letterSpacing: '0.06em',
'[cmdk-group-heading]': { '[cmdk-group-heading]': {
margin: '5px 16px', margin: '5px 16px',
@@ -16,7 +17,6 @@ export const StyledContent = styled('div')(({ theme }) => {
fontWeight: '500', fontWeight: '500',
}, },
'[aria-selected="true"]': { '[aria-selected="true"]': {
transition: 'background .15s, color .15s',
borderRadius: '5px', borderRadius: '5px',
color: theme.colors.primaryColor, color: theme.colors.primaryColor,
backgroundColor: theme.colors.hoverBackground, backgroundColor: theme.colors.hoverBackground,
@@ -103,6 +103,7 @@ export const StyledModalDivider = styled('div')(({ theme }) => {
margin: '6px 16px 6.5px 16px', margin: '6px 16px 6.5px 16px',
position: 'relative', position: 'relative',
borderTop: `0.5px solid ${theme.colors.placeHolderColor}`, borderTop: `0.5px solid ${theme.colors.placeHolderColor}`,
transition: 'all 0.15s',
}; };
}); });