-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Hide nav and add hamburger to collapse side nav #2386
Changes from all commits
4b1084f
79d4323
04d144f
05d0f51
bb6e64f
9aa917e
441b241
0f7dfb4
522f943
a585150
6a0e476
7261c51
495acc4
981c75c
c7c80c4
374569f
05c1cfa
c6967bd
f4f7154
ee51867
5478750
04a366a
1a70642
a3e3a2d
7c30129
5f55171
8de864c
35a66da
46c003d
451e98b
0473d6f
54b339b
7c97aa2
4f2d6c3
8d65d07
cbd9b25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.drawer { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
height: 100%; | ||
width: 100%; | ||
background: var(--color-surface--background); | ||
z-index: var(--elevation-modal); | ||
display: flex; | ||
flex-direction: column; | ||
animation: slideIn 200ms ease-out; | ||
} | ||
|
||
@media screen and (min-width: 768px) { | ||
.drawer { | ||
display: none; | ||
} | ||
} | ||
|
||
.drawerClosing { | ||
animation: slideOut 200ms ease-out; | ||
} | ||
|
||
.header { | ||
padding: var(--space-base); | ||
} | ||
|
||
.content { | ||
flex: 1; | ||
overflow-y: hidden; | ||
} | ||
|
||
@keyframes slideIn { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking we should also do a slide out animation so it feels a bit less abrupt on the way out There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that looks & feels much better! |
||
from { | ||
transform: translateX(-100%); | ||
} | ||
to { | ||
transform: translateX(0); | ||
} | ||
} | ||
|
||
@keyframes slideOut { | ||
from { | ||
transform: translateX(0); | ||
} | ||
to { | ||
transform: translateX(-100%); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Box, Button } from "@jobber/components"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LeftDrawer is a simpler version of our SideDrawer, until we can get SideDrawer to slide out from different directions |
||
import { PropsWithChildren, useState } from "react"; | ||
import styles from "./LeftDrawer.module.css"; | ||
|
||
interface LeftDrawerProps extends PropsWithChildren { | ||
readonly onClose: () => void; | ||
readonly header?: React.ReactNode; | ||
} | ||
|
||
export function LeftDrawer({ children, onClose, header }: LeftDrawerProps) { | ||
const [isClosing, setIsClosing] = useState(false); | ||
|
||
const handleClose = () => { | ||
setIsClosing(true); | ||
setTimeout(() => { | ||
onClose(); | ||
}, 200); | ||
}; | ||
|
||
return ( | ||
<div | ||
className={`${styles.drawer} ${isClosing ? styles.drawerClosing : ""}`} | ||
> | ||
<Box padding="base" direction="row" alignItems="center" gap="small"> | ||
<Button | ||
icon="cross" | ||
ariaLabel="Close" | ||
type="tertiary" | ||
variation="subtle" | ||
onClick={handleClose} | ||
/> | ||
{header} | ||
</Box> | ||
<div className={styles.content}>{children}</div> | ||
</div> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,14 @@ | |
--navItemHeight: 40px; | ||
display: flex; | ||
flex-direction: column; | ||
padding: 35px 0 0 0; | ||
height: 100dvh; | ||
height: 100%; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. height of NavMenu in mobile viewport should not be 100dvh since it lives inside the LeftDrawer with header on top |
||
min-width: var(--sideBarWidth); | ||
box-sizing: border-box; | ||
|
||
@media screen and (min-width: 768px) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
padding: 35px 0 0 0; | ||
height: 100dvh; | ||
} | ||
} | ||
|
||
.navMenuContainer>* { | ||
|
@@ -130,4 +134,20 @@ a.navFooterLink { | |
margin-top: auto; | ||
font-size: var(--typography--fontSize-small); | ||
color: var(--color-text--secondary); | ||
} | ||
|
||
.desktopNavContainer { | ||
display: none; | ||
|
||
@media screen and (min-width: 768px) { | ||
display: block; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to explicitly be setting then we could reduce our style rules to only be applying the thing we want to change, when we want to apply them There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did this to follow the design guideline to style mobile first, also for when the |
||
} | ||
} | ||
|
||
.navMenuHeaderLogo { | ||
display: none; | ||
|
||
@media screen and (min-width: 768px) { | ||
display: block; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,47 @@ | ||
.searchButton { | ||
display: flex; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file is mostly just spacing diff |
||
align-items: center; | ||
border: var(--border-base) solid var(--color-border--interactive); | ||
border-radius: var(--radius-base); | ||
padding: var(--space-small); | ||
background: var(--color-surface); | ||
outline: transparent; | ||
cursor: pointer; | ||
transition: all var(--timing-base) ease-out; | ||
display: flex; | ||
align-items: center; | ||
border: var(--border-base) solid var(--color-border--interactive); | ||
border-radius: var(--radius-base); | ||
padding: var(--space-small); | ||
background: var(--color-surface); | ||
outline: transparent; | ||
cursor: pointer; | ||
transition: all var(--timing-base) ease-out; | ||
|
||
&:focus-visible { | ||
box-shadow: var(--shadow-focus); | ||
background-color: var(--color-surface--background--hover); | ||
} | ||
&:focus-visible { | ||
box-shadow: var(--shadow-focus); | ||
background-color: var(--color-surface--background--hover); | ||
} | ||
} | ||
|
||
.searchButton:hover { | ||
background: var(--color-surface--background--hover); | ||
border: var(--border-base) solid var(--color-interactive--subtle--hover); | ||
background: var(--color-surface--background--hover); | ||
border: var(--border-base) solid var(--color-interactive--subtle--hover); | ||
} | ||
|
||
.searchButtonText { | ||
margin: 0 var(--space-small); | ||
flex: 1; | ||
text-align: start; | ||
margin: 0 var(--space-small); | ||
display: none; | ||
flex: 1; | ||
text-align: start; | ||
@media screen and (min-width: 768px) { | ||
display: block; | ||
} | ||
} | ||
|
||
.searchKeyIndicator { | ||
background: var(--color-surface--background); | ||
width: 20px; | ||
height: 20px; | ||
font-size: var(--typography--fontSize-large); | ||
color: var(--color-text); | ||
background: var(--color-surface--background); | ||
width: 20px; | ||
height: 20px; | ||
font-size: var(--typography--fontSize-large); | ||
color: var(--color-text); | ||
display: none; | ||
align-items: center; | ||
justify-content: center; | ||
border-radius: var(--radius-small); | ||
box-shadow: var(--shadow-low); | ||
@media screen and (min-width: 768px) { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-radius: var(--radius-small); | ||
box-shadow: var(--shadow-low); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these onClick handlers on Link are responsible for closing mobile menu when a route is clicked on