Skip to content

Commit

Permalink
Merge branch 'main' into zs.ref-for-redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
zchsh authored Sep 12, 2024
2 parents bbc9c8a + 18b7c28 commit ee8a96e
Show file tree
Hide file tree
Showing 15 changed files with 658 additions and 174 deletions.
418 changes: 388 additions & 30 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion 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.10",
"@hashicorp/react-consent-manager": "^9.3.0",
"@hashicorp/react-content": "^8.3.0",
"@hashicorp/react-design-system-components": "0.0.0-nightly.05f1ad1",
Expand Down Expand Up @@ -211,7 +212,10 @@
"overrides": {
"next": "$next",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"@hashicorp/react-components": {
"next": "^14.2.1"
}
},
"nextBundleAnalysis": {
"budget": null,
Expand Down
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 { mobileNavigationData, 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={mobileNavigationData}
promo={navPromo}
sidePanel={sidePanelContent}
/>
</NavigationMenu.Root>
</MobileMenuContainer>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
*/

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

.mobileMenuAuthContainer {
padding: 16px 16px 0 16px;
margin-bottom: 0;
}

.mobileMenuNavList {
list-style: none;
margin: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@
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;
left: -216px;
}

.dropdownContainerInner {
padding: 16px;
}

.itemGroupDivider {
Expand Down
Loading

0 comments on commit ee8a96e

Please sign in to comment.