|
| 1 | +--- |
| 2 | +import {Picture} from 'astro:assets'; |
| 3 | +import Layout from '../layouts/Layout.astro'; |
| 4 | +import Section from '../components/Section.astro'; |
| 5 | +import {useLocalePages, useTranslations, type LocaleString} from '../i18n/utils'; |
| 6 | +import type {DataEntryMap} from 'astro:content'; |
| 7 | +import {mdExcerpt} from './utils'; |
| 8 | +
|
| 9 | +interface Props { |
| 10 | + datum: DataEntryMap['data']; |
| 11 | + pageBody: string; |
| 12 | + lang: LocaleString; |
| 13 | +} |
| 14 | +
|
| 15 | +const {datum, pageBody, lang} = Astro.props; |
| 16 | +
|
| 17 | +const p = useLocalePages(Astro.currentLocale); |
| 18 | +const t = useTranslations(lang); |
| 19 | +--- |
| 20 | + |
| 21 | +<style> |
| 22 | + div :global(a) { |
| 23 | + color: var(--color-main-green); |
| 24 | + } |
| 25 | + div :global(a:hover) { |
| 26 | + text-decoration: underline; |
| 27 | + } |
| 28 | + div :global(h2) { |
| 29 | + margin-top: 1rem; |
| 30 | + margin-bottom: 1rem; |
| 31 | + font-size: 1.5rem; |
| 32 | + font-weight: s emibold; |
| 33 | + } |
| 34 | + div :global(ul) { |
| 35 | + list-style-type: disc; |
| 36 | + padding-left: 1.5rem; |
| 37 | + } |
| 38 | + div :global(ol) { |
| 39 | + list-style-type: decimal; |
| 40 | + padding-left: 1.5rem; |
| 41 | + } |
| 42 | +</style> |
| 43 | + |
| 44 | +<Layout title={datum.title} description={mdExcerpt(pageBody, 200)}> |
| 45 | + <Section> |
| 46 | + <Picture class="w-full rounded-xl object-cover" src={datum.exampleImage} alt={datum.title} /> |
| 47 | + <div class="text-lg"><slot /></div> |
| 48 | + </Section> |
| 49 | + <Section bg="green" box> |
| 50 | + <h3 class="mt-6 mb-4 text-xl font-semibold">{t('data.specs')}</h3> |
| 51 | + { |
| 52 | + datum.classes && ( |
| 53 | + <> |
| 54 | + <h4 class="mt-4 text-lg font-semibold">{t('data.classes')}</h4> |
| 55 | + <ul class="list-disc pl-6"> |
| 56 | + {datum.classes.map((className) => ( |
| 57 | + <li>{className}</li> |
| 58 | + ))} |
| 59 | + </ul> |
| 60 | + </> |
| 61 | + ) |
| 62 | + } |
| 63 | + <h4 class="mt-4 text-lg font-semibold">{t('data.dataSources')}</h4> |
| 64 | + <ul class="list-disc pl-6"> |
| 65 | + {datum.dataSources.map((source) => <li>{source}</li>)} |
| 66 | + </ul> |
| 67 | + <h4 class="mt-4 text-lg font-semibold">{t('data.method')}</h4> |
| 68 | + <p>{datum.method}</p> |
| 69 | + <h4 class="mt-4 text-lg font-semibold">{t('data.quality')}</h4> |
| 70 | + <p>{datum.quality}</p> |
| 71 | + {datum.qualityImage && <Picture src={datum.qualityImage} alt={t('data.quality')} />} |
| 72 | + <div class="mt-4"> |
| 73 | + <h4 class="text-lg font-semibold">{t('data.properties')}</h4> |
| 74 | + <table class="border-main-lightgreen mt-4 w-full border-2"> |
| 75 | + <tbody> |
| 76 | + <tr> |
| 77 | + <th class="border-main-lightgreen border-b px-2 py-1 text-left">{t('data.crs')}</th> |
| 78 | + <td class="border-main-lightgreen border-b px-2 py-1">{datum.properties.crs}</td> |
| 79 | + </tr> |
| 80 | + <tr> |
| 81 | + <th class="border-main-lightgreen border-b px-2 py-1 text-left">{t('data.time')}</th> |
| 82 | + <td class="border-main-lightgreen border-b px-2 py-1">{datum.properties.time}</td> |
| 83 | + </tr> |
| 84 | + <tr> |
| 85 | + <th class="border-main-lightgreen border-b px-2 py-1 text-left">{t('data.spatialResolution')}</th> |
| 86 | + <td class="border-main-lightgreen border-b px-2 py-1">{datum.properties.spatialResolution}</td> |
| 87 | + </tr> |
| 88 | + <tr> |
| 89 | + <th class="px-2 py-1 text-left">{t('data.spatialValidity')}</th> |
| 90 | + <td class="px-2 py-1">{datum.properties.spatialValidity}</td> |
| 91 | + </tr> |
| 92 | + </tbody> |
| 93 | + </table> |
| 94 | + </div> |
| 95 | + </Section> |
| 96 | + <Section bg="beach"> |
| 97 | + <p class="mx-auto pb-8 text-2xl font-medium text-white text-shadow-lg">{t('contact.slogan')}</p> |
| 98 | + <p class="mx-auto"> |
| 99 | + <a |
| 100 | + href={p('contact')} |
| 101 | + class="text-main-green hover:text-second-torquise inline-flex items-center gap-x-2 rounded-lg border border-transparent bg-white p-4 text-sm font-medium focus:bg-white focus:outline-hidden disabled:pointer-events-none disabled:opacity-50 sm:p-5" |
| 102 | + > |
| 103 | + {t('contact.button')} |
| 104 | + </a> |
| 105 | + </p> |
| 106 | + </Section> |
| 107 | +</Layout> |
0 commit comments