22 lines
377 B
TypeScript
22 lines
377 B
TypeScript
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>
|
|
)
|
|
}
|