fix: align workspace switcher button in collapsed navigation drawer (#12893) (#12902)

## Summary
- Fixes #12893 - Workspace switcher button now aligns properly with
record index headers when navigation drawer is collapsed
- Maintains consistent button height in both expanded and collapsed
states
- Simple CSS fix that improves visual consistency

## Fix Details
The issue was caused by the workspace switcher button changing height
from 20px (expanded) to 16px (collapsed). This created misalignment with
the page headers.

Changed in `MultiWorkspacesDropdownStyles.tsx`:
```tsx
// Before - height changed based on drawer state
height: ${({ theme, isNavigationDrawerExpanded }) =>
  isNavigationDrawerExpanded ? theme.spacing(5) : theme.spacing(4)};

// After - consistent height
height: ${({ theme }) => theme.spacing(5)};
```

## Visual Alignment
- Workspace switcher button: 20px height (theme.spacing(5))
- Maintains alignment with record index headers in collapsed state
- Consistent with Figma design requirements

## Test Plan
- [x] Collapsed navigation drawer - workspace switcher aligns with
headers
- [x] Expanded navigation drawer - no visual regression
- [x] Button functionality remains unchanged

---

🤖 This fix was implemented using [Claude Code](https://claude.ai/code)
by Jez (Jeremy Dawes) and Claude working together\!

Thanks to the Twenty team for the great project\! 🚀

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ehconitin <nitinkoche03@gmail.com>
Co-authored-by: nitin <142569587+ehconitin@users.noreply.github.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Jeremy Dawes
2025-07-05 05:06:02 +08:00
committed by GitHub
parent 324dadca63
commit 1386f344dd
8 changed files with 17 additions and 31 deletions
@@ -27,7 +27,7 @@ export const MultiWorkspaceDropdownButton = () => {
return (
<Dropdown
dropdownId={MULTI_WORKSPACE_DROPDOWN_ID}
dropdownOffset={{ y: -35, x: -5 }}
dropdownOffset={{ y: -30, x: -5 }}
clickableComponent={<MultiWorkspaceDropdownClickableComponent />}
dropdownComponents={<DropdownComponents />}
onClose={() => {
@@ -11,8 +11,7 @@ export const StyledContainer = styled.div<{
border: 1px solid transparent;
display: flex;
justify-content: space-between;
height: ${({ theme, isNavigationDrawerExpanded }) =>
isNavigationDrawerExpanded ? theme.spacing(5) : theme.spacing(4)};
height: ${({ theme }) => theme.spacing(5)};
padding: calc(${({ theme }) => theme.spacing(1)} - 1px);
width: ${({ isNavigationDrawerExpanded }) =>
isNavigationDrawerExpanded ? '100%' : 'auto'};
@@ -46,7 +46,7 @@ export const NavigationDrawerCollapseButton = ({
: IconLayoutSidebarRightCollapse
}
accent="tertiary"
size="medium"
size="small"
/>
</StyledCollapseButton>
);
@@ -4,15 +4,16 @@ import { useRecoilValue } from 'recoil';
import { MultiWorkspaceDropdownButton } from '@/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/MultiWorkspaceDropdownButton';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { PAGE_BAR_MIN_HEIGHT } from '@/ui/layout/page/constants/PageBarMinHeight';
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
import { NavigationDrawerCollapseButton } from './NavigationDrawerCollapseButton';
const StyledContainer = styled.div`
align-items: center;
display: flex;
height: ${({ theme }) => theme.spacing(8)};
user-select: none;
padding-right: ${({ theme }) => theme.spacing(2)};
min-height: ${PAGE_BAR_MIN_HEIGHT}px;
`;
const StyledNavigationDrawerCollapseButton = styled(
@@ -90,7 +90,7 @@ const StyledItem = styled('button', {
width: ${(props) =>
!props.isNavigationDrawerExpanded
? `calc(${NAV_DRAWER_WIDTHS.menu.desktop.collapsed}px - ${props.theme.spacing(5.5)})`
? `calc(${NAV_DRAWER_WIDTHS.menu.desktop.collapsed}px - ${props.theme.spacing(6)})`
: `calc(100% - ${props.theme.spacing(1.5)})`};
${({ isDragging }) =>