import styles from "./styles.module.scss"
import { TextDiv } from '@/components/Text/TextDiv'

type EventExcerptProps = {
  what?: string | null,
  where?: string | null,
  who?: string | null
}

type RowProps = {
  label: string,
  text: string
}

const Row = ({label, text}: RowProps) => {
  return (
    <div className={styles.row}>
      <div className={styles.col1}>
        {label}
      </div>
      <div>
        <TextDiv text={text} />
      </div>
    </div>
  )
}

export const EventExcerpt = ({ what, where, who }: EventExcerptProps) => {
  return (
    <div className={styles.container}>
      { what &&
        <Row label={"Was:"} text={what} />
      }

      { where &&
        <Row label={"Wo:"} text={where} />
      }

      { who &&
        <Row label={"Ansprechperson:"} text={who} />
      }
    </div>
  )
}