+
{tabs.map((tab) => (
+ {/* Desktop: Vertical Layout */}
+
+ {/* Vertical Tabs Sidebar */}
+
+
+ {tabs.map((tab) => (
+
+ ))}
+
+
+
+ {/* Content Area - Desktop */}
+
+ {React.Children.map(children, (child) => {
+ if (React.isValidElement(child) && child.props['data-section-id']) {
+ const sectionId = child.props['data-section-id'];
+ const isActive = sectionId === activeTab;
+ const originalClassName = child.props.className || '';
+ return React.cloneElement(child as React.ReactElement
, {
+ ref: (el: HTMLElement) => registerSection(sectionId, el),
+ className: isActive ? originalClassName : `${originalClassName} hidden`.trim(),
+ });
+ }
+ return child;
+ })}
+
+
+
+ {/* Mobile: Content Area */}
+
{React.Children.map(children, (child) => {
if (React.isValidElement(child) && child.props['data-section-id']) {
const sectionId = child.props['data-section-id'];
const isActive = sectionId === activeTab;
+ const originalClassName = child.props.className || '';
return React.cloneElement(child as React.ReactElement
, {
- ref: (el: HTMLElement) => registerSection(sectionId, el),
- className: isActive ? '' : 'hidden',
+ className: isActive ? originalClassName : `${originalClassName} hidden`.trim(),
});
}
return child;