Skip to content
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

feat: 1629 collapse navigation #1796

Merged
merged 10 commits into from
Jan 14, 2025
1 change: 1 addition & 0 deletions frontend/src/components/BCHeader/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const componentTexts = {
headerTitle: 'SPAR',
completeTitle: ' Seed Planning and Registry System',
openMenu: 'Open menu',
closeMenu: 'Close menu',
sideMenuAriaLabel: 'Side menu',
searchAriaLabel: 'Search',
notifications: {
Expand Down
15 changes: 9 additions & 6 deletions frontend/src/components/BCHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,24 @@ const BCHeader = () => {

return (
<HeaderContainer
isSideNavExpanded
render={({ isSideNavExpanded, onClickSideNavExpand }: HearderContainerProps) => (
<Header
aria-label={componentTexts.completeTitle}
className="spar-header"
className={`spar-header ${!isSideNavExpanded ? 'spar-header-expanded' : ''}`}
mgaseta marked this conversation as resolved.
Show resolved Hide resolved
data-testid="header"
onClick={isSideNavExpanded ? onClickSideNavExpand : null}
>
<SkipToContent />
{
!(location.pathname.endsWith('/403') || location.pathname.endsWith('/404'))
? (
<HeaderMenuButton
aria-label={componentTexts.openMenu}
aria-label={
isSideNavExpanded
? componentTexts.closeMenu
: componentTexts.openMenu
}
isCollapsible
onClick={onClickSideNavExpand}
isActive={isSideNavExpanded}
/>
Expand Down Expand Up @@ -179,9 +184,7 @@ const BCHeader = () => {
isChildOfHeader
expanded={isSideNavExpanded}
aria-label={componentTexts.sideMenuAriaLabel}
inert={undefined}
className="spar-side-nav"
onClick={isSideNavExpanded ? onClickSideNavExpand : null}
className={`spar-side-nav ${!isSideNavExpanded ? 'spar-side-nav-expanded' : ''}`}
mgaseta marked this conversation as resolved.
Show resolved Hide resolved
>
<div className="side-nav-top">
{
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/BCHeader/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
justify-content: space-between;
overflow-y: auto;

&.spar-side-nav-expanded {
inline-size: 0;
}

.side-nav-top {
padding-top: 1rem;
}
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/layout/PrivateLayout/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.main-container {
padding-top: 5.625rem;
padding-left: 16rem;
transition: padding-left 0.11s cubic-bezier(0.2, 0, 1, 0.9), transform 0.11s cubic-bezier(0.2, 0, 1, 0.9);

.dependency-notification {
max-width: none;
Expand All @@ -11,6 +11,11 @@
}
}

header.spar-header:not(.spar-header-expanded) + div.main-container {
padding-left: 16rem;
transition: padding-left 0.11s cubic-bezier(0.2, 0, 1, 0.9), transform 0.11s cubic-bezier(0.2, 0, 1, 0.9);
}

.page-content .#{vars.$bcgov-prefix}--grid {
max-width: none;
}
Expand All @@ -26,7 +31,8 @@
}

@media only screen and (max-width: 1055px) {
.main-container {
.main-container,
header.spar-header:not(.spar-header-expanded) + div.main-container {
padding-top: 5rem;
padding-left: 0;
}
Expand Down
Loading