fix(dropdown): separator width + DropdownHeader height (#12285)

## Before

![CleanShot 2025-05-26 at 15 26
35@2x](https://github.com/user-attachments/assets/d6247af2-6008-4234-b777-13597c697b12)

## After

![CleanShot 2025-05-26 at 15 26
42@2x](https://github.com/user-attachments/assets/65447c84-4313-4f9a-831d-efc1eccd3d26)
This commit is contained in:
Antoine Moreaux
2025-05-27 11:17:03 +02:00
committed by GitHub
parent 8cf3b83bb9
commit a83279ddce
5 changed files with 63 additions and 45 deletions

View File

@ -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}

View File

@ -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;

View File

@ -129,6 +129,7 @@ export const MultiWorkspaceDropdownDefaultComponents = () => {
> >
{currentWorkspace?.displayName} {currentWorkspace?.displayName}
</DropdownMenuHeader> </DropdownMenuHeader>
<DropdownMenuSeparator />
{workspaces.length > 1 && ( {workspaces.length > 1 && (
<> <>
<StyledDropdownMenuItemsContainer> <StyledDropdownMenuItemsContainer>

View File

@ -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,8 +30,11 @@ export const MultiWorkspaceDropdownThemesComponents = () => {
> >
{t`Theme`} {t`Theme`}
</DropdownMenuHeader> </DropdownMenuHeader>
<DropdownMenuSeparator />
<DropdownMenuItemsContainer>
{colorSchemeList.map((theme) => ( {colorSchemeList.map((theme) => (
<MenuItem <MenuItem
key={theme.id}
LeftIcon={theme.icon} LeftIcon={theme.icon}
/* eslint-disable-next-line lingui/no-expression-in-message */ /* eslint-disable-next-line lingui/no-expression-in-message */
text={t`${theme.id}`} text={t`${theme.id}`}
@ -39,5 +43,6 @@ export const MultiWorkspaceDropdownThemesComponents = () => {
/> />
))} ))}
</DropdownMenuItemsContainer> </DropdownMenuItemsContainer>
</>
); );
}; };

View File

@ -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,6 +52,7 @@ export const MultiWorkspaceDropdownWorkspacesListComponents = () => {
}} }}
/> />
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuItemsContainer>
{workspaces {workspaces
.filter( .filter(
(workspace) => (workspace) =>
@ -81,5 +83,6 @@ export const MultiWorkspaceDropdownWorkspacesListComponents = () => {
</UndecoratedLink> </UndecoratedLink>
))} ))}
</DropdownMenuItemsContainer> </DropdownMenuItemsContainer>
</>
); );
}; };