Skip to content

Instantly share code, notes, and snippets.

@ademilter
Last active February 18, 2020 18:47
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ademilter/aa5c2839650c7eff0797e6aa724575ab to your computer and use it in GitHub Desktop.
Save ademilter/aa5c2839650c7eff0797e6aa724575ab to your computer and use it in GitHub Desktop.
raster grid with gap
import Grid from './components/grid'
export default function Grid({ children, gap, ...props }) {
return (
<Grid gap={32} col={4}>
<r-cell>cell</r-cell>
<r-cell>cell</r-cell>
<r-cell>cell</r-cell>
<r-cell>cell</r-cell>
</Grid>
)
}
r-grid {
--grid-tc: repeat(4, 1fr);
--grid-cs: 1; /* column start */
--grid-ce: -1; /* column end */
--grid-gap: 0;
display: grid;
grid-template-columns: var(--grid-tc);
grid-gap: var(--grid-gap);
}
/*
raster other styless...
*/
export default function Grid({ children, gap, ...props }) {
return (
<r-grid style={gap ? { '--grid-gap': `${gap}px` } : null} {...props}>
{children}
</r-grid>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment