aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/MetaItems/MetaItem/MetaItem.tsx
blob: 5c51283e9c75d0a584d2f474ecad85448905d509 (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
31
32
33
34
35
36
import { MetaKind } from '@ts/types/app';
import { ReactElement } from 'react';
import styles from './MetaItem.module.scss';

const MetaItem = ({
  title,
  value,
  values,
  info,
  kind = 'list',
}: {
  title: string;
  value?: ReactElement | string;
  values?: ReactElement[] | string[];
  info?: string;
  kind: MetaKind;
}) => {
  return (
    <div className={styles[`wrapper--${kind}`]}>
      <dt className={styles[`title--${kind}`]}>{title}</dt>
      {value && (
        <dd className={styles[`body--${kind}`]} title={info}>
          {value}
        </dd>
      )}
      {values &&
        values.map((currentValue, index) => (
          <dd key={index} className={styles[`body--${kind}`]} title={info}>
            {currentValue}
          </dd>
        ))}
    </div>
  );
};

export default MetaItem;