| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import { cn } from '@/lib/utils';
- import type { AboutSection } from '../types';
- import { Container } from '../ui';
-
- export function About({ section }: { section: AboutSection }) {
- const { heading, body, stats } = section.content;
- const showStats = section.variant === 'with-stats' && stats.length > 0;
-
- // statement: the story as one large statement, with the heading as a small label above it.
- if (section.variant === 'statement') {
- return (
- <section
- id={section.id}
- className="sf-section scroll-mt-20 py-16 md:py-28"
- data-layout="statement"
- >
- <Container className="max-w-5xl">
- <h2 className="text-xs font-semibold tracking-[0.18em] text-(--sf-primary) uppercase">
- {heading}
- </h2>
- <p
- className={cn(
- 'sf-heading mt-6 leading-snug font-medium text-balance whitespace-pre-line',
- // A long story reads better a step smaller.
- body.length > 220
- ? 'text-xl sm:text-2xl md:text-3xl'
- : 'text-2xl sm:text-4xl md:text-5xl md:leading-[1.15]',
- )}
- >
- {body}
- </p>
- {stats.length > 0 && (
- <dl className="mt-12 flex flex-wrap gap-x-14 gap-y-6 border-t border-(--sf-border) pt-8">
- {stats.map((stat) => (
- <div
- key={stat.label}
- className="flex flex-col-reverse gap-1"
- >
- <dt className="text-sm text-(--sf-muted)">
- {stat.label}
- </dt>
- <dd className="sf-heading text-3xl font-semibold text-(--sf-primary)">
- {stat.value}
- </dd>
- </div>
- ))}
- </dl>
- )}
- </Container>
- </section>
- );
- }
-
- return (
- <section
- id={section.id}
- className="sf-section scroll-mt-20 py-16 md:py-24"
- >
- <Container
- className={showStats ? 'grid gap-12 md:grid-cols-2' : ''}
- >
- <div
- className={showStats ? '' : 'mx-auto max-w-2xl text-center'}
- >
- <h2 className="sf-heading text-3xl leading-tight font-semibold text-balance sm:text-4xl">
- {heading}
- </h2>
- <p className="mt-5 text-lg leading-relaxed whitespace-pre-line text-(--sf-muted)">
- {body}
- </p>
- </div>
-
- {showStats && (
- <dl className="sf-card grid content-center gap-px overflow-hidden rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-border) sm:grid-cols-3 md:grid-cols-1">
- {stats.map((stat) => (
- <div
- key={stat.label}
- className="flex flex-col-reverse gap-1 bg-(--sf-bg) p-6"
- >
- <dt className="text-sm text-(--sf-muted)">
- {stat.label}
- </dt>
- <dd className="sf-heading text-3xl font-semibold text-(--sf-primary)">
- {stat.value}
- </dd>
- </div>
- ))}
- </dl>
- )}
- </Container>
- </section>
- );
- }
|