From 329e7c89bac50be9db2c6d2ec6751ab0ffad42ac Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 22 Nov 2023 18:12:32 +0100
Subject: refactor(components): replace items prop in Grid with children prop

It is easier to read and to maintain this way. The `items` prop was not
useful since we are not manipulating the items. Changes:
* extract GridItem component from Grid component
* replace `items` prop of type Array<ReactNode> with `children` prop of
type ReactNode
* remove GridItem styles
---
 src/components/molecules/grid/grid-item.tsx | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 src/components/molecules/grid/grid-item.tsx

(limited to 'src/components/molecules/grid/grid-item.tsx')

diff --git a/src/components/molecules/grid/grid-item.tsx b/src/components/molecules/grid/grid-item.tsx
new file mode 100644
index 0000000..0592cec
--- /dev/null
+++ b/src/components/molecules/grid/grid-item.tsx
@@ -0,0 +1,15 @@
+import { type ForwardRefRenderFunction, forwardRef } from 'react';
+import { ListItem, type ListItemProps } from '../../atoms';
+
+export type GridItemProps = ListItemProps;
+
+const GridItemWithRef: ForwardRefRenderFunction<
+  HTMLLIElement,
+  GridItemProps
+> = ({ children, ...props }, ref) => (
+  <ListItem {...props} ref={ref}>
+    {children}
+  </ListItem>
+);
+
+export const GridItem = forwardRef(GridItemWithRef);
-- 
cgit v1.2.3

