@@ -17,6 +17,7 @@ interface TabManagerProps {
1717 onTabChange ?: ( tabValue : string ) => void
1818 direction ?: 'rtl' | 'ltr'
1919 tabPosition ?: 'top' | 'side'
20+ children ?: ReactNode // for additional tab buttons at the end of aside (just pass the actual buttons)
2021}
2122
2223export const TabManager = ( {
@@ -27,6 +28,7 @@ export const TabManager = ({
2728 direction = 'rtl' ,
2829 tabOwner,
2930 tabPosition,
31+ children,
3032} : TabManagerProps ) => {
3133 const [ activeTab , setActiveTab ] = useState ( defaultTab || tabs [ 0 ] ?. value || '' )
3234 const contentRef = useRef < HTMLDivElement > ( null )
@@ -69,28 +71,34 @@ export const TabManager = ({
6971 ? 'shrink-0 md:overflow-y-auto w-full'
7072 : 'md:flex-col md:w-48 shrink-0 md:overflow-y-auto'
7173 return (
72- < div dir = { direction } className = { `flex ${ headClass } overflow-hidden` } >
73- < div
74- className = { `flex w-full gap-2 p-2 overflow-x-auto rounded-lg ${ contentClass } ` }
75- >
76- { tabs . map ( ( { label, value, icon, isNew } ) => (
77- < button
78- key = { value }
79- onClick = { ( ) => handleTabChange ( value ) }
80- className = { `relative flex items-center gap-3 px-4 py-3 rounded-full transition-all duration-200 ease-in-out justify-start cursor-pointer whitespace-nowrap active:scale-[0.98] ${ getTabButtonStyle ( activeTab === value ) } ` }
81- >
82- < span
83- className = { `relative ${ getTabIconStyle ( activeTab === value ) } ` }
84- >
85- { icon }
86- { isNew && (
87- < span className = "absolute left-0 z-30 w-2 h-2 duration-200 rounded-full -bottom-1 bg-error animate-ping" > </ span >
88- ) }
89- </ span >
90- < span className = "text-sm" > { label } </ span >
91- </ button >
92- ) ) }
93- </ div > { ' ' }
74+ < div dir = { direction } className = { `flex ${ headClass } overflow-hidden` } >
75+ < aside className = "flex flex-row justify-between overflow-hidden sm:flex-col md:h-full" >
76+ < div
77+ className = { `flex w-full md:h-full justify-between overflow-x-auto rounded-lg ${ contentClass } ` }
78+ >
79+ < div className = "flex flex-row sm:flex-col sm:gap-2" >
80+ { tabs . map ( ( { label, value, icon, isNew } ) => (
81+ < button
82+ key = { value }
83+ onClick = { ( ) => handleTabChange ( value ) }
84+ className = { `relative flex items-center gap-3 px-4 py-3 rounded-full transition-all duration-200 ease-in-out justify-start cursor-pointer whitespace-nowrap active:scale-[0.98] ${ getTabButtonStyle ( activeTab === value ) } ` }
85+ >
86+ < span
87+ className = { `relative ${ getTabIconStyle ( activeTab === value ) } ` }
88+ >
89+ { icon }
90+ { isNew && (
91+ < span className = "absolute left-0 z-30 w-2 h-2 duration-200 rounded-full -bottom-1 bg-error animate-ping" > </ span >
92+ ) }
93+ </ span >
94+ < span className = "text-sm" > { label } </ span >
95+ </ button >
96+ ) ) }
97+ </ div >
98+ { children }
99+ </ div >
100+ </ aside >
101+
94102 < div
95103 className = "relative flex-1 overflow-x-hidden overflow-y-auto rounded-lg"
96104 ref = { contentRef }
0 commit comments