website/components/AutoGrid.tsx

22 lines
377 B
TypeScript
Raw Normal View History

import { JSX } from 'preact'
type Units = 'rem' | '%' | 'px'
export function AutoGrid(
{ columnWidth, children }: {
columnWidth: `${number}${Units}`
children: JSX.Element | JSX.Element[]
},
) {
return (
<div
class='components__auto_grid'
style={{
gridTemplateColumns: `repeat(auto-fit, minmax(${columnWidth}, 1fr));`,
}}
>
{children}
</div>
)
}