"use client"; /* * Documentation: * Icon Button — https://app.subframe.com/f023064a5ca0/library?component=Icon+Button_af9405b1-8c54-4e01-9786-5aad308224f6 * Logo — https://app.subframe.com/f023064a5ca0/library?component=Logo_609493cb-7054-4018-bcb4-26d43de9ef41 * Sidebar with sections — https://app.subframe.com/f023064a5ca0/library?component=Sidebar+with+sections_f4047c8b-cfb4-4761-b9cf-fbcae8a9b9b5 */ import React from "react"; import { FeatherCircleDashed } from "@subframe/core"; import { FeatherSidebarClose } from "@subframe/core"; import { FeatherSidebarOpen } from "@subframe/core"; import * as SubframeCore from "@subframe/core"; import * as SubframeUtils from "../../utils"; import { IconButton } from "../IconButton"; import { Logo } from "../Logo"; export interface NavItemProps extends React.HTMLAttributes { icon?: React.ReactNode; children?: React.ReactNode; selected?: boolean; variant?: "icon-and-text" | "icon-only" | "subitem"; className?: string; } const NavItem = React.forwardRef(function NavItem( { icon = , children, selected = false, variant = "icon-and-text", className, ...otherProps }: NavItemProps, ref ) { return (
{icon ? ( {icon} ) : null} {children ? ( {children} ) : null}
); }); export interface NavSectionProps extends React.HTMLAttributes { children?: React.ReactNode; label?: React.ReactNode; variant?: "default" | "subsection"; showLabel?: boolean; showDivider?: boolean; className?: string; } const NavSection = React.forwardRef( function NavSection( { children, label, variant = "default", showLabel = false, showDivider = false, className, ...otherProps }: NavSectionProps, ref ) { return (
{children ? (
{children}
) : null}
); } ); export interface NavLabelProps extends React.HTMLAttributes { label?: React.ReactNode; className?: string; } const NavLabel = React.forwardRef( function NavLabel({ label, className, ...otherProps }: NavLabelProps, ref) { return (
{label ? ( {label} ) : null}
); } ); export interface NavDividerProps extends React.HTMLAttributes { className?: string; } const NavDivider = React.forwardRef( function NavDivider({ className, ...otherProps }: NavDividerProps, ref) { return (
); } ); export interface SubcomponentProps extends React.HTMLAttributes { sidebarButton?: "close" | "open"; className?: string; } const Subcomponent = React.forwardRef( function Subcomponent( { sidebarButton = "close", className, ...otherProps }: SubcomponentProps, ref ) { return (
) : ( ) } />
); } ); export interface SidebarWithSectionsRootProps extends React.HTMLAttributes { variant?: "open" | "closed"; footer?: React.ReactNode; children?: React.ReactNode; className?: string; } const SidebarWithSectionsRoot = React.forwardRef< HTMLElement, SidebarWithSectionsRootProps >(function SidebarWithSectionsRoot( { variant = "open", footer, children, className, ...otherProps }: SidebarWithSectionsRootProps, ref ) { return ( ); }); export const SidebarWithSections = Object.assign(SidebarWithSectionsRoot, { NavItem, NavSection, NavLabel, NavDivider, Subcomponent, });