| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import { Mail, MapPin, MessageCircle, Phone } from 'lucide-react';
- import type { ReactNode } from 'react';
- import { cn } from '@/lib/utils';
- import type { ContactSection } from '../types';
- import { Container, SectionHeading } from '../ui';
-
- function Row({
- icon,
- href,
- children,
- }: {
- icon: ReactNode;
- href?: string;
- children: ReactNode;
- }) {
- const body = (
- <>
- <span className="flex size-9 shrink-0 items-center justify-center rounded-full bg-(--sf-surface) text-(--sf-primary)">
- {icon}
- </span>
- {children}
- </>
- );
-
- return (
- <li>
- {href ? (
- <a
- href={href}
- className="flex items-center gap-3 hover:underline"
- >
- {body}
- </a>
- ) : (
- <span className="flex items-center gap-3">{body}</span>
- )}
- </li>
- );
- }
-
- export function Contact({ section }: { section: ContactSection }) {
- const { heading, body, email, phone, whatsapp, address } = section.content;
- const card = section.variant === 'card';
-
- return (
- <section id={section.id} className="scroll-mt-20 py-16 md:py-20">
- <Container>
- <div
- className={cn(
- 'grid gap-8 md:grid-cols-2',
- card &&
- 'rounded-(--sf-radius-card) border border-(--sf-border) p-8 sm:p-10',
- )}
- >
- <SectionHeading heading={heading} subheading={body} />
-
- <ul className="space-y-4 text-sm">
- {whatsapp && (
- <Row
- icon={<MessageCircle className="size-4" />}
- href={`https://wa.me/${whatsapp}`}
- >
- Chat on WhatsApp
- </Row>
- )}
- {email && (
- <Row
- icon={<Mail className="size-4" />}
- href={`mailto:${email}`}
- >
- {email}
- </Row>
- )}
- {phone && (
- <Row
- icon={<Phone className="size-4" />}
- href={`tel:${phone.replace(/[^0-9+]/g, '')}`}
- >
- {phone}
- </Row>
- )}
- {address && (
- <Row icon={<MapPin className="size-4" />}>
- {address}
- </Row>
- )}
- </ul>
- </div>
- </Container>
- </section>
- );
- }
|