260818_01_ENH: 1차 완성
This commit is contained in:
@@ -10,6 +10,7 @@ export interface KriSidebarProps {
|
||||
isOpen: boolean
|
||||
pathname?: string
|
||||
header?: React.ReactNode
|
||||
footer?: React.ReactNode
|
||||
onNavigate?: (path: string, item: KriNavigationItem) => void
|
||||
className?: string
|
||||
contentClassName?: string
|
||||
@@ -26,6 +27,7 @@ export function KriSidebar({
|
||||
isOpen,
|
||||
pathname = '',
|
||||
header,
|
||||
footer,
|
||||
onNavigate,
|
||||
className,
|
||||
contentClassName,
|
||||
@@ -33,12 +35,12 @@ export function KriSidebar({
|
||||
return (
|
||||
<aside
|
||||
className={cn(
|
||||
'fixed top-20 left-0 z-30 h-[calc(100vh-5rem)] overflow-y-auto border-r bg-background transition-all duration-300 lg:static lg:top-0 lg:h-full lg:translate-x-0',
|
||||
'fixed top-20 left-0 z-30 flex h-[calc(100vh-5rem)] flex-col overflow-hidden border-r bg-background transition-all duration-300 lg:static lg:top-0 lg:h-full lg:translate-x-0',
|
||||
isOpen ? 'w-80 translate-x-0' : 'w-80 -translate-x-full lg:w-0 lg:border-r-0',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div className={cn('h-full space-y-4 overflow-y-auto p-4', contentClassName)}>
|
||||
<div className={cn('min-h-0 flex-1 space-y-4 overflow-y-auto p-4', contentClassName)}>
|
||||
{header}
|
||||
<nav className="space-y-1">
|
||||
{items.map((item) => {
|
||||
@@ -54,7 +56,7 @@ export function KriSidebar({
|
||||
type="button"
|
||||
variant={active ? 'secondary' : 'ghost'}
|
||||
className={cn(
|
||||
'h-auto w-full justify-start rounded-md py-2 text-left whitespace-normal break-words',
|
||||
'h-auto w-full justify-start rounded-md py-2 text-left whitespace-normal break-keep break-words',
|
||||
active &&
|
||||
'border-l-2 border-primary bg-primary/10 text-primary font-medium hover:bg-primary/15 hover:text-primary',
|
||||
)}
|
||||
@@ -75,7 +77,7 @@ export function KriSidebar({
|
||||
type="button"
|
||||
variant={active ? 'secondary' : 'ghost'}
|
||||
className={cn(
|
||||
'h-auto w-full justify-start gap-1.5 rounded-md px-3 py-2 text-left whitespace-normal break-words',
|
||||
'h-auto w-full justify-start gap-1.5 rounded-md px-3 py-2 text-left whitespace-normal break-keep break-words',
|
||||
active &&
|
||||
'border-l-2 border-primary bg-primary/10 text-primary font-medium hover:bg-primary/15 hover:text-primary',
|
||||
)}
|
||||
@@ -99,7 +101,7 @@ export function KriSidebar({
|
||||
type="button"
|
||||
variant={childActive ? 'secondary' : 'ghost'}
|
||||
className={cn(
|
||||
'h-auto w-full justify-start rounded-md py-2 text-left whitespace-normal break-words',
|
||||
'h-auto w-full justify-start rounded-md py-2 text-left whitespace-normal break-keep break-words',
|
||||
childActive &&
|
||||
'border-l-2 border-primary bg-primary/10 text-primary font-medium hover:bg-primary/15 hover:text-primary',
|
||||
)}
|
||||
@@ -118,6 +120,7 @@ export function KriSidebar({
|
||||
})}
|
||||
</nav>
|
||||
</div>
|
||||
{footer ? <div className="shrink-0 border-t p-4">{footer}</div> : null}
|
||||
</aside>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user