From 837e0e904c40f7b87561c34ca3f49edd5d8d1c52 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Thu, 28 Sep 2023 18:03:43 +0200
Subject: feat(components): replace icons with a generic Icon component

Sizes are also predefined and can be set using the `size` prop,
so the consumers should no longer adjust the size in CSS.
---
 .../icons/plus-minus-icon/plus-minus-icon.tsx      | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 src/components/atoms/images/icons/plus-minus-icon/plus-minus-icon.tsx

(limited to 'src/components/atoms/images/icons/plus-minus-icon/plus-minus-icon.tsx')

diff --git a/src/components/atoms/images/icons/plus-minus-icon/plus-minus-icon.tsx b/src/components/atoms/images/icons/plus-minus-icon/plus-minus-icon.tsx
new file mode 100644
index 0000000..ed6bcf2
--- /dev/null
+++ b/src/components/atoms/images/icons/plus-minus-icon/plus-minus-icon.tsx
@@ -0,0 +1,30 @@
+import type { FC, HTMLAttributes } from 'react';
+import styles from './plus-minus-icon.module.scss';
+
+export type PlusMinusIconShape = 'minus' | 'plus';
+
+export type PlusMinusIconProps = Omit<
+  HTMLAttributes<HTMLDivElement>,
+  'children'
+> & {
+  /**
+   * Which shape should be displayed.
+   */
+  shape: PlusMinusIconShape;
+};
+
+/**
+ * PlusMinusIcon component
+ *
+ * Render a plus or a minus icon.
+ */
+export const PlusMinusIcon: FC<PlusMinusIconProps> = ({
+  className = '',
+  shape,
+  ...props
+}) => {
+  const shapeClass = styles[`icon--${shape}`];
+  const iconClass = `${styles.icon} ${shapeClass} ${className}`;
+
+  return <div {...props} className={iconClass} />;
+};
-- 
cgit v1.2.3

