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

Add side nav heading #1362

Open
mattrosno opened this issue Oct 30, 2023 · 0 comments
Open

Add side nav heading #1362

mattrosno opened this issue Oct 30, 2023 · 0 comments

Comments

@mattrosno
Copy link
Member

Summary

The current side nav is limited by being a single list with one level of children:

image

The Carbon core team added headings to the side nav in Carbon Platform (see "Catalogs" example):

image

Let's bring that to the Gatsby theme so other sites can also benefit from the improved information architecture.

Justification

This allows website maintainers to group and categorize nav items. It can be used to simplify and improve information architecture.

Desired UX and success metrics

The visuals, behavior, etc. should match the side nav heading in Carbon Platform: https://next.carbondesignsystem.com

You can see the side nav heading used in this Carbon Platform design spec, but I'd view the coded side nav the source of truth unless a bug is identified: https://www.figma.com/file/M1UolPMDngdACDMMLU7WpX/v1_landing_pg_redlines?type=design&node-id=0-1&mode=design&t=CT82XGPPKAwhWeb2-0

Must-have functionality

This is the current nav data:

- title: Menu
  pages:
    - title: Page 1
      path: /menu/Page-1
    - title: Page 2
      path: /menu/Page-2
- title: Single Page
  pages:
    - path: /single-page

Any number of headings should be supported. Only top level. I'm thinking something like this would work by adding support for:

- heading: My heading.

- heading: My heading
- title: Menu
  pages:
    - title: Page 1
      path: /menu/Page-1
    - title: Page 2
      path: /menu/Page-2
- heading: Another heading
- title: Single page
  pages:
    - path: /single-page

Development considerations

This was built as part of the NavTree component in Carbon Platform. Source here: https://github.com/carbon-design-system/carbon-platform/tree/main/services/web-app/components/nav-tree

Carbon Platform's nav data is different. Instead of YAML it is authored as a JavaScript object. The screenshot of Carbon Platform above is set by this data:

export const assetsNavData = [
  {
    title: 'Catalogs',
    isSection: true,
    items: [
      {
        title: 'Assets',
        items: [
          {
            path: assetTypes.component.path,
            title: assetTypes.component.namePlural
          },
          {
            path: assetTypes.function.path,
            title: assetTypes.function.namePlural
          },
          {
            path: assetTypes.pattern.path,
            title: assetTypes.pattern.namePlural
          },
          {
            path: assetTypes.template.path,
            title: assetTypes.template.namePlural
          }
        ]
      },
      {
        path: '/design-kits',
        title: 'Design kits'
      },
      {
        path: '/libraries',
        title: 'Libraries'
      }
    ]
  }
]

As such, this won't be a copy/paste job. (E.g. the heading comes from the title key in Carbon Platform, and I'm recommending we use the heading key in the YAML data model.)

Also, I'll create a separate issue for upgrading the current side nav to the new NavTree. Since in Carbon Platform this is coming from the same component, I recommend doing this and that other issue in the same pull request.

Specific timeline issues / requests

N/A

Available extra resources

@glapadre may consider contributing this enhancement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant