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

feat: add application layout side navigation components #1089

Merged
merged 3 commits into from
Jun 28, 2024

Conversation

huwshimi
Copy link
Collaborator

Done

  • Add SideNavigation and child components. These components are used by the application layout but can also be a used in other Vanilla layouts.

QA

Storybook

To see rendered examples of all react-components, run:

yarn start

QA in your project

from react-components run:

yarn build
npm pack

Install the resulting tarball in your project with:

yarn add <path-to-tarball>

QA steps

  • Open the demo.
  • Scroll down to the the SideNavigation docs and check they look OK.

@webteam-app
Copy link

Copy link
Contributor

@edlerd edlerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, two comments below, none of them are blocking.

One other aspect to think about: Will this be possible to extend for collapsible sections? See the video below for how it looks like. No need to implement this right away, just making sure with the introduced structure we don't make it too hard to extend as a next version of this.

Screencast.from.22.05.2024.10.55.05.webm

@huwshimi
Copy link
Collaborator Author

One other aspect to think about: Will this be possible to extend for collapsible sections? See the video below for how it looks like. No need to implement this right away, just making sure with the introduced structure we don't make it too hard to extend as a next version of this.

I suspect this should probably be a modification in Vanilla that we would then add to react-components.

Right now this is supported in the side nav as you can pass any ReactNode as an item, so you pass in a custom accordion component. For example this is an excerpt from how I handle the side nav accordion in lxd-ui here: https://github.com/canonical/lxd-ui/pull/768/files#diff-0a53ec42b8db78013ad213a9f952a9b25ef65c0ce9ee169bd1b65af00f245607R185

      <SideNavigation<NavLinkProps>
        dark
        items={[
          {
            className: "sidenav-top-ul",
            items: isAuthenticated
              ? [
                  ...
                  {
                    icon: "connected",
                    label: "Networks",
                    onClick: softToggleMenu,
                    title: `Networks (${projectName})`,
                    to: `/ui/project/${projectName}/networks`,
                  },
                  <NavAccordion
                    baseUrl={`/ui/project/${projectName}/storage`}
                    title={`Storage (${projectName})`}
                    iconName="pods"
                    key="storage"
                    label="Storage"
                    onOpen={() => toggleAccordionNav("storage")}
                    open={openNavMenus.includes("storage")}
                  >
                  ...

@edlerd edlerd merged commit d0401d4 into canonical:main Jun 28, 2024
13 checks passed
Copy link

🎉 This PR is included in version 0.58.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants