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

refactor: Use shared dropdown panel in nav #2553

Merged
merged 41 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5916779
chore: Install react-components
EnMod Aug 20, 2024
57f1e2f
refactor: Get the shared dropdown in the nav
EnMod Aug 20, 2024
effed84
refactor: Fit the panel inside the dropdown
EnMod Aug 21, 2024
86cd7e0
chore: Spacing formatting for package-lock.json
EnMod Aug 21, 2024
aa02d72
chore: CSS fixes
EnMod Aug 21, 2024
9411dab
chore: Update canary
EnMod Aug 26, 2024
289df08
chore: CSS tweaks
EnMod Aug 26, 2024
240f610
chore: Pass in the data
EnMod Aug 26, 2024
ddaaeb7
chore: Update canary
EnMod Aug 26, 2024
9a0d4f4
chore: Add to desktop
EnMod Aug 26, 2024
4542ed8
feat: Add side panel content via updated canary
EnMod Aug 27, 2024
ee7552c
chore: Update to latest stable
EnMod Aug 28, 2024
0203c1c
upgrade package and breakpoints
LeahMarieBush Sep 3, 2024
819e0b0
Merge branch 'main' into feat/use-shared-dropdown-panel
LeahMarieBush Sep 3, 2024
bf98770
remove home page tutorials link
LeahMarieBush Sep 3, 2024
075e3bf
add web-mktg-logos dependency
LeahMarieBush Sep 3, 2024
d419bbe
chore: Update padding to only target the auth menu on generic pages
EnMod Sep 3, 2024
10b4d82
chore: Address feedback link padding
EnMod Sep 3, 2024
e17e818
update breakpoints
LeahMarieBush Sep 4, 2024
443d2ac
refactor: Update canary/reorder items
EnMod Sep 4, 2024
4076305
chore: Use latest stable panel
EnMod Sep 4, 2024
60b7ea9
Merge branch 'main' into feat/use-shared-dropdown-panel
EnMod Sep 4, 2024
3bd0896
chore: Revert override change
EnMod Sep 4, 2024
9ceef62
feat: Support className in MobileAuthenticationControls
EnMod Sep 4, 2024
8300524
chore: Tweak bottom margin of auth controls
EnMod Sep 4, 2024
05a1eb4
update MobileAuthControls type
LeahMarieBush Sep 5, 2024
a33971b
package upgrade and small padding change
LeahMarieBush Sep 5, 2024
e184e07
chore: Use latest @hashicorp/react-components
EnMod Sep 5, 2024
ea7f9c0
update react-components package and adjust product data
LeahMarieBush Sep 5, 2024
24c1285
chore: Update package to latest canary
EnMod Sep 6, 2024
ac022de
feat: Close dropdown with Esc
EnMod Sep 6, 2024
0a2b19f
chore: Change navbarlist child root to NavigationMenu.List
EnMod Sep 6, 2024
2c12856
fix: onEscKeyDown behavior
EnMod Sep 6, 2024
e8809fb
chore: Revert mobile menu breakpoint changes/update canary
EnMod Sep 9, 2024
12d5640
chore: Update canary
EnMod Sep 9, 2024
470d876
chore: Update panel to latest stable
EnMod Sep 9, 2024
df7385e
Merge branch 'main' into feat/use-shared-dropdown-panel
EnMod Sep 9, 2024
ec41196
fix: absolute positioning with hardcoded `left`
EnMod Sep 9, 2024
a642d84
chore: Explicit padding on mobileMenuAuthContainer
EnMod Sep 10, 2024
a636177
chore: Remove web-mktg-logos dep
EnMod Sep 10, 2024
52dd33b
chore: fix package-lock and specific next version for @hashicorp/reac…
heatlikeheatwave Sep 10, 2024
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
12,711 changes: 4,327 additions & 8,384 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"@hashicorp/react-alert-banner": "^7.1.0",
"@hashicorp/react-button": "^6.3.1",
"@hashicorp/react-code-block": "^6.7.0",
"@hashicorp/react-components": "^1.1.5",
"@hashicorp/react-consent-manager": "^9.3.0",
"@hashicorp/react-content": "^8.3.0",
"@hashicorp/react-design-system-components": "0.0.0-nightly.05f1ad1",
Expand All @@ -126,6 +127,7 @@
"@hashicorp/react-tabs": "^8.2.0",
"@hashicorp/remark-plugins": "^4.1.1",
"@hashicorp/sentinel-embedded": "^0.0.14",
"@hashicorp/web-mktg-logos": "0.0.0-nightly.7a813d9",
"@mapbox/rehype-prism": "^0.8.0",
"@mdx-js/mdx": "^1.6.22",
"@mdx-js/react": "^1.6.22",
Expand Down
heatlikeheatwave marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
min-height: 52px;
padding: 16px;

/* Accounts for extra feedback link padding */
padding-left: 24px;

@media (--dev-dot-mobile) {
justify-content: flex-end;
}
Expand All @@ -173,3 +176,7 @@
display: flex;
gap: 4px;
}

.feedbackLink {
padding: 8px;
}
1 change: 1 addition & 0 deletions src/components/command-bar/components/dialog/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const CommandBarDialogFooter = () => {
</div>
<div>
<StandaloneLink
className={s.feedbackLink}
color="secondary"
href={FEEDBACK_FORM_URL}
icon={<IconExternalLink16 />}
Expand Down
12 changes: 8 additions & 4 deletions src/components/mobile-menu-container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

// Third-party imports
import { ForwardedRef, forwardRef } from 'react'
import { ForwardedRef, forwardRef, HTMLAttributes } from 'react'
import classNames from 'classnames'
import { m, useReducedMotion } from 'framer-motion'
import { useRouter } from 'next/router'
Expand All @@ -19,7 +19,7 @@ import ButtonLink from 'components/button-link'

// Local imports
import { ThemeSwitcherWithLabel } from 'components/theme-switcher'
import { MobileMenuContainerProps } from './types'
import type { MobileMenuContainerProps } from './types'
import { MobileUserDisclosure } from './components'
import s from './mobile-menu-container.module.css'

Expand All @@ -41,7 +41,10 @@ const MOBILE_MENU_MOTION = {
* Handles rendering the Sign In and Sign Up UI elements in mobile viewports.
* Intended to be used alongside `MobileMenuContainer`.
*/
const MobileAuthenticationControls = () => {

const MobileAuthenticationControls = ({
className,
}: HTMLAttributes<HTMLDivElement>) => {
const { asPath } = useRouter()
const { isAuthenticated, isLoading, signIn, signOut, user } =
useAuthentication()
Expand Down Expand Up @@ -87,7 +90,8 @@ const MobileAuthenticationControls = () => {
<div
className={classNames(
'g-show-with-mobile-menu',
s.mobileAuthenticationControlsWrap
s.mobileAuthenticationControlsWrap,
className
)}
>
{content}
Expand Down
24 changes: 13 additions & 11 deletions src/components/mobile-menu-levels-generic/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
* SPDX-License-Identifier: MPL-2.0
*/

// Library
import { generateTopLevelSubNavItems } from 'lib/generate-top-level-sub-nav-items'
// Components
import MobileMenuContainer, {
MobileAuthenticationControls,
} from 'components/mobile-menu-container'
import { SidebarNavMenuItem } from 'components/sidebar/components'
import ProductPanel from '@hashicorp/react-components/src/components/nav-panel/product-panel'
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
// Data
import { navigationData, navPromo, sidePanelContent } from 'lib/products'
// Styles
import s from './mobile-menu-levels-generic.module.css'

Expand All @@ -27,14 +28,15 @@ import s from './mobile-menu-levels-generic.module.css'
function MobileMenuLevelsGeneric() {
return (
<MobileMenuContainer className={s.mobileMenuContainer}>
<MobileAuthenticationControls />
<ul className={s.mobileMenuNavList}>
<SidebarNavMenuItem item={{ heading: 'Main Menu' }} />
{generateTopLevelSubNavItems().map((item: $TSFixMe, index: number) => (
// eslint-disable-next-line react/no-array-index-key
<SidebarNavMenuItem item={item} key={index} />
))}
</ul>
<MobileAuthenticationControls className={s.mobileMenuAuthContainer} />

<NavigationMenu.Root className={s.mobileMenuNavList}>
<ProductPanel
productCategories={navigationData}
promo={navPromo}
sidePanel={sidePanelContent}
/>
</NavigationMenu.Root>
</MobileMenuContainer>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
*/

.mobileMenuContainer {
padding: 24px;
z-index: 4;
}

.mobileMenuAuthContainer {
padding: 16px;
padding-bottom: 0;
EnMod marked this conversation as resolved.
Show resolved Hide resolved
margin-bottom: 0;
}

.mobileMenuNavList {
list-style: none;
margin: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
box-shadow: var(--token-elevation-higher-box-shadow);
min-width: 252px;
padding: 16px;
min-width: max-content;
position: absolute;
}

.dropdownContainerInner {
padding: 16px;
}

.itemGroupDivider {
margin-bottom: 20px;
margin-top: 20px;
Expand Down
Loading
Loading