diff --git a/apps/web-tss/src/components/ui/layouts/AppLayout.tsx b/apps/web-tss/src/components/ui/layouts/AppLayout.tsx index 4f5b7ee97..3887b74da 100644 --- a/apps/web-tss/src/components/ui/layouts/AppLayout.tsx +++ b/apps/web-tss/src/components/ui/layouts/AppLayout.tsx @@ -54,6 +54,8 @@ export const AppLayout: React.FC< leftChildren={sidebar} rightChildren={PageContent} initialLayout={initialLayout} + leftPanelElement="aside" + rightPanelElement="main" /> ); }; diff --git a/apps/web-tss/src/components/ui/layouts/AppSplitter/AppSplitter.tsx b/apps/web-tss/src/components/ui/layouts/AppSplitter/AppSplitter.tsx index bb67965d5..523c2fd40 100644 --- a/apps/web-tss/src/components/ui/layouts/AppSplitter/AppSplitter.tsx +++ b/apps/web-tss/src/components/ui/layouts/AppSplitter/AppSplitter.tsx @@ -145,6 +145,8 @@ const AppSplitterBase = forwardRef< leftChildren, rightChildren, defaultLayout, + leftPanelElement = 'div', + rightPanelElement = 'div', leftPanelMinSize = 0, rightPanelMinSize = 0, leftPanelMaxSize, @@ -646,6 +648,7 @@ const AppSplitterBase = forwardRef< width={isVertical ? leftSize : 'auto'} height={!isVertical ? leftSize : 'auto'} hidden={leftHidden} + as={leftPanelElement} > {leftChildren} @@ -664,6 +667,7 @@ const AppSplitterBase = forwardRef< width={isVertical ? rightSize : 'auto'} height={!isVertical ? rightSize : 'auto'} hidden={rightHidden} + as={rightPanelElement} > {rightChildren} diff --git a/apps/web-tss/src/components/ui/layouts/AppSplitter/AppSplitter.types.ts b/apps/web-tss/src/components/ui/layouts/AppSplitter/AppSplitter.types.ts index 7610b66c0..c4d157e33 100644 --- a/apps/web-tss/src/components/ui/layouts/AppSplitter/AppSplitter.types.ts +++ b/apps/web-tss/src/components/ui/layouts/AppSplitter/AppSplitter.types.ts @@ -1,6 +1,7 @@ export type PanelSize = `${number}px` | `${number}%` | 'auto' | number; type PanelSizeWithAuto = Exclude; export type LayoutSize = ['auto', PanelSizeWithAuto] | [PanelSizeWithAuto, 'auto']; +export type PanelElement = 'aside' | 'div' | 'main'; export interface IAppSplitterProps { /** Content to display in the left panel */ @@ -102,6 +103,12 @@ export interface IAppSplitterProps { /** Additional CSS classes for the right panel */ rightPanelClassName?: string; + + /** HTML element type for the left panel. Defaults to 'div' */ + leftPanelElement?: PanelElement; + + /** HTML element type for the right panel. Defaults to 'div' */ + rightPanelElement?: PanelElement; } /** diff --git a/apps/web-tss/src/components/ui/layouts/AppSplitter/Panel.tsx b/apps/web-tss/src/components/ui/layouts/AppSplitter/Panel.tsx index aacf35aa9..70bceb160 100644 --- a/apps/web-tss/src/components/ui/layouts/AppSplitter/Panel.tsx +++ b/apps/web-tss/src/components/ui/layouts/AppSplitter/Panel.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { cn } from '@/lib/classMerge'; +import type { PanelElement } from './AppSplitter.types'; interface IPanelProps { children: React.ReactNode; @@ -12,10 +13,11 @@ interface IPanelProps { className?: string; hidden?: boolean; style?: React.CSSProperties; + as?: PanelElement; } export const Panel: React.FC = React.memo( - ({ children, width, height, minSize, maxSize, className, hidden, style }) => { + ({ children, width, height, minSize, maxSize, className, hidden, style, as = 'div' }) => { if (hidden) return null; const panelStyle: React.CSSProperties = { @@ -26,18 +28,19 @@ export const Panel: React.FC = React.memo( ...(maxSize !== undefined && { maxWidth: `${maxSize}px`, maxHeight: `${maxSize}px` }), }; + const Component = as; + return ( -
{children} -
+ ); } ); diff --git a/apps/web-tss/src/layouts/PrimaryAppLayout.tsx b/apps/web-tss/src/layouts/PrimaryAppLayout.tsx index 63257a3c5..d2845fd28 100644 --- a/apps/web-tss/src/layouts/PrimaryAppLayout.tsx +++ b/apps/web-tss/src/layouts/PrimaryAppLayout.tsx @@ -2,7 +2,7 @@ import type React from 'react'; import { SidebarPrimary } from '@/components/features/sidebars/SidebarPrimary'; import { AppLayout, type LayoutSize } from '@/components/ui/layouts/AppLayout'; -export const PRIMARY_APP_LAYOUT_ID = 'app-layout'; +export const PRIMARY_APP_LAYOUT_ID = 'primary-sidebar'; const DEFAULT_LAYOUT: LayoutSize = ['230px', 'auto']; diff --git a/apps/web-tss/src/routes/app.home.tsx b/apps/web-tss/src/routes/app.home.tsx index ba92a590b..5d44b4c9a 100644 --- a/apps/web-tss/src/routes/app.home.tsx +++ b/apps/web-tss/src/routes/app.home.tsx @@ -23,7 +23,7 @@ function RouteComponent() { Left} rightChildren={} initialLayout={initialLayout} diff --git a/apps/web-tss/src/routes/app.tsx b/apps/web-tss/src/routes/app.tsx index 8a18d4c73..99ea3ad75 100644 --- a/apps/web-tss/src/routes/app.tsx +++ b/apps/web-tss/src/routes/app.tsx @@ -32,6 +32,7 @@ export const Route = createFileRoute('/app')({ }, component: () => { const { initialLayout } = Route.useLoaderData(); + return (