Fix settings navigation advanced design (#7472)

This PR moved the settings navigation to the left and bottom
https://github.com/twentyhq/twenty/pull/7130

Updating the logic to:
-remove logic that move the existing
-add the setting icon to absolute

<img width="264" alt="Capture d’écran 2024-10-07 à 18 04 05"
src="https://github.com/user-attachments/assets/b848a5dd-50e9-48c2-bb50-1dcffa9481ac">
<img width="264" alt="Capture d’écran 2024-10-07 à 18 04 11"
src="https://github.com/user-attachments/assets/3812929c-dce0-410b-8caa-3ea1210af958">
This commit is contained in:
Thomas Trompette
2024-10-07 18:19:00 +02:00
committed by GitHub
parent 8b716f98f7
commit fbb5b3dfd4
6 changed files with 36 additions and 40 deletions

View File

@@ -39,31 +39,6 @@ import styled from '@emotion/styled';
import { AnimatePresence, motion } from 'framer-motion'; import { AnimatePresence, motion } from 'framer-motion';
import { matchPath, resolvePath, useLocation } from 'react-router-dom'; import { matchPath, resolvePath, useLocation } from 'react-router-dom';
const StyledNavigationDrawerSection = styled(NavigationDrawerSection)<{
withLeftMargin?: boolean;
}>`
margin-left: ${({ withLeftMargin, theme }) =>
withLeftMargin && theme.spacing(5)};
margin-top: ${({ theme }) => theme.spacing(3)};
`;
const StyledIconContainer = styled.div`
border-right: 1px solid ${MAIN_COLORS.yellow};
display: flex;
margin-top: ${({ theme }) => theme.spacing(5)};
width: 16px;
`;
const StyledDeveloperSection = styled.div`
display: flex;
width: 100%;
gap: ${({ theme }) => theme.spacing(1)};
`;
const StyledIconTool = styled(IconTool)`
margin-right: ${({ theme }) => theme.spacing(0.5)};
`;
type SettingsNavigationItem = { type SettingsNavigationItem = {
label: string; label: string;
path: SettingsPath; path: SettingsPath;
@@ -72,6 +47,27 @@ type SettingsNavigationItem = {
indentationLevel?: NavigationDrawerItemIndentationLevel; indentationLevel?: NavigationDrawerItemIndentationLevel;
}; };
const StyledIconContainer = styled.div`
border-right: 1px solid ${MAIN_COLORS.yellow};
display: flex;
width: 16px;
position: absolute;
left: ${({ theme }) => theme.spacing(-5)};
margin-top: ${({ theme }) => theme.spacing(2)};
height: 90%;
`;
const StyledDeveloperSection = styled.div`
display: flex;
width: 100%;
gap: ${({ theme }) => theme.spacing(1)};
position: relative;
`;
const StyledIconTool = styled(IconTool)`
margin-right: ${({ theme }) => theme.spacing(0.5)};
`;
export const SettingsNavigationDrawerItems = () => { export const SettingsNavigationDrawerItems = () => {
const isAdvancedModeEnabled = useRecoilValue(isAdvancedModeEnabledState); const isAdvancedModeEnabled = useRecoilValue(isAdvancedModeEnabledState);
const { contentRef, motionAnimationVariants } = useExpandedHeightAnimation( const { contentRef, motionAnimationVariants } = useExpandedHeightAnimation(
@@ -123,7 +119,7 @@ export const SettingsNavigationDrawerItems = () => {
return ( return (
<> <>
<StyledNavigationDrawerSection withLeftMargin> <NavigationDrawerSection>
<NavigationDrawerSectionTitle label="User" /> <NavigationDrawerSectionTitle label="User" />
<SettingsNavigationDrawerItem <SettingsNavigationDrawerItem
label="Profile" label="Profile"
@@ -156,8 +152,8 @@ export const SettingsNavigationDrawerItems = () => {
/> />
))} ))}
</NavigationDrawerItemGroup> </NavigationDrawerItemGroup>
</StyledNavigationDrawerSection> </NavigationDrawerSection>
<StyledNavigationDrawerSection withLeftMargin> <NavigationDrawerSection>
<NavigationDrawerSectionTitle label="Workspace" /> <NavigationDrawerSectionTitle label="Workspace" />
<SettingsNavigationDrawerItem <SettingsNavigationDrawerItem
label="General" label="General"
@@ -194,7 +190,7 @@ export const SettingsNavigationDrawerItems = () => {
Icon={IconCode} Icon={IconCode}
/> />
)} )}
</StyledNavigationDrawerSection> </NavigationDrawerSection>
<AnimatePresence> <AnimatePresence>
{isAdvancedModeEnabled && ( {isAdvancedModeEnabled && (
<motion.div <motion.div
@@ -208,7 +204,7 @@ export const SettingsNavigationDrawerItems = () => {
<StyledIconContainer> <StyledIconContainer>
<StyledIconTool size={12} color={MAIN_COLORS.yellow} /> <StyledIconTool size={12} color={MAIN_COLORS.yellow} />
</StyledIconContainer> </StyledIconContainer>
<StyledNavigationDrawerSection> <NavigationDrawerSection>
<NavigationDrawerSectionTitle label="Developers" /> <NavigationDrawerSectionTitle label="Developers" />
<SettingsNavigationDrawerItem <SettingsNavigationDrawerItem
label="API & Webhooks" label="API & Webhooks"
@@ -222,12 +218,12 @@ export const SettingsNavigationDrawerItems = () => {
Icon={IconFunction} Icon={IconFunction}
/> />
)} )}
</StyledNavigationDrawerSection> </NavigationDrawerSection>
</StyledDeveloperSection> </StyledDeveloperSection>
</motion.div> </motion.div>
)} )}
</AnimatePresence> </AnimatePresence>
<StyledNavigationDrawerSection withLeftMargin> <NavigationDrawerSection>
<NavigationDrawerSectionTitle label="Other" /> <NavigationDrawerSectionTitle label="Other" />
<SettingsNavigationDrawerItem <SettingsNavigationDrawerItem
label="Releases" label="Releases"
@@ -239,7 +235,7 @@ export const SettingsNavigationDrawerItems = () => {
onClick={signOut} onClick={signOut}
Icon={IconDoorEnter} Icon={IconDoorEnter}
/> />
</StyledNavigationDrawerSection> </NavigationDrawerSection>
</> </>
); );
}; };

View File

@@ -85,7 +85,7 @@ export const DefaultLayout = () => {
? (windowsWidth - ? (windowsWidth -
(OBJECT_SETTINGS_WIDTH + (OBJECT_SETTINGS_WIDTH +
DESKTOP_NAV_DRAWER_WIDTHS.menu + DESKTOP_NAV_DRAWER_WIDTHS.menu +
88)) / 64)) /
2 2
: 0, : 0,
}} }}

View File

@@ -9,6 +9,7 @@ const StyledContainer = styled.div`
display: flex; display: flex;
width: 100%; width: 100%;
gap: ${({ theme }) => theme.spacing(2)}; gap: ${({ theme }) => theme.spacing(2)};
position: relative;
`; `;
const StyledText = styled.span` const StyledText = styled.span`
@@ -20,8 +21,9 @@ const StyledText = styled.span`
const StyledIconContainer = styled.div` const StyledIconContainer = styled.div`
border-right: 1px solid ${MAIN_COLORS.yellow}; border-right: 1px solid ${MAIN_COLORS.yellow};
display: flex;
height: 16px; height: 16px;
position: absolute;
left: ${({ theme }) => theme.spacing(-5)};
`; `;
const StyledToggleContainer = styled.div` const StyledToggleContainer = styled.div`
@@ -50,7 +52,7 @@ export const AdvancedSettingsToggle = () => {
<StyledIconTool size={12} color={MAIN_COLORS.yellow} /> <StyledIconTool size={12} color={MAIN_COLORS.yellow} />
</StyledIconContainer> </StyledIconContainer>
<StyledToggleContainer> <StyledToggleContainer>
<StyledText>Advanced</StyledText> <StyledText>Advanced:</StyledText>
<Toggle <Toggle
onChange={onChange} onChange={onChange}
color={MAIN_COLORS.yellow} color={MAIN_COLORS.yellow}

View File

@@ -53,8 +53,8 @@ const StyledItemsContainer = styled.div<{ isSubMenu?: boolean }>`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-bottom: auto; margin-bottom: auto;
overflow-y: auto; gap: ${({ theme }) => theme.spacing(3)};
${({ isSubMenu, theme }) => !isSubMenu && `gap: ${theme.spacing(3)}`} ${({ isSubMenu }) => (!isSubMenu ? 'overflow-y: auto' : '')};
`; `;
export const NavigationDrawer = ({ export const NavigationDrawer = ({

View File

@@ -35,7 +35,6 @@ const StyledContainer = styled.div`
flex-direction: row; flex-direction: row;
height: ${({ theme }) => theme.spacing(8)}; height: ${({ theme }) => theme.spacing(8)};
justify-content: space-between; justify-content: space-between;
margin-left: ${({ theme }) => theme.spacing(5)};
`; `;
export const NavigationDrawerBackButton = ({ export const NavigationDrawerBackButton = ({

View File

@@ -4,7 +4,6 @@ const StyledSection = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: ${({ theme }) => theme.betweenSiblingsGap}; gap: ${({ theme }) => theme.betweenSiblingsGap};
width: 100%;
`; `;
export { StyledSection as NavigationDrawerSection }; export { StyledSection as NavigationDrawerSection };