diff --git a/components/AutoGrid.css b/components/AutoGrid.css new file mode 100644 index 0000000..39a2748 --- /dev/null +++ b/components/AutoGrid.css @@ -0,0 +1,5 @@ +.components__auto_grid { + display: 'grid'; + gap: var(--_gap); + margin-block: var(--_gap); +} \ No newline at end of file diff --git a/components/AutoGrid.tsx b/components/AutoGrid.tsx new file mode 100644 index 0000000..975d90f --- /dev/null +++ b/components/AutoGrid.tsx @@ -0,0 +1,21 @@ +import { JSX } from 'preact' + +type Units = 'rem' | '%' | 'px' + +export function AutoGrid( + { columnWidth, children }: { + columnWidth: `${number}${Units}` + children: JSX.Element | JSX.Element[] + }, +) { + return ( +
+ {children} +
+ ) +} diff --git a/routes/blog/index.tsx b/routes/blog/index.tsx index 877f615..4566e1f 100644 --- a/routes/blog/index.tsx +++ b/routes/blog/index.tsx @@ -1,18 +1,13 @@ +import { AutoGrid } from '../../components/AutoGrid.tsx' import { BlogCard, blogMock } from '../../components/BlogCard.tsx' export default function Blog() { return ( <>

Nos articles

-
+ {blogMock.map(BlogCard)} -
+ ) } diff --git a/routes/index.tsx b/routes/index.tsx index d78e90b..696753a 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -1,4 +1,5 @@ import { Head } from '$fresh/runtime.ts' +import { AutoGrid } from '../components/AutoGrid.tsx' import { BlogCard, blogMock } from '../components/BlogCard.tsx' import { CohabitInfoTable } from '../components/CohabitInfoTable.tsx' import { Heros } from '../components/Heros.tsx' diff --git a/routes/machines/index.tsx b/routes/machines/index.tsx index c4131c6..5fc1c43 100644 --- a/routes/machines/index.tsx +++ b/routes/machines/index.tsx @@ -1,18 +1,13 @@ +import { AutoGrid } from '../../components/AutoGrid.tsx' import { MachineCard, machineMock } from '../../components/MachineCard.tsx' export default function Machine() { return ( <>

Nos machines

-
+ {machineMock.map(MachineCard)} -
+ ) } diff --git a/routes/projets/index.tsx b/routes/projets/index.tsx index 2e9bd0d..065e1a9 100644 --- a/routes/projets/index.tsx +++ b/routes/projets/index.tsx @@ -1,18 +1,13 @@ +import { AutoGrid } from '../../components/AutoGrid.tsx' import { ProjectCard, projectMock } from '../../components/ProjectCard.tsx' export default function Project() { return ( <>

Nos Projets

-
+ {projectMock.map(ProjectCard)} -
+ ) } diff --git a/src/stylesheets/components.css b/src/stylesheets/components.css index 1337eb9..6d00ba5 100644 --- a/src/stylesheets/components.css +++ b/src/stylesheets/components.css @@ -6,5 +6,6 @@ @import url('../../components/BlogCard.css'); @import url('../../components/MachineCard.css'); @import url('../../components/ProjectCard.css'); +@import url('../../components/AutoGrid.css'); @import url('../../islands/ThemePicker.css'); @import url('../../islands/SearchBox.css');