aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/images/icons/plus-minus-icon/plus-minus-icon.tsx
blob: ed6bcf23f4af69ce8bc56d627c7f9e8a79fb1335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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} />;
};