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