|
| 1 | +import { raw } from 'hono/html' |
1 | 2 | import { Layout } from '../design/common/layout' |
2 | | -import { FeaturedCard } from '../design/components/featured-card' |
3 | | -import type { Catalog } from '../catalog/types' |
| 3 | +import { LabCard } from '../design/components/lab-card' |
| 4 | +import { url } from '../build/config' |
| 5 | +import type { FeaturedLab } from '../build/featured' |
4 | 6 | import type { SiteConfig } from '../build/config' |
5 | 7 |
|
6 | | -export type HeroContent = { hero: string; intro: string } |
| 8 | +export type HeroContent = { |
| 9 | + title: string |
| 10 | + subtitle: string |
| 11 | + intro: string // pre-rendered HTML |
| 12 | + learnMore: { |
| 13 | + commitment: string |
| 14 | + about: string |
| 15 | + } |
| 16 | +} |
7 | 17 |
|
8 | 18 | export function Home({ |
9 | | - catalog, |
10 | 19 | hero, |
| 20 | + featured, |
11 | 21 | config, |
12 | 22 | }: { |
13 | | - catalog: Catalog |
14 | 23 | hero: HeroContent |
| 24 | + featured: FeaturedLab[] |
15 | 25 | config: SiteConfig |
16 | 26 | }) { |
17 | | - const featuredOrder = ['forms', 'forms-lab', 'document-extractor', 'flexion-notify'] |
18 | | - const featured = catalog |
19 | | - .filter((e) => e.featured && !e.hidden) |
20 | | - .sort((a, b) => { |
21 | | - const ai = featuredOrder.indexOf(a.name) |
22 | | - const bi = featuredOrder.indexOf(b.name) |
23 | | - return (ai === -1 ? 999 : ai) - (bi === -1 ? 999 : bi) |
24 | | - }) |
25 | | - const visible = catalog.filter((e) => !e.hidden) |
26 | | - const active = visible.filter((e) => e.tier === 'active').length |
27 | | - const languages = new Set( |
28 | | - visible.map((e) => e.language).filter((l): l is string => Boolean(l)), |
29 | | - ).size |
30 | | - |
31 | 27 | return ( |
32 | 28 | <Layout title={null} config={config}> |
33 | 29 | <section class="home-hero"> |
34 | | - <h1>{hero.hero}</h1> |
35 | | - <p class="home-hero__intro">{hero.intro}</p> |
| 30 | + <h1>{hero.title}</h1> |
| 31 | + {hero.subtitle ? ( |
| 32 | + <p class="home-hero__subtitle">{hero.subtitle}</p> |
| 33 | + ) : null} |
| 34 | + {hero.intro ? ( |
| 35 | + <div class="home-intro">{raw(hero.intro)}</div> |
| 36 | + ) : null} |
36 | 37 | </section> |
37 | 38 |
|
38 | 39 | <section class="home-featured" aria-labelledby="featured-heading"> |
39 | 40 | <div class="home-featured__header"> |
40 | | - <h2 id="featured-heading">Featured</h2> |
41 | | - <p class="home-featured__intro"> |
42 | | - Products and tools we actively steward — built for government, shared with everyone. |
43 | | - </p> |
| 41 | + <h2 id="featured-heading">Featured labs</h2> |
44 | 42 | </div> |
45 | 43 | <div class="home-featured__list"> |
46 | | - {featured.map((entry) => ( |
47 | | - <FeaturedCard entry={entry} basePath={config.basePath} /> |
| 44 | + {featured.map((lab) => ( |
| 45 | + <LabCard lab={lab} /> |
48 | 46 | ))} |
49 | 47 | </div> |
50 | 48 | </section> |
51 | 49 |
|
52 | | - <section class="home-stats"> |
53 | | - <ul class="home-stats__grid"> |
54 | | - <li><strong>{visible.length}</strong> public projects</li> |
55 | | - <li><strong>{active}</strong> actively maintained</li> |
56 | | - <li><strong>{languages}</strong> languages</li> |
57 | | - </ul> |
| 50 | + <section class="home-learn-more" aria-labelledby="learn-more-heading"> |
| 51 | + <h2 id="learn-more-heading">Learn more</h2> |
| 52 | + <div class="home-learn-more__grid"> |
| 53 | + <article class="home-learn-more__item"> |
| 54 | + <h3>Our open source commitment</h3> |
| 55 | + <p>{hero.learnMore.commitment}</p> |
| 56 | + <p> |
| 57 | + <a href={url('/commitment/', config.basePath)}>Read our commitment →</a> |
| 58 | + </p> |
| 59 | + </article> |
| 60 | + <article class="home-learn-more__item"> |
| 61 | + <h3>About Flexion</h3> |
| 62 | + <p>{hero.learnMore.about}</p> |
| 63 | + <p> |
| 64 | + <a href={url('/about/', config.basePath)}>Learn about Flexion →</a> |
| 65 | + </p> |
| 66 | + </article> |
| 67 | + </div> |
58 | 68 | </section> |
59 | 69 | </Layout> |
60 | 70 | ) |
|
0 commit comments