fix(dropdown): separator width + DropdownHeader height (#12285)
## Before  ## After 
This commit is contained in:
@ -73,6 +73,12 @@ const StyledSelectedSortDirectionContainer = styled.div`
|
|||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const StyledDropdownMenuHeaderEndComponent = styled.div`
|
||||||
|
padding: ${({ theme }) => theme.spacing(1)};
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
`;
|
||||||
|
|
||||||
export type ObjectSortDropdownButtonProps = {
|
export type ObjectSortDropdownButtonProps = {
|
||||||
hotkeyScope: HotkeyScope;
|
hotkeyScope: HotkeyScope;
|
||||||
};
|
};
|
||||||
@ -253,12 +259,17 @@ export const ObjectSortDropdownButton = ({
|
|||||||
!isRecordSortDirectionMenuUnfolded,
|
!isRecordSortDirectionMenuUnfolded,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
EndComponent={<IconChevronDown size={theme.icon.size.md} />}
|
EndComponent={
|
||||||
|
<StyledDropdownMenuHeaderEndComponent>
|
||||||
|
<IconChevronDown size={theme.icon.size.md} />
|
||||||
|
</StyledDropdownMenuHeaderEndComponent>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{selectedRecordSortDirection === 'asc'
|
{selectedRecordSortDirection === 'asc'
|
||||||
? t`Ascending`
|
? t`Ascending`
|
||||||
: t`Descending`}
|
: t`Descending`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
<StyledInput
|
<StyledInput
|
||||||
autoFocus
|
autoFocus
|
||||||
value={objectSortDropdownSearchInput}
|
value={objectSortDropdownSearchInput}
|
||||||
|
|||||||
@ -12,7 +12,6 @@ const StyledHeader = styled.li`
|
|||||||
border-top-left-radius: ${({ theme }) => theme.border.radius.sm};
|
border-top-left-radius: ${({ theme }) => theme.border.radius.sm};
|
||||||
border-top-right-radius: ${({ theme }) => theme.border.radius.sm};
|
border-top-right-radius: ${({ theme }) => theme.border.radius.sm};
|
||||||
padding: ${({ theme }) => theme.spacing(1)};
|
padding: ${({ theme }) => theme.spacing(1)};
|
||||||
border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
|
|
||||||
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
@ -32,7 +31,6 @@ const StyledChildrenWrapper = styled.span`
|
|||||||
const StyledEndComponent = styled.div`
|
const StyledEndComponent = styled.div`
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
color: ${({ theme }) => theme.font.color.tertiary};
|
color: ${({ theme }) => theme.font.color.tertiary};
|
||||||
padding: ${({ theme }) => theme.spacing(1)};
|
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
|
|
||||||
|
|||||||
@ -129,6 +129,7 @@ export const MultiWorkspaceDropdownDefaultComponents = () => {
|
|||||||
>
|
>
|
||||||
{currentWorkspace?.displayName}
|
{currentWorkspace?.displayName}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
{workspaces.length > 1 && (
|
{workspaces.length > 1 && (
|
||||||
<>
|
<>
|
||||||
<StyledDropdownMenuItemsContainer>
|
<StyledDropdownMenuItemsContainer>
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { useLingui } from '@lingui/react/macro';
|
|||||||
import { useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
import { IconCheck, IconChevronLeft } from 'twenty-ui/display';
|
import { IconCheck, IconChevronLeft } from 'twenty-ui/display';
|
||||||
import { MenuItem } from 'twenty-ui/navigation';
|
import { MenuItem } from 'twenty-ui/navigation';
|
||||||
|
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
|
||||||
|
|
||||||
export const MultiWorkspaceDropdownThemesComponents = () => {
|
export const MultiWorkspaceDropdownThemesComponents = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -18,7 +19,7 @@ export const MultiWorkspaceDropdownThemesComponents = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenuItemsContainer>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartComponent={
|
StartComponent={
|
||||||
<DropdownMenuHeaderLeftComponent
|
<DropdownMenuHeaderLeftComponent
|
||||||
@ -29,15 +30,19 @@ export const MultiWorkspaceDropdownThemesComponents = () => {
|
|||||||
>
|
>
|
||||||
{t`Theme`}
|
{t`Theme`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
{colorSchemeList.map((theme) => (
|
<DropdownMenuSeparator />
|
||||||
<MenuItem
|
<DropdownMenuItemsContainer>
|
||||||
LeftIcon={theme.icon}
|
{colorSchemeList.map((theme) => (
|
||||||
/* eslint-disable-next-line lingui/no-expression-in-message */
|
<MenuItem
|
||||||
text={t`${theme.id}`}
|
key={theme.id}
|
||||||
onClick={() => setColorScheme(theme.id)}
|
LeftIcon={theme.icon}
|
||||||
RightIcon={theme.id === colorScheme ? IconCheck : undefined}
|
/* eslint-disable-next-line lingui/no-expression-in-message */
|
||||||
/>
|
text={t`${theme.id}`}
|
||||||
))}
|
onClick={() => setColorScheme(theme.id)}
|
||||||
</DropdownMenuItemsContainer>
|
RightIcon={theme.id === colorScheme ? IconCheck : undefined}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</DropdownMenuItemsContainer>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export const MultiWorkspaceDropdownWorkspacesListComponents = () => {
|
|||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenuItemsContainer>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartComponent={
|
StartComponent={
|
||||||
<DropdownMenuHeaderLeftComponent
|
<DropdownMenuHeaderLeftComponent
|
||||||
@ -43,6 +43,7 @@ export const MultiWorkspaceDropdownWorkspacesListComponents = () => {
|
|||||||
>
|
>
|
||||||
{t`Other workspaces`}
|
{t`Other workspaces`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuSearchInput
|
<DropdownMenuSearchInput
|
||||||
placeholder={t`Search`}
|
placeholder={t`Search`}
|
||||||
autoFocus
|
autoFocus
|
||||||
@ -51,35 +52,37 @@ export const MultiWorkspaceDropdownWorkspacesListComponents = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
{workspaces
|
<DropdownMenuItemsContainer>
|
||||||
.filter(
|
{workspaces
|
||||||
(workspace) =>
|
.filter(
|
||||||
workspace.id !== currentWorkspace?.id &&
|
(workspace) =>
|
||||||
workspace.displayName
|
workspace.id !== currentWorkspace?.id &&
|
||||||
?.toLowerCase()
|
workspace.displayName
|
||||||
.includes(searchValue.toLowerCase()),
|
?.toLowerCase()
|
||||||
)
|
.includes(searchValue.toLowerCase()),
|
||||||
.map((workspace) => (
|
)
|
||||||
<UndecoratedLink
|
.map((workspace) => (
|
||||||
key={workspace.id}
|
<UndecoratedLink
|
||||||
to={buildWorkspaceUrl(getWorkspaceUrl(workspace.workspaceUrls))}
|
key={workspace.id}
|
||||||
onClick={(event) => {
|
to={buildWorkspaceUrl(getWorkspaceUrl(workspace.workspaceUrls))}
|
||||||
event?.preventDefault();
|
onClick={(event) => {
|
||||||
handleChange(workspace);
|
event?.preventDefault();
|
||||||
}}
|
handleChange(workspace);
|
||||||
>
|
}}
|
||||||
<MenuItemSelectAvatar
|
>
|
||||||
text={workspace.displayName ?? '(No name)'}
|
<MenuItemSelectAvatar
|
||||||
avatar={
|
text={workspace.displayName ?? '(No name)'}
|
||||||
<Avatar
|
avatar={
|
||||||
placeholder={workspace.displayName || ''}
|
<Avatar
|
||||||
avatarUrl={workspace.logo ?? DEFAULT_WORKSPACE_LOGO}
|
placeholder={workspace.displayName || ''}
|
||||||
/>
|
avatarUrl={workspace.logo ?? DEFAULT_WORKSPACE_LOGO}
|
||||||
}
|
/>
|
||||||
selected={currentWorkspace?.id === workspace.id}
|
}
|
||||||
/>
|
selected={currentWorkspace?.id === workspace.id}
|
||||||
</UndecoratedLink>
|
/>
|
||||||
))}
|
</UndecoratedLink>
|
||||||
</DropdownMenuItemsContainer>
|
))}
|
||||||
|
</DropdownMenuItemsContainer>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user