## 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>
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
|
|
import styled from '@emotion/styled';
|
|
import { useSetRecoilState } from 'recoil';
|
|
import {
|
|
IconLayoutSidebarLeftCollapse,
|
|
IconLayoutSidebarRightCollapse,
|
|
} from 'twenty-ui/display';
|
|
import { LightIconButton } from 'twenty-ui/input';
|
|
|
|
const StyledCollapseButton = styled.div`
|
|
align-items: center;
|
|
border-radius: ${({ theme }) => theme.border.radius.md};
|
|
color: ${({ theme }) => theme.font.color.light};
|
|
cursor: pointer;
|
|
display: flex;
|
|
justify-content: center;
|
|
user-select: none;
|
|
`;
|
|
|
|
type NavigationDrawerCollapseButtonProps = {
|
|
className?: string;
|
|
direction?: 'left' | 'right';
|
|
};
|
|
|
|
export const NavigationDrawerCollapseButton = ({
|
|
className,
|
|
direction = 'left',
|
|
}: NavigationDrawerCollapseButtonProps) => {
|
|
const setIsNavigationDrawerExpanded = useSetRecoilState(
|
|
isNavigationDrawerExpandedState,
|
|
);
|
|
|
|
return (
|
|
<StyledCollapseButton
|
|
className={className}
|
|
onClick={() =>
|
|
setIsNavigationDrawerExpanded(
|
|
(previousIsExpanded) => !previousIsExpanded,
|
|
)
|
|
}
|
|
>
|
|
<LightIconButton
|
|
Icon={
|
|
direction === 'left'
|
|
? IconLayoutSidebarLeftCollapse
|
|
: IconLayoutSidebarRightCollapse
|
|
}
|
|
accent="tertiary"
|
|
size="small"
|
|
/>
|
|
</StyledCollapseButton>
|
|
);
|
|
};
|