feat: add matrix section
This commit is contained in:
@@ -2,8 +2,8 @@ import { useEffect, useRef, useState } from 'react';
|
||||
import './Sidebar.css';
|
||||
import { ChevronLeftIcon } from '../../assets/icons/ChevronLeftIcon';
|
||||
|
||||
export type SidebarItem = {
|
||||
id: string;
|
||||
export type SidebarItem<T extends string = string> = {
|
||||
id: T;
|
||||
label: string;
|
||||
icon: React.ReactNode;
|
||||
};
|
||||
@@ -13,12 +13,12 @@ export type SidebarAppOption = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
function SidebarButton({
|
||||
function SidebarButton<T extends string>({
|
||||
item,
|
||||
active,
|
||||
onSelect,
|
||||
}: {
|
||||
item: SidebarItem;
|
||||
item: SidebarItem<T>;
|
||||
active: boolean;
|
||||
onSelect: () => void;
|
||||
}) {
|
||||
@@ -218,7 +218,7 @@ function AppCombobox({
|
||||
);
|
||||
}
|
||||
|
||||
export default function Sidebar({
|
||||
export function Sidebar<T extends string>({
|
||||
items,
|
||||
activeId,
|
||||
onSelect,
|
||||
@@ -230,9 +230,9 @@ export default function Sidebar({
|
||||
expanded,
|
||||
onToggle,
|
||||
}: {
|
||||
items: SidebarItem[];
|
||||
activeId: string | null;
|
||||
onSelect: (id: string) => void;
|
||||
items: SidebarItem<T>[];
|
||||
activeId: T | null;
|
||||
onSelect: (id: T) => void;
|
||||
appName: string;
|
||||
appOptions?: SidebarAppOption[];
|
||||
selectedAppId?: string;
|
||||
|
||||
Reference in New Issue
Block a user