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

BUG-9246 — Fix mobile menu #9250

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from "react"
import { location, globalHistory } from "@reach/router"

// Import PDS Global wrapper for applying global context providers.
import { GlobalWrapper } from "@pantheon-systems/pds-toolkit-react"
import { MOBILE_MENU_BREAKPOINT } from './src/vars/responsive'

// Import PDS core styles.
import "./node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-core.css"
import "./node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-layouts.css"
Expand Down Expand Up @@ -42,3 +46,8 @@ export const onRouteUpdate = () => {
export const onInitialClientRender = () => {
window.dispatchEvent(new Event("resize"))
}

// Global context providers
export const wrapRootElement = ({ element }) => {
return <GlobalWrapper mobileMenuMaxWidth={MOBILE_MENU_BREAKPOINT}>{element}</GlobalWrapper>
}
9 changes: 9 additions & 0 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import React from 'react'

// Import PDS Global wrapper for applying global context providers.
import { GlobalWrapper } from "@pantheon-systems/pds-toolkit-react"
import { MOBILE_MENU_BREAKPOINT } from './src/vars/responsive'

/*
* Add global scripts to ensure Bootstrap and jQuery JS is included
*/
Expand All @@ -15,3 +19,8 @@ export const onRenderBody = ({ setPostBodyComponents }) => {
}
])
}

// Global context providers
export const wrapRootElement = ({ element }) => {
return <GlobalWrapper mobileMenuMaxWidth={MOBILE_MENU_BREAKPOINT}>{element}</GlobalWrapper>
}
46 changes: 32 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/layout/SearchBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react"
import { Link } from "gatsby"

import AddSearch from "../../components/addSearch"
import { InputText } from "@pantheon-systems/pds-toolkit-react"
import { TextInput } from "@pantheon-systems/pds-toolkit-react"

import "./style.css"

Expand All @@ -16,13 +16,13 @@ const SearchBar = ({ page }) => (
title="Search Pantheon Documentation"
className="pds-spacing-pad-block-start-l pds-spacing-pad-block-end-2xl"
>
<InputText
<TextInput
id="search"
aria-label="Search Pantheon Documentation"
placeholder="Search Pantheon Documentation"
type="search"
data-addsearch-id="search_widget"
label=" "
label="Search Pantheon Documentation"
showLabel={false}
/>
{page == "default" ? <AddSearch /> : null}
</form>
Expand Down
7 changes: 4 additions & 3 deletions src/layout/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
NavMenu,
} from "@pantheon-systems/pds-toolkit-react"

import { MOBILE_MENU_BREAKPOINT } from '../../vars/responsive'

import "./style.css"

// Links for NavMenu component.
Expand Down Expand Up @@ -118,20 +120,19 @@ const mainNavigationLinks = [
},
]

const mobileMenuBreakpoint = 900

const Header = ({ page }) => (
<>
<a id="skip-to-main" className="pds-skiplink" href="#docs-main">
Skip to main content
</a>

<Navbar mobileMenuMaxWidth={mobileMenuBreakpoint}>
<Navbar>
<NavMenu
slot="items-left"
ariaLabel="Main Navigation"
menuItems={mainNavigationLinks}
mobileMenuMaxWidth={mobileMenuBreakpoint}
mobileMenuMaxWidth={MOBILE_MENU_BREAKPOINT}
/>
<div slot="items-right" className="pds-button-group">
<a
Expand Down
1 change: 1 addition & 0 deletions src/vars/responsive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const MOBILE_MENU_BREAKPOINT = 900
Loading