|
| 1 | +import Image from 'next/image'; |
| 2 | +import Link from 'next/link'; |
| 3 | +import clsx from 'clsx'; |
| 4 | +import { ArrowUpRight } from 'lucide-react'; |
| 5 | +import type { HomeDocumentData } from '@/prismicio-types'; |
| 6 | +import type { FilledLinkToWebField } from '@prismicio/types'; |
| 7 | +import type { FC } from 'react'; |
| 8 | + |
| 9 | +type SummitsProps = { |
| 10 | + readonly title: HomeDocumentData['section_title']; |
| 11 | + readonly description: HomeDocumentData['section_description']; |
| 12 | + readonly items: HomeDocumentData['summits']; |
| 13 | +}; |
| 14 | + |
| 15 | +const Summits: FC<SummitsProps> = ({ title, items, description }) => ( |
| 16 | + <div className="overflow-hidden" id="summits"> |
| 17 | + <div className="relative mx-auto max-w-7xl px-4 py-16 sm:px-6 lg:px-8"> |
| 18 | + <div className="mx-auto max-w-prose text-base lg:grid lg:max-w-none lg:gap-4"> |
| 19 | + <h2 className="mt-2 text-3xl font-bold leading-8 tracking-tight text-gray-900 dark:text-white sm:text-4xl"> |
| 20 | + {title} |
| 21 | + </h2> |
| 22 | + <p className="text-lg text-gray-600 dark:text-gray-300 w-full md:w-1/2"> |
| 23 | + {description} |
| 24 | + </p> |
| 25 | + </div> |
| 26 | + <ul className="mt-8 grid grid-cols-1 gap-6 sm:grid-cols-2"> |
| 27 | + {items.map( |
| 28 | + ( |
| 29 | + { |
| 30 | + summit_name, |
| 31 | + summit_dates, |
| 32 | + summit_description, |
| 33 | + playlist_link, |
| 34 | + agenda_link, |
| 35 | + summit_image, |
| 36 | + participants_image, |
| 37 | + additional_participants_number, |
| 38 | + }, |
| 39 | + index |
| 40 | + ) => ( |
| 41 | + <li |
| 42 | + key={index} |
| 43 | + className="col-span-1 divide-y divide-gray-200 overflow-hidden rounded-lg bg-white shadow dark:divide-gray-700 dark:bg-gray-900" |
| 44 | + > |
| 45 | + <Image |
| 46 | + src={summit_image.url ?? ''} |
| 47 | + alt="" |
| 48 | + width={summit_image.dimensions?.width} |
| 49 | + height={summit_image.dimensions?.height} |
| 50 | + className="aspect-[5/3] object-cover" |
| 51 | + /> |
| 52 | + |
| 53 | + <div className="flex w-full items-center justify-between space-x-6 p-6"> |
| 54 | + <div className="flex-1 max-w-full"> |
| 55 | + <div className="flex flex-col mb-2"> |
| 56 | + <div className="mb-2"> |
| 57 | + {summit_dates!.split(',')[0]} →{' '} |
| 58 | + {summit_dates!.split(',')[1]},{' '} |
| 59 | + {summit_dates!.split(',')[2]} |
| 60 | + </div> |
| 61 | + <h3 className="truncate mb-4 text-2xl font-semibold text-gray-900 dark:text-white"> |
| 62 | + {summit_name} |
| 63 | + </h3> |
| 64 | + <p className="mt-2 text-base text-gray-500 dark:text-gray-400"> |
| 65 | + {summit_description} |
| 66 | + </p> |
| 67 | + </div> |
| 68 | + <div className="flex items-center"> |
| 69 | + <Image |
| 70 | + src={participants_image.url ?? ''} |
| 71 | + alt="" |
| 72 | + width={participants_image.dimensions?.width} |
| 73 | + height={44} |
| 74 | + className="object-cover" |
| 75 | + /> |
| 76 | + <span className="ml-2"> |
| 77 | + {additional_participants_number} |
| 78 | + </span> |
| 79 | + </div> |
| 80 | + <div className="flex flex-row"> |
| 81 | + <p className="mt-8 mr-6"> |
| 82 | + <Link |
| 83 | + href={(playlist_link as FilledLinkToWebField).url} |
| 84 | + className={clsx( |
| 85 | + 'inline-flex items-center gap-2 rounded-lg px-4 py-1.5 text-base font-semibold leading-7 ring-1 transition-colors', |
| 86 | + 'text-white bg-primary-blue dark:text-white dark:ring-white/10' |
| 87 | + )} |
| 88 | + > |
| 89 | + Playlist Of Talks |
| 90 | + <ArrowUpRight className="h-4 w-4" /> |
| 91 | + </Link> |
| 92 | + </p> |
| 93 | + <p className="mt-8"> |
| 94 | + <Link |
| 95 | + href={(agenda_link as FilledLinkToWebField).url} |
| 96 | + className={clsx( |
| 97 | + 'inline-flex items-center gap-2 rounded-lg px-4 py-1.5 text-base font-semibold leading-7 ring-1 transition-colors', |
| 98 | + 'text-gray-900 ring-gray-900/10 hover:ring-gray-900/20 dark:text-white dark:ring-white/10' |
| 99 | + )} |
| 100 | + > |
| 101 | + Full Agenda |
| 102 | + <ArrowUpRight className="h-4 w-4" /> |
| 103 | + </Link> |
| 104 | + </p> |
| 105 | + </div> |
| 106 | + </div> |
| 107 | + </div> |
| 108 | + </li> |
| 109 | + ) |
| 110 | + )} |
| 111 | + </ul> |
| 112 | + </div> |
| 113 | + </div> |
| 114 | +); |
| 115 | + |
| 116 | +export default Summits; |
0 commit comments