import React from 'react';
import * as TagNs from './tag';

export type Params = {
  label?: string;
  tags: TagNs.Props[];
};

export type Props = {
  params: Params;
};

export const Tags = (props: Props): JSX.Element => {
  if (!props.params.tags) {
    return <></>;
  }
  let label = props.params.label || '';
  if (label) label = `${label}: `;
  const tags =
    props.params.tags.map((tag) => {
      return <TagNs.Tag tag={tag.tag} style={tag.style} key={tag.tag} />;
    }) || [];
  return (
    <>
      {label}
      {tags}
    </>
  );
};
