import React from 'react'; import cx from 'clsx'; /** * Props Types for the Container component. * They are able to infer the props of the element type passed to the `as` prop. */ type ContainerProps = { /** Primary content. */ children: React.ReactNode; /** An element type to render as (string or function). */ as?: T; /** Additional CSS classes. */ className?: string; /** Container width */ width?: 'layout' | 'default' | 'narrow' | 'full'; /** [deprecated] Layout size */ layout?: boolean; /** [deprecated] Narrow size. */ narrow?: boolean; } & React.ComponentPropsWithoutRef; export const Container = ( props: ContainerProps, ) => { const { as: Component = 'div', children, className, width, layout, narrow, ...rest } = props; const classes = cx('q', 'container', className, { layout, narrow, [width || '']: true, }); return ( {children} ); };