feat(components): allow custom styles for AutoGrid

This commit is contained in:
Julien Oculi 2024-07-02 11:16:10 +02:00
parent 21f5009b7a
commit 4fcfd34bbb

View file

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