Commandbar and dark mode UI fixes (#491)
* Improve dark mode * Improve commandbar style and add interactions
This commit is contained in:
@ -72,21 +72,25 @@ export function CommandMenu() {
|
|||||||
<StyledInput placeholder="Search" />
|
<StyledInput placeholder="Search" />
|
||||||
<StyledList>
|
<StyledList>
|
||||||
<StyledEmpty>No results found.</StyledEmpty>
|
<StyledEmpty>No results found.</StyledEmpty>
|
||||||
<StyledGroup heading="Go to">
|
<StyledGroup heading="Navigate">
|
||||||
<CommandMenuItem to="/people" label="People" shortcuts={['G', 'P']} />
|
<CommandMenuItem
|
||||||
|
to="/people"
|
||||||
|
label="Go to People"
|
||||||
|
shortcuts={['G', 'P']}
|
||||||
|
/>
|
||||||
<CommandMenuItem
|
<CommandMenuItem
|
||||||
to="/companies"
|
to="/companies"
|
||||||
label="Companies"
|
label="Go to Companies"
|
||||||
shortcuts={['G', 'C']}
|
shortcuts={['G', 'C']}
|
||||||
/>
|
/>
|
||||||
<CommandMenuItem
|
<CommandMenuItem
|
||||||
to="/opportunities"
|
to="/opportunities"
|
||||||
label="Opportunities"
|
label="Go to Opportunities"
|
||||||
shortcuts={['G', 'O']}
|
shortcuts={['G', 'O']}
|
||||||
/>
|
/>
|
||||||
<CommandMenuItem
|
<CommandMenuItem
|
||||||
to="/settings/profile"
|
to="/settings/profile"
|
||||||
label="Settings"
|
label="Go to Settings"
|
||||||
shortcuts={['G', 'S']}
|
shortcuts={['G', 'S']}
|
||||||
/>
|
/>
|
||||||
</StyledGroup>
|
</StyledGroup>
|
||||||
|
|||||||
@ -10,6 +10,7 @@ export const StyledDialog = styled(Command.Dialog)`
|
|||||||
max-width: 640px;
|
max-width: 640px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
padding: ${({ theme }) => theme.spacing(1)};
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
@ -27,10 +28,14 @@ export const StyledInput = styled(Command.Input)`
|
|||||||
outline: none;
|
outline: none;
|
||||||
padding: ${({ theme }) => theme.spacing(5)};
|
padding: ${({ theme }) => theme.spacing(5)};
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
&::placeholder {
|
||||||
|
color: ${({ theme }) => theme.font.color.light};
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const StyledMenuItem = styled(Command.Item)`
|
export const StyledMenuItem = styled(Command.Item)`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
border-radius: 4px;
|
||||||
color: ${({ theme }) => theme.font.color.primary};
|
color: ${({ theme }) => theme.font.color.primary};
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -38,7 +43,7 @@ export const StyledMenuItem = styled(Command.Item)`
|
|||||||
gap: ${({ theme }) => theme.spacing(3)};
|
gap: ${({ theme }) => theme.spacing(3)};
|
||||||
height: 40px;
|
height: 40px;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0 ${({ theme }) => theme.spacing(4)};
|
padding: 0 ${({ theme }) => theme.spacing(1)};
|
||||||
position: relative;
|
position: relative;
|
||||||
transition: all 150ms ease;
|
transition: all 150ms ease;
|
||||||
transition-property: none;
|
transition-property: none;
|
||||||
@ -88,8 +93,8 @@ export const StyledGroup = styled(Command.Group)`
|
|||||||
font-size: ${({ theme }) => theme.font.size.xs};
|
font-size: ${({ theme }) => theme.font.size.xs};
|
||||||
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
||||||
padding-bottom: ${({ theme }) => theme.spacing(2)};
|
padding-bottom: ${({ theme }) => theme.spacing(2)};
|
||||||
padding-left: ${({ theme }) => theme.spacing(4)};
|
padding-left: ${({ theme }) => theme.spacing(2)};
|
||||||
padding-right: ${({ theme }) => theme.spacing(4)};
|
padding-right: ${({ theme }) => theme.spacing(1)};
|
||||||
padding-top: ${({ theme }) => theme.spacing(2)};
|
padding-top: ${({ theme }) => theme.spacing(2)};
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
import { fireEvent } from '@storybook/testing-library';
|
import { fireEvent, userEvent, within } from '@storybook/testing-library';
|
||||||
|
|
||||||
import { getRenderWrapperForComponent } from '~/testing/renderWrappers';
|
import { getRenderWrapperForComponent } from '~/testing/renderWrappers';
|
||||||
|
import { sleep } from '~/testing/sleep';
|
||||||
|
|
||||||
import { CommandMenu } from '../CommandMenu';
|
import { CommandMenu } from '../CommandMenu';
|
||||||
|
|
||||||
@ -34,5 +35,25 @@ export const CmdK: Story = {
|
|||||||
code: 'KeyK',
|
code: 'KeyK',
|
||||||
metaKey: true,
|
metaKey: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await sleep(50);
|
||||||
|
|
||||||
|
const canvas = within(document.body);
|
||||||
|
|
||||||
|
const searchInput = await canvas.findByPlaceholderText('Search');
|
||||||
|
|
||||||
|
await userEvent.type(searchInput, '{arrowdown}');
|
||||||
|
await userEvent.type(searchInput, '{arrowup}');
|
||||||
|
await userEvent.type(searchInput, '{arrowdown}');
|
||||||
|
await userEvent.type(searchInput, '{arrowdown}');
|
||||||
|
await userEvent.type(searchInput, '{enter}');
|
||||||
|
|
||||||
|
await sleep(50);
|
||||||
|
|
||||||
|
fireEvent.keyDown(canvasElement, {
|
||||||
|
key: 'k',
|
||||||
|
code: 'KeyK',
|
||||||
|
metaKey: true,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -35,7 +35,7 @@ const StyledButton = styled.button<Pick<Props, 'fullWidth' | 'variant'>>`
|
|||||||
box-shadow: ${({ theme }) => theme.boxShadow.light};
|
box-shadow: ${({ theme }) => theme.boxShadow.light};
|
||||||
color: ${({ theme, variant, disabled }) => {
|
color: ${({ theme, variant, disabled }) => {
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return theme.font.color.extraLight;
|
return theme.font.color.light;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (variant) {
|
switch (variant) {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ const StyledItem = styled.button<StyledItemProps>`
|
|||||||
return props.theme.color.red;
|
return props.theme.color.red;
|
||||||
}
|
}
|
||||||
if (props.soon) {
|
if (props.soon) {
|
||||||
return props.theme.font.color.extraLight;
|
return props.theme.font.color.light;
|
||||||
}
|
}
|
||||||
return props.theme.font.color.secondary;
|
return props.theme.font.color.secondary;
|
||||||
}};
|
}};
|
||||||
@ -70,7 +70,7 @@ const StyledSoonPill = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
background-color: ${({ theme }) => theme.background.transparent.light};
|
background-color: ${({ theme }) => theme.background.transparent.light};
|
||||||
font-size: ${({ theme }) => theme.font.size.xxs};
|
font-size: ${({ theme }) => theme.font.size.xs};
|
||||||
height: 16px;
|
height: 16px;
|
||||||
padding-left: ${({ theme }) => theme.spacing(2)};
|
padding-left: ${({ theme }) => theme.spacing(2)};
|
||||||
padding-right: ${({ theme }) => theme.spacing(2)};
|
padding-right: ${({ theme }) => theme.spacing(2)};
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 202 KiB |
Reference in New Issue
Block a user