import styles from "./styles.module.scss"
import { Ad } from "./Ad"
import { SerializedEditorState } from 'lexical'

type ClassifiedsProps = {
  ads: Ad[]
}

type Ad = {
  id: string,
  text: SerializedEditorState,
  email: string
}

export const Classifieds = ({ads}: ClassifiedsProps) => {
  return (
    <div className={styles.ads}>
      {ads.map(ad => <Ad key={ad.id} text={ad.text} contact={ad.email} />)}
    </div>
  )
}