From 15fd9f4a6ecf947c7648c6b7865b97c40124fde1 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Thu, 14 Apr 2022 19:12:54 +0200
Subject: chore: add a MainNav component

---
 src/components/atoms/lists/list.tsx | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

(limited to 'src/components/atoms/lists/list.tsx')

diff --git a/src/components/atoms/lists/list.tsx b/src/components/atoms/lists/list.tsx
index 7197c34..74ab8b0 100644
--- a/src/components/atoms/lists/list.tsx
+++ b/src/components/atoms/lists/list.tsx
@@ -29,6 +29,10 @@ export type ListProps = {
    * The list kind (ordered or unordered).
    */
   kind?: 'ordered' | 'unordered';
+  /**
+   * Set margin between list items. Default: true.
+   */
+  withMargin?: boolean;
 };
 
 /**
@@ -36,9 +40,15 @@ export type ListProps = {
  *
  * Render either an ordered or an unordered list.
  */
-const List: VFC<ListProps> = ({ className, items, kind = 'unordered' }) => {
+const List: VFC<ListProps> = ({
+  className,
+  items,
+  kind = 'unordered',
+  withMargin = true,
+}) => {
   const ListTag = kind === 'ordered' ? 'ol' : 'ul';
   const kindClass = `list--${kind}`;
+  const marginClass = withMargin ? 'list--has-margin' : 'list--no-margin';
 
   /**
    * Retrieve the list items.
@@ -51,7 +61,7 @@ const List: VFC<ListProps> = ({ className, items, kind = 'unordered' }) => {
         {value}
         {child && (
           <ListTag
-            className={`${styles.list} ${styles[kindClass]} ${className}`}
+            className={`${styles.list} ${styles[kindClass]} ${styles[marginClass]} ${className}`}
           >
             {getItems(child)}
           </ListTag>
@@ -61,7 +71,9 @@ const List: VFC<ListProps> = ({ className, items, kind = 'unordered' }) => {
   };
 
   return (
-    <ListTag className={`${styles.list} ${styles[kindClass]} ${className}`}>
+    <ListTag
+      className={`${styles.list} ${styles[kindClass]} ${styles[marginClass]} ${className}`}
+    >
       {getItems(items)}
     </ListTag>
   );
-- 
cgit v1.2.3

