piral-core
Version:
The core library for creating a Piral instance.
12 lines • 564 B
JavaScript
import * as React from 'react';
import { useMedia } from '../hooks';
import { defaultLayouts, defaultBreakpoints } from '../utils';
/**
* The component capable of identifying and switching the currently used layout.
*/
export const ResponsiveLayout = ({ breakpoints = defaultBreakpoints, Layout, children, }) => {
const selected = useMedia(breakpoints, defaultLayouts, 'desktop');
return React.createElement(Layout, { currentLayout: selected }, children);
};
ResponsiveLayout.displayName = 'ResponsiveLayout';
//# sourceMappingURL=ResponsiveLayout.js.map