Skip to content

feat(blocks): make sidebar nav items without children render as SidebarMenuButton for sidebar-07 & sidebar-08#6107

Closed
blackstarxr253 wants to merge 4 commits intoshadcn-ui:mainfrom
blackstarxr253:improved-sidebar-nav
Closed

feat(blocks): make sidebar nav items without children render as SidebarMenuButton for sidebar-07 & sidebar-08#6107
blackstarxr253 wants to merge 4 commits intoshadcn-ui:mainfrom
blackstarxr253:improved-sidebar-nav

Conversation

@blackstarxr253
Copy link
Copy Markdown

@blackstarxr253 blackstarxr253 commented Dec 17, 2024

For nav elements that you don't want to render as a collapsible, I added a check that changes the render to a standard SidebarNavButton as long as the nav object has no children

Example

Nav entry with children

{
      title: "Playground",
      url: "#",
      icon: SquareTerminal,
      isActive: true,
      items: [
        {
          title: "History",
          url: "#",
        },
        {
          title: "Starred",
          url: "#",
        },
        {
          title: "Settings",
          url: "#",
        },
      ],
    },

since it has children, it should display as a collapsible
Screenshot 2024-12-17 at 9 12 26 AM

Nav entry without children

{
      title: "Dashboard",
      url: "/dashboard",
      icon: Home,
    },
    {
      title: "Playground",
      url: "#",
      icon: SquareTerminal,
      isActive: true,
      items: [
        {
          title: "History",
          url: "#",
        },
        {
          title: "Starred",
          url: "#",
        },
        {
          title: "Settings",
          url: "#",
        },
      ],
    },

since dashboard has no children, it should render as a button instead
Screenshot 2024-12-17 at 9 15 13 AM

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Dec 17, 2024

@blackstarxr253 is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@blackstarxr253 blackstarxr253 changed the title feat(sidebar-07): make sidebar nav items without children render as SidebarMenuButton feat(blocks): make sidebar nav items without children render as SidebarMenuButton for sidebar-07 & sidebar-08 Dec 17, 2024
@blackstarxr253 blackstarxr253 deleted the improved-sidebar-nav branch December 30, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant