import ListItem from "./ListItem"

import styles from "./list.module.css"

import type { ListProps } from "@/types/requests/blocks/list"

export default function List({ list }: ListProps) {
  return (
    <>
      {list.title ? <h2 className={styles.title}>{list.title}</h2> : null}
      <ul className={styles.ul}>
        {list.list_items.map((item, i) => (
          <ListItem listItem={item} key={`list-item-${i}`} />
        ))}
      </ul>
    </>
  )
}
