| 564 | const getRandomWidth = () => `${Math.floor(Math.random() * 40) + 50}%` |
| 565 | |
| 566 | function SidebarMenuSkeleton({ |
| 567 | className, |
| 568 | showIcon = false, |
| 569 | ...props |
| 570 | }: React.ComponentProps<"div"> & { |
| 571 | showIcon?: boolean |
| 572 | }) { |
| 573 | const [width] = React.useState(getRandomWidth) |
| 574 | |
| 575 | return ( |
| 576 | <div |
| 577 | className={cn("flex h-8 items-center gap-2 rounded-lg px-2", className)} |
| 578 | data-sidebar="menu-skeleton" |
| 579 | data-slot="sidebar-menu-skeleton" |
| 580 | {...props} |
| 581 | > |
| 582 | {showIcon && <Skeleton className="size-4 rounded-lg" data-sidebar="menu-skeleton-icon" />} |
| 583 | <Skeleton |
| 584 | className="h-4 max-w-(--skeleton-width) flex-1" |
| 585 | data-sidebar="menu-skeleton-text" |
| 586 | style={ |
| 587 | { |
| 588 | "--skeleton-width": width, |
| 589 | } as React.CSSProperties |
| 590 | } |
| 591 | /> |
| 592 | </div> |
| 593 | ) |
| 594 | } |
| 595 | |
| 596 | function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) { |
| 597 | return ( |