Skip to content

Commit 1a0e07c

Browse files
committed
chore: misc ui and mobile fixes
1 parent 30b5560 commit 1a0e07c

File tree

4 files changed

+47
-23
lines changed

4 files changed

+47
-23
lines changed

site/components/base/Header.jsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import React, { useContext } from 'react';
1+
import React from 'react';
22
import clsx from 'clsx';
33
import { IoLogoGithub } from 'react-icons/io5';
4-
import { BreakpointContext } from '@utils/BreakpointContext';
54
import Logo from '@components/Logo';
65
import Link from '@components/Link';
76
import VersionSelect from '@components/VersionSelect';
87
import styles from './Header.module.css';
98

109
const Header = () => {
11-
const breakpoint = useContext(BreakpointContext);
12-
1310
return (
14-
<nav id="navigation" className={clsx(styles.mainNav, (breakpoint.isMobile || breakpoint.isTablet) ? 'mobile-nav' : null)}>
15-
<div className={clsx('container-wrapper', styles.navInner)}>
16-
<Logo withText linked className={styles.navBrand} aria-label="Lambda Log Home" />
17-
18-
<VersionSelect className="ml-auto mr-5 hidden lg:block" />
11+
<header className={styles.header}>
12+
<div className={clsx('container-wrapper', styles.inner)}>
13+
<div className={styles.headerBrand}>
14+
<Logo withText linked className={styles.brand} aria-label="Lambda Log Home" />
15+
</div>
16+
<div className={styles.headerRight}>
17+
<VersionSelect className="ml-auto mr-5 hidden lg:block" />
1918

20-
<Link plain href="https://github.com/KyleRoss/node-lambda-log" className={styles.github} aria-label="View on Github">
21-
<IoLogoGithub />
22-
</Link>
19+
<Link plain href="https://github.com/KyleRoss/node-lambda-log" className={styles.github} aria-label="View on Github">
20+
<IoLogoGithub />
21+
</Link>
22+
</div>
2323
</div>
24-
</nav>
24+
</header>
2525
);
2626
};
2727

site/components/base/Header.module.css

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
.mainNav {
2-
@apply sticky top-0 left-0 right-0 py-3 h-[70px] z-100 bg-warm-50;
1+
.header {
2+
@apply sticky top-0 left-0 right-0 z-100 bg-warm-50;
33
}
44

5-
.navInner {
6-
@apply flex justify-between items-center h-[46px];
5+
.header,
6+
.inner,
7+
.headerBrand,
8+
.headerRight {
9+
@apply h-[70px];
710
}
811

9-
.navBrand {
12+
.inner {
13+
@apply flex;
14+
}
15+
16+
.headerBrand {
17+
@apply flex items-center py-3 w-60 border-b-1 border-warm-300 lg:border-b-0;
18+
}
19+
20+
.brand {
1021
@apply flex items-center;
1122

1223
& svg {
@@ -22,6 +33,10 @@
2233
}
2334
}
2435

36+
.headerRight {
37+
@apply flex items-center justify-end py-3 flex-grow border-b-1 border-warm-300;
38+
}
39+
2540
a.github {
2641
@apply text-warm-500 transition-all;
2742

site/pages/docs/[version]/[[...slug]].jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ const DocsPage = ({ meta, nav, source, slug }) => {
101101
</button>
102102
<aside className={clsx('docs-sidebar', menuOpen ? 'mobile-open' : null)}>
103103
<div className="hidden lg:block h-12 pointer-events-none absolute top-0 left-0 right-0 z-10 bg-gradient-to-b from-warm-50" />
104-
<ul role="menu">
104+
<div className="docs-nav-overlay" role="presentation" onClick={() => setMenuOpen(!menuOpen)} onKeyUp={event => event.key === 'Escape' && setMenuOpen(false)} />
105+
<ul className="docs-nav" role="menu">
105106
{menuOpen && (
106107
<li role="menuitem" className="!mb-8">
107108
<VersionSelect className="block lg:hidden" />

site/styles/partials/docs.css

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
@apply hidden lg:block fixed top-[70px] w-52;
2727
height: calc(100% - 70px);
2828

29-
& > ul {
29+
& ul.docs-nav {
3030
@apply overflow-y-auto w-52 h-full py-10 pr-4;
3131
}
3232

@@ -38,7 +38,7 @@
3838
}
3939
}
4040

41-
& > ul > li > ul {
41+
& ul.docs-nav > li > ul {
4242
@apply ml-5 my-3;
4343

4444
& > li {
@@ -74,10 +74,18 @@
7474
}
7575
}
7676

77+
& .docs-nav-overlay {
78+
@apply hidden;
79+
}
80+
7781
&.mobile-open {
78-
@apply block w-screen left-0 right-0 bg-warm-800 bg-opacity-30 backdrop-blur-sm z-100;
82+
@apply block w-screen top-0 left-0 h-screen z-100;
83+
84+
& .docs-nav-overlay {
85+
@apply block fixed inset-0 bg-warm-800 bg-opacity-30 backdrop-blur-sm -z-1;
86+
}
7987

80-
& > ul {
88+
& ul.docs-nav {
8189
@apply bg-white pl-8 shadow-2xl max-w-[290px];
8290
width: 80vw;
8391
}

0 commit comments

Comments
 (0)