/* eslint-disable no-console */
import React from 'react';
import { action } from 'storybook/actions';
import { breakpoints } from '@moda/tokens';
import { Breakpoint } from './Breakpoint';
export default { title: 'Components/Breakpoint' };
const Debug: React.FC<{
name: string;
width: string;
mode: string;
}> = ({ name, width, mode }) => {
React.useEffect(() => {
action(`mount ${mode} ${name}`)();
return (): void => action(`unmount ${mode} ${name}`)();
}, [mode, name]);
return (
{mode}: {name} @{width}
);
};
const Display: React.FC<{ width: string }> = ({ width }) => {
return (
{width}
);
};
const Watcher: React.FC<{ from: string }> = ({ from }) => {
React.useEffect(() => {
console.log(' mounted', { from });
}, [from]);
console.log(' rendered', { from });
return View console
;
};
export const Values = () => (
<>
{Object.values(breakpoints).map(width => (
))}
{Object.entries(breakpoints).map(([name, width]: [string, string]) => {
return (
<>
>
);
})}
>
);
export const Simple = () => (
<>
{Object.values(breakpoints).map(width => (
))}
Only displays on small screens
Only displays on large screens
>
);
export const WithEvents = () => (
<>
Only displays on smaller screens
Only displays on large screens
>
);