import React from 'react'

export default function WorldArchiveNotice({ notice }) {
  if (!notice) {
    return null
  }

  const currentEdition = notice.current_edition || null

  return (
    <section className="mb-6 rounded-[28px] border border-amber-300/20 bg-amber-400/10 px-5 py-4 text-sm text-amber-50">
      <div className="flex flex-wrap items-center justify-between gap-4">
        <div className="max-w-3xl">
          {notice.eyebrow ? <div className="text-[11px] font-semibold uppercase tracking-[0.18em] text-amber-100/75">{notice.eyebrow}</div> : null}
          {notice.title ? <div className="mt-1 text-base font-semibold text-white">{notice.title}</div> : null}
          {notice.description ? <p className="mt-2 leading-6 text-amber-50/85">{notice.description}</p> : null}
        </div>
        {currentEdition?.public_url ? (
          <a href={currentEdition.public_url} className="inline-flex items-center gap-2 rounded-full border border-white/15 bg-white/10 px-4 py-2 text-xs font-semibold uppercase tracking-[0.16em] text-white">
            Open current edition
            <i className="fa-solid fa-arrow-right" />
          </a>
        ) : null}
      </div>
    </section>
  )
}