From f861e6a269ba9f62700776d3cd13b644a9e836d4 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 20 Sep 2023 16:38:54 +0200
Subject: refactor: use named export for everything except pages

Next expect a default export for pages so only those components should
use default exports. Everything else should use named exports to
reduce the number of import statements.
---
 src/components/atoms/layout/notice.tsx | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

(limited to 'src/components/atoms/layout/notice.tsx')

diff --git a/src/components/atoms/layout/notice.tsx b/src/components/atoms/layout/notice.tsx
index a0d1d3e..9f69af2 100644
--- a/src/components/atoms/layout/notice.tsx
+++ b/src/components/atoms/layout/notice.tsx
@@ -1,13 +1,9 @@
-import { FC } from 'react';
+import { FC, HTMLAttributes } from 'react';
 import styles from './notice.module.scss';
 
 export type NoticeKind = 'error' | 'info' | 'success' | 'warning';
 
-export type NoticeProps = {
-  /**
-   * Set additional classnames to the notice wrapper.
-   */
-  className?: string;
+export type NoticeProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
   /**
    * The notice kind.
    */
@@ -23,16 +19,18 @@ export type NoticeProps = {
  *
  * Render a colored message depending on notice kind.
  */
-const Notice: FC<NoticeProps> = ({ className = '', kind, message }) => {
+export const Notice: FC<NoticeProps> = ({
+  className = '',
+  kind,
+  message,
+  ...props
+}) => {
   const kindClass = `wrapper--${kind}`;
+  const noticeClass = `${styles.wrapper} ${styles[kindClass]} ${className}`;
 
-  return message ? (
-    <div className={`${styles.wrapper} ${styles[kindClass]} ${className}`}>
+  return (
+    <div {...props} className={noticeClass}>
       {message}
     </div>
-  ) : (
-    <></>
   );
 };
-
-export default Notice;
-- 
cgit v1.2.3

