diff --git a/pages/index.tsx b/pages/index.tsx index 0d29e5f3..5b826154 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -203,7 +203,7 @@ export default function Index({ as={Link} href="/contact-sales" > - Book a demo today + Book a demo } diff --git a/pages/pricing.tsx b/pages/pricing.tsx index 99bec384..21ccdc7c 100644 --- a/pages/pricing.tsx +++ b/pages/pricing.tsx @@ -191,7 +191,7 @@ export default function Pricing({ href="/contact-sales" className="mt-xlarge w-fit" > - Book a demo today + Book a demo diff --git a/pages/products/[product].tsx b/pages/products/[product].tsx index ace96d71..7c28b296 100644 --- a/pages/products/[product].tsx +++ b/pages/products/[product].tsx @@ -34,7 +34,7 @@ export default function Product({ href="/contact-sales" className=" w-fit" > - Book a demo today + Book a demo } /> diff --git a/src/components/NavigationDesktop.tsx b/src/components/NavigationDesktop.tsx index c8e261ef..502e3691 100644 --- a/src/components/NavigationDesktop.tsx +++ b/src/components/NavigationDesktop.tsx @@ -4,8 +4,6 @@ import { ColorModeProvider } from '@pluralsh/design-system' import { type NavData, useNavData } from '@src/contexts/NavDataContext' -import { ProductTopNavMenu } from './menu/ProductNav' -import { SolutionTopNavMenu } from './menu/SolutionNav' import { TopNavMenu } from './menu/TopNavMenu' import { MainLink } from './Navigation' @@ -37,34 +35,28 @@ export function NavigationDesktop({ logoRef }) { return (
- {flatNav?.map((navItem, i) => { + {flatNav?.map((navItem) => { if (navItem?.mobile_only) { return null } if (navItem?.subnav) { - if (!i) { - return ( - - ) - } - if (i === 1) { - return ( - - ) - } + const kind = + navItem.link?.title === 'Product' + ? 'product' + : navItem.link?.title === 'Solutions' + ? 'solution' + : 'default' return ( ) } diff --git a/src/components/PageHeader.tsx b/src/components/PageHeader.tsx index 087de372..1e9f5c53 100644 --- a/src/components/PageHeader.tsx +++ b/src/components/PageHeader.tsx @@ -111,7 +111,7 @@ export function PageHeader({ primary fontFamily={theme.fontFamilies.sans} > - Book a demo today + Book a demo
{/* */} diff --git a/src/components/menu/Menu.tsx b/src/components/menu/Menu.tsx index 9fd48ac5..8d68ce74 100644 --- a/src/components/menu/Menu.tsx +++ b/src/components/menu/Menu.tsx @@ -28,7 +28,6 @@ import { import styled from 'styled-components' import { MainLinkBase } from '../Navigation' -import { ResponsiveText } from '../Typography' import { PopoverMenu } from './PopoverMenu' @@ -37,11 +36,12 @@ type Placement = 'left' | 'right' export type ItemRendererProps = { item: Node state: TreeState + kind?: MenuButtonProps['kind'] } type ItemRenderer = (p: ItemRendererProps) => JSX.Element -interface MenuButtonProps +export interface MenuButtonProps extends AriaMenuProps, MenuTriggerProps { itemRenderer?: ItemRenderer @@ -51,6 +51,8 @@ interface MenuButtonProps maxHeight?: number | string className?: string dropdownProps?: Parameters[0] + kind?: 'product' | 'default' | 'solution' + left?: number } function MainLinkTriggerUnstyled({ @@ -107,10 +109,7 @@ export function MenuButton({ kind = 'default', left, ...props -}: MenuButtonProps & { - kind?: 'product' | 'default' | 'solution' - left?: number -}) { +}: MenuButtonProps) { // Create state based on the incoming props const triggerState = useMenuTriggerState(props) @@ -198,10 +197,14 @@ function MenuDropdown({ >
+ {kind === 'product' && ( + Platform features + )}
    {[...state.collection].map((item) => ( @@ -254,18 +257,12 @@ function SolutionNavDropdown({
    {Object.keys(itemByCategory).map((category) => (
    - - {category} - + {category}
      {itemByCategory[category].map((item) => ( @@ -316,3 +313,10 @@ export function MenuItem({ ) } + +const MenuCategoryLabel = styled.h2(({ theme }) => ({ + ...theme.partials.marketingText.label, + color: theme.colors['text-light'], + marginBottom: theme.spacing.xsmall, + marginLeft: theme.spacing.xxsmall, +})) diff --git a/src/components/menu/ProductNav.tsx b/src/components/menu/ProductNav.tsx deleted file mode 100644 index ca93e931..00000000 --- a/src/components/menu/ProductNav.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import React, { useMemo } from 'react' - -import { useNavigationContext } from '@pluralsh/design-system' - -import { useMenuItem } from 'react-aria' -import { Item } from 'react-stately' -import styled from 'styled-components' - -import { type NavList } from '@src/contexts/NavDataContext' - -import { ProductLink } from '../Navigation' - -import { type ItemRendererProps, MenuButton } from './Menu' - -function ProductTopNavMenuItem({ - item, - state, -}: ItemRendererProps) { - // Get props for the menu item element - const ref = React.useRef(null) - const { menuItemProps, isSelected, isDisabled } = useMenuItem( - { key: item.key }, - state, - ref - ) - - return ( - - - {item.rendered} - - - ) -} - -const TopNavMenuItemWrapper = styled.li((_) => ({})) - -export function ProductTopNavMenu({ - navItem, - left, -}: { - navItem: NavList - left?: number -}) { - const navigate = useNavigationContext().useNavigate() - const items = useMemo( - () => navItem?.subnav?.filter((item): item is NavList => !!item), - [navItem.subnav] - ) - - if (!items) { - return null - } - - return ( - { - const item = navItem.subnav?.find((item) => item?.id === key) - const url = item?.link?.url - - if (url) { - navigate(url) - } - }} - > - {({ ...item }) => ( - {item.link?.title} - )} - - ) -} diff --git a/src/components/menu/SolutionNav.tsx b/src/components/menu/SolutionNav.tsx deleted file mode 100644 index 80a73da9..00000000 --- a/src/components/menu/SolutionNav.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import React, { useMemo } from 'react' - -import { useNavigationContext } from '@pluralsh/design-system' - -import { useMenuItem } from 'react-aria' -import { Item } from 'react-stately' -import styled from 'styled-components' - -import { type NavList } from '@src/contexts/NavDataContext' - -import { SolutionLink } from '../Navigation' - -import { type ItemRendererProps, MenuButton } from './Menu' - -function SolutionTopNavMenuItem({ - item, - state, -}: ItemRendererProps) { - // Get props for the menu item element - const ref = React.useRef(null) - const { menuItemProps, isSelected, isDisabled } = useMenuItem( - { key: item.key }, - state, - ref - ) - - return ( - - - {item.rendered} - - - ) -} - -const TopNavMenuItemWrapper = styled.li((_) => ({})) - -export function SolutionTopNavMenu({ - navItem, - left, -}: { - navItem: NavList - left?: number -}) { - const navigate = useNavigationContext().useNavigate() - const items = useMemo( - () => navItem?.subnav?.filter((item): item is NavList => !!item), - [navItem.subnav] - ) - - if (!items) { - return null - } - - return ( - { - const item = navItem.subnav?.find((item) => item?.id === key) - const url = item?.link?.url - - if (url) { - navigate(url) - } - }} - > - {({ ...item }) => ( - {item.link?.title} - )} - - ) -} diff --git a/src/components/menu/TopNavMenu.tsx b/src/components/menu/TopNavMenu.tsx index 3aa4b091..fb6dd564 100644 --- a/src/components/menu/TopNavMenu.tsx +++ b/src/components/menu/TopNavMenu.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from 'react' +import React, { type ComponentProps, useMemo } from 'react' import { useNavigationContext } from '@pluralsh/design-system' @@ -8,13 +8,14 @@ import styled from 'styled-components' import { type NavList } from '@src/contexts/NavDataContext' -import { MainLink } from '../Navigation' +import { MainLink, ProductLink, SolutionLink } from '../Navigation' import { type ItemRendererProps, MenuButton } from './Menu' -export function TopNavMenuItem({ +function TopNavMenuItem({ item, state, + kind = 'default', }: ItemRendererProps) { // Get props for the menu item element const ref = React.useRef(null) @@ -24,27 +25,42 @@ export function TopNavMenuItem({ ref ) + const Link = + kind === 'product' + ? ProductLink + : kind === 'solution' + ? SolutionLink + : MainLink + return ( - {item.rendered} - + ) } const TopNavMenuItemWrapper = styled.li((_) => ({})) -export function TopNavMenu({ navItem }: { navItem: NavList }) { +export function TopNavMenu({ + navItem, + left, + kind = 'default', +}: { + navItem: NavList + left?: number + kind?: ComponentProps['kind'] +}) { const navigate = useNavigationContext().useNavigate() - const items = useMemo( () => navItem?.subnav?.filter((item): item is NavList => !!item), [navItem.subnav] @@ -59,6 +75,8 @@ export function TopNavMenu({ navItem }: { navItem: NavList }) { label={navItem.link?.title || 'Menu'} items={items} itemRenderer={TopNavMenuItem} + kind={kind} + left={left} onAction={(key) => { const item = navItem.subnav?.find((item) => item?.id === key) const url = item?.link?.url