Skip to content

Commit f8e6eb1

Browse files
committed
Move navbar overlap conpensation to also lift the app menu when it's closed
1 parent 795b0d0 commit f8e6eb1

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

browser/data-browser/src/components/SideBar/About.tsx

+2-11
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import { styled } from 'styled-components';
22
import React from 'react';
33
import { FaGithub, FaDiscord, FaBook } from 'react-icons/fa';
44
import { IconButtonLink, IconButtonVariant } from '../IconButton/IconButton';
5-
import { useMediaQuery } from '../../hooks/useMediaQuery';
6-
import { useSettings } from '../../helpers/AppSettings';
7-
import { transition } from '../../helpers/transition';
85

96
interface AboutItem {
107
icon: React.ReactNode;
@@ -31,16 +28,12 @@ const aboutMenuItems: AboutItem[] = [
3128
];
3229

3330
export function About() {
34-
const narrow = useMediaQuery('(max-width: 920px)');
35-
const { navbarFloating } = useSettings();
36-
const elivate = narrow && navbarFloating;
37-
3831
return (
3932
<>
4033
{/* <SideBarHeader>
4134
<Logo style={{ height: '1.1rem', maxWidth: '100%' }} />
4235
</SideBarHeader> */}
43-
<AboutWrapper $elivate={elivate}>
36+
<AboutWrapper>
4437
{aboutMenuItems.map(({ href, icon, helper }) => (
4538
<IconButtonLink
4639
target='_blank'
@@ -60,12 +53,10 @@ export function About() {
6053
);
6154
}
6255

63-
const AboutWrapper = styled.div<{ $elivate: boolean }>`
56+
const AboutWrapper = styled.div`
6457
--inner-padding: 0.5rem;
6558
display: flex;
6659
align-items: center;
6760
gap: 0.5rem;
6861
margin-left: calc(1rem - var(--inner-padding));
69-
padding-bottom: ${p => (p.$elivate ? '3.5rem' : '0rem')};
70-
${transition('padding-bottom')}
7162
`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
import { useMediaQuery } from '../../hooks/useMediaQuery';
3+
import { useSettings } from '../../helpers/AppSettings';
4+
import { styled } from 'styled-components';
5+
import { transition } from '../../helpers/transition';
6+
7+
export function OverlapSpacer(): JSX.Element {
8+
const narrow = useMediaQuery('(max-width: 950px)');
9+
const { navbarFloating } = useSettings();
10+
const elivate = narrow && navbarFloating;
11+
12+
return <Elivator $elivate={elivate} />;
13+
}
14+
15+
const Elivator = styled.div<{ $elivate: boolean }>`
16+
height: ${p => (p.$elivate ? '3.5rem' : '0rem')};
17+
${transition('height')}
18+
`;

browser/data-browser/src/components/SideBar/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { SideBarDrive } from './SideBarDrive';
66
import { DragAreaBase, useResizable } from '../../hooks/useResizable';
77
import { useCombineRefs } from '../../hooks/useCombineRefs';
88
import { NavBarSpacer } from '../NavBarSpacer';
9+
import { OverlapSpacer } from './OverlapSpacer';
910
import { AppMenu } from './AppMenu';
1011
import { About } from './About';
1112
import { useMediaQuery } from '../../hooks/useMediaQuery';
@@ -80,6 +81,7 @@ export function SideBar(): JSX.Element {
8081
</SideBarPanel>
8182
</Column>
8283
</MenuWrapper>
84+
<OverlapSpacer />
8385
<NavBarSpacer baseMargin='1rem' position='bottom' />
8486
<SideBarDragArea ref={dragAreaRef} isDragging={isDragging} />
8587
</SideBarStyled>

0 commit comments

Comments
 (0)