import s from './styles.module.css' import cx from 'classnames' import { createElement } from 'react' export type BlockProps = { as?: keyof HTMLElementTagNameMap style?: React.CSSProperties direction: 'horizontal' | 'vertical' } export const Block: React.FC = ({ as = 'div', style, direction, ...props }) => { const directionClass = direction === 'horizontal' ? s.horizontal : s.vertical const newProps = { className: cx(s.block, directionClass), style, } return createElement(as, newProps, props.children) }