mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-18 00:19:49 +01:00
feat: make hide nav info always visible (#7981)
This commit is contained in:
parent
1947c7bc81
commit
07f9935433
@ -52,6 +52,16 @@ export const StretchContainer = styled(Box)(({ theme }) => ({
|
|||||||
overflowAnchor: 'none',
|
overflowAnchor: 'none',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// This component is needed when the sticky item could overlap with nav items. You can replicate it on a short screen.
|
||||||
|
const StickyContainer = styled(Box)(({ theme }) => ({
|
||||||
|
position: 'sticky',
|
||||||
|
paddingBottom: theme.spacing(1.5),
|
||||||
|
paddingTop: theme.spacing(1),
|
||||||
|
bottom: theme.spacing(0),
|
||||||
|
backgroundColor: theme.palette.background.paper,
|
||||||
|
borderTop: `1px solid ${theme.palette.divider}`,
|
||||||
|
}));
|
||||||
|
|
||||||
export const NavigationSidebar = () => {
|
export const NavigationSidebar = () => {
|
||||||
const { routes } = useRoutes();
|
const { routes } = useRoutes();
|
||||||
|
|
||||||
@ -73,7 +83,6 @@ export const NavigationSidebar = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<StretchContainer>
|
<StretchContainer>
|
||||||
<NewInUnleash mode={mode} onMiniModeClick={() => setMode('full')} />
|
|
||||||
<PrimaryNavigationList
|
<PrimaryNavigationList
|
||||||
mode={mode}
|
mode={mode}
|
||||||
onClick={setActiveItem}
|
onClick={setActiveItem}
|
||||||
@ -137,12 +146,21 @@ export const NavigationSidebar = () => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* this will push the show/hide to the bottom on short nav list */}
|
||||||
|
<Box sx={{ flex: 1 }} />
|
||||||
|
|
||||||
|
<StickyContainer>
|
||||||
|
<NewInUnleash
|
||||||
|
mode={mode}
|
||||||
|
onMiniModeClick={() => setMode('full')}
|
||||||
|
/>
|
||||||
<ShowHide
|
<ShowHide
|
||||||
mode={mode}
|
mode={mode}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
setMode(mode === 'full' ? 'mini' : 'full');
|
setMode(mode === 'full' ? 'mini' : 'full');
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
</StickyContainer>
|
||||||
</StretchContainer>
|
</StretchContainer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -18,6 +18,7 @@ import { NewInUnleashItem } from './NewInUnleashItem';
|
|||||||
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
|
|
||||||
const StyledNewInUnleash = styled('div')(({ theme }) => ({
|
const StyledNewInUnleash = styled('div')(({ theme }) => ({
|
||||||
|
margin: theme.spacing(2, 0, 1, 0),
|
||||||
borderRadius: theme.shape.borderRadiusMedium,
|
borderRadius: theme.shape.borderRadiusMedium,
|
||||||
[theme.breakpoints.down('lg')]: {
|
[theme.breakpoints.down('lg')]: {
|
||||||
margin: theme.spacing(2),
|
margin: theme.spacing(2),
|
||||||
@ -25,6 +26,10 @@ const StyledNewInUnleash = styled('div')(({ theme }) => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const StyledListItem = styled(ListItem)(({ theme }) => ({
|
||||||
|
margin: theme.spacing(1, 0, 1, 0),
|
||||||
|
}));
|
||||||
|
|
||||||
const StyledNewInUnleashHeader = styled('p')(({ theme }) => ({
|
const StyledNewInUnleashHeader = styled('p')(({ theme }) => ({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -106,7 +111,7 @@ export const NewInUnleash = ({
|
|||||||
|
|
||||||
if (mode === 'mini' && onMiniModeClick) {
|
if (mode === 'mini' && onMiniModeClick) {
|
||||||
return (
|
return (
|
||||||
<ListItem disablePadding onClick={onMiniModeClick}>
|
<StyledListItem disablePadding onClick={onMiniModeClick}>
|
||||||
<StyledMiniItemButton dense>
|
<StyledMiniItemButton dense>
|
||||||
<Tooltip title='New in Unleash' placement='right'>
|
<Tooltip title='New in Unleash' placement='right'>
|
||||||
<StyledMiniItemIcon>
|
<StyledMiniItemIcon>
|
||||||
@ -119,7 +124,7 @@ export const NewInUnleash = ({
|
|||||||
</StyledMiniItemIcon>
|
</StyledMiniItemIcon>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</StyledMiniItemButton>
|
</StyledMiniItemButton>
|
||||||
</ListItem>
|
</StyledListItem>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,16 +13,6 @@ const ShowHideRow = styled(Box, {
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
padding: theme.spacing(0, 1, 0, mode === 'mini' ? 1.5 : 2),
|
padding: theme.spacing(0, 1, 0, mode === 'mini' ? 1.5 : 2),
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
position: 'sticky',
|
|
||||||
bottom: theme.spacing(2),
|
|
||||||
width: '100%',
|
|
||||||
}));
|
|
||||||
|
|
||||||
// This component is needed when the sticky item could overlap with nav items. You can replicate it on a short screen.
|
|
||||||
const ShowHideContainer = styled(Box)(({ theme }) => ({
|
|
||||||
flexGrow: 1,
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'end',
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const ShowHide: FC<{ mode: NavigationMode; onChange: () => void }> = ({
|
export const ShowHide: FC<{ mode: NavigationMode; onChange: () => void }> = ({
|
||||||
@ -30,7 +20,6 @@ export const ShowHide: FC<{ mode: NavigationMode; onChange: () => void }> = ({
|
|||||||
onChange,
|
onChange,
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<ShowHideContainer>
|
|
||||||
<ShowHideRow onClick={onChange} mode={mode}>
|
<ShowHideRow onClick={onChange} mode={mode}>
|
||||||
{mode === 'full' && (
|
{mode === 'full' && (
|
||||||
<Box
|
<Box
|
||||||
@ -55,7 +44,6 @@ export const ShowHide: FC<{ mode: NavigationMode; onChange: () => void }> = ({
|
|||||||
)}
|
)}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</ShowHideRow>
|
</ShowHideRow>
|
||||||
</ShowHideContainer>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user