Icons and form brand
Icons and form on the brand colour: a heading and four contact methods beside a form on a page-coloured panel.
Last updated
---
/**
* Icons and form brand: Icons and form on the brand colour: a heading and four contact methods beside a form on a page-coloured panel.
*
* @block contact
* @order 30
*/
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 ContactForm from '@/components/apogee/ContactForm/ContactForm.astro'
import ContactMethod from '@/components/apogee/ContactMethod/ContactMethod.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 = 'Chat to our friendly team',
description = "We'd love to hear from you. Please fill out this form or shoot us an email.",
details = [
{ icon: 'mail', label: 'Email', description: 'Our friendly team is here to help.', value: 'hi@example.com', href: 'mailto:hi@example.com' },
{ icon: 'message-circle', label: 'Live chat', description: 'Our friendly team is here to help.', value: 'Start new chat', href: '#chat' },
{ 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' },
],
action,
method,
submitLabel = 'Send message',
} = Astro.props
---
<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,1.5fr)]">
{details && <ul class="list-none p-0 grid gap-10 sm:grid-cols-2 lg:grid-cols-1">
{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>}
<div class="rounded-2xl bg-page p-6 text-neutral sm:p-8"><ContactForm action={action} method={method} submitLabel={submitLabel} /></div>
</div>
</Section>
Show codeHide code
---
/**
* Icons and form brand: Icons and form on the brand colour: a heading and four contact methods beside a form on a page-coloured panel.
*
* @block contact
* @order 30
*/
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 ContactForm from '@/components/apogee/ContactForm/ContactForm.astro'
import ContactMethod from '@/components/apogee/ContactMethod/ContactMethod.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 = 'Chat to our friendly team',
description = "We'd love to hear from you. Please fill out this form or shoot us an email.",
details = [
{ icon: 'mail', label: 'Email', description: 'Our friendly team is here to help.', value: 'hi@example.com', href: 'mailto:hi@example.com' },
{ icon: 'message-circle', label: 'Live chat', description: 'Our friendly team is here to help.', value: 'Start new chat', href: '#chat' },
{ 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' },
],
action,
method,
submitLabel = 'Send message',
} = Astro.props
---
<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,1.5fr)]">
{details && <ul class="list-none p-0 grid gap-10 sm:grid-cols-2 lg:grid-cols-1">
{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>}
<div class="rounded-2xl bg-page p-6 text-neutral sm:p-8"><ContactForm action={action} method={method} submitLabel={submitLabel} /></div>
</div>
</Section>Add
npx @ava-ui/apogee add contact/icons-and-form-brand
This copies the block to src/components/apogee/blocks/contact/ with everything it uses: ContactForm, ContactMethod, FeaturedIcon, 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
h2by default, so the block slots into a page under itsh1; item titles are one level down.
Related
ContactFormThe message form contact pages share; names, email, an optional phone with a country code, the message, an optional services checklist and a privacy checkbox.
ContactMethodOne way to reach you; an icon, a title, a line about it and the address, number or link, plain or on a card.
MapEmbedAn embedded street map centred on a place, with a marker and a link to the full map; no key, no script.
WorldMapA dotted world map with office pins; each pin names its place on hover or focus and links to it on a full map.