File size: 585 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import clsx from 'clsx';
import { Children } from 'react';
import SidebarRegion from './region';
import './style.scss';
const Sidebar = ( { children, onClick = undefined, className = '', ...props } ) => {
const hasRegions = Children.toArray( children ).some( ( el ) => el.type === SidebarRegion );
const finalClassName = clsx( 'sidebar', className, { 'has-regions': hasRegions } );
return (
<ul
role="presentation"
className={ finalClassName }
onClick={ onClick }
data-tip-target="sidebar"
{ ...props }
>
{ children }
</ul>
);
};
export default Sidebar;
|