/** @format */
/**
* External dependencies
*/
import { createContext } from '@wordpress/element';
/**
* Context container for heading level. We start at 2 because the `h1` is defined in
*
* See https://medium.com/@Heydon/managing-heading-levels-in-design-systems-18be9a746fa3
*/
const Level = createContext( 2 );
export function Section( { component, children, ...props } ) {
const Component = component || 'div';
return (
{ level => (
{ false === component ? children : { children } }
) }
);
}
export function H( props ) {
return (
{ level => {
const Heading = 'h' + Math.min( level, 6 );
return ;
} }
);
}