Icons and map 01 on the brand colour: a heading and three contact methods beside a map.

Last updated

Open block
Show code
---
/**
 * Icons and map 01 brand: Icons and map 01 on the brand colour: a heading and three contact methods beside a map.
 *
 * @block contact
 * @order 35
 */
import { LifeBuoy, Mail, MapPin, MessageCircle, MessagesSquare, Phone } from '@lucide/astro'
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import ContactMethod from '@/components/apogee/ContactMethod/ContactMethod.astro'
import MapEmbed from '@/components/apogee/MapEmbed/MapEmbed.astro'
import FeaturedIcon from '@/components/apogee/FeaturedIcon/FeaturedIcon.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { ContactContent } from '@/components/apogee/sections/_shared/contact.ts'

const icons = { mail: Mail, phone: Phone, 'map-pin': MapPin, 'message-circle': MessageCircle, 'messages-square': MessagesSquare, 'life-buoy': LifeBuoy } as const

/** @composable */
interface Props extends ContactContent {}

const {
  eyebrow = 'Contact us',
  heading = 'Get in touch',
  description = 'Our friendly team would love to hear from you.',
  details = [
    { icon: 'mail', label: 'Email', description: 'Our friendly team is here to help.', value: 'hi@example.com', href: 'mailto:hi@example.com' },
    { icon: 'map-pin', label: 'Office', description: 'Come say hello at our office HQ.', value: '100 Flinders Street, Melbourne VIC 3000 AU', href: '#map' },
    { icon: 'phone', label: 'Phone', description: 'Mon–Fri from 8am to 5pm.', value: '+1 (555) 000-0000', href: 'tel:+15550000000' },
  ],
  locations = [{ name: 'Melbourne', address: '100 Flinders Street, Melbourne VIC 3000 AU', lat: -37.8183, lon: 144.9671 }],
} = Astro.props
const office = locations?.[0]
---

<Section spacing="large" background="primary">
  <SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} background="primary" class="mb-16" />
  <div class="grid gap-16 lg:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]">
    {details && <ul class="list-none p-0 flex flex-col gap-10">
    {details.map((d) => {
      const Icon = icons[d.icon]
      return <li><ContactMethod title={d.label} description={d.description} link={d.href ? { label: d.value, href: d.href } : undefined} inline><FeaturedIcon slot="icon" theme="light" color="primary"><Icon /></FeaturedIcon>{!d.href && <p>{d.value}</p>}</ContactMethod></li>
    })}
  </ul>}
    {office && <MapEmbed lat={office.lat} lon={office.lon} title={`Map of our ${office.name} office`} class="min-h-96" />}
  </div>
</Section>

Add

npx @ava-ui/apogee add contact/icons-and-map-01-brand

This copies the block to src/components/apogee/blocks/contact/ with everything it uses: ContactMethod, FeaturedIcon, MapEmbed, Section, SectionHeader. Every piece of copy is a prop, with the sample copy as its default. Pass yours, or null to hide a part; see copy is props.

Accessibility

  • The heading is an h2 by default, so the block slots into a page under its h1; item titles are one level down.