Form and map
A heading and contact form beside a map (the map shows from lg).
Last updated
---
/**
* Form and map: A heading and contact form beside a map (the map shows from lg).
*
* @block contact
* @order 2
*/
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 MapEmbed from '@/components/apogee/MapEmbed/MapEmbed.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { ContactContent } from '@/components/apogee/sections/_shared/contact.ts'
/** @composable */
interface Props extends ContactContent {
/** 1 when the block opens a page; its items move one level down with it. */
headingLevel?: 1 | 2
}
const {
headingLevel = 2,
eyebrow = 'Contact us',
heading = 'Get in touch',
description = "We'd love to hear from you. Please fill out this form.",
locations = [
{ name: 'Melbourne', address: '100 Flinders Street, Melbourne VIC 3000 AU', lat: -37.8183, lon: 144.9671 },
],
action,
method,
submitLabel = 'Send message',
} = Astro.props
const office = locations?.[0]
---
<Section spacing="large">
<div class="grid gap-16 lg:grid-cols-2">
<div>
<SectionHeader headingLevel={headingLevel} eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} class="mb-12" />
<ContactForm action={action} method={method} submitLabel={submitLabel} />
</div>
{office && <MapEmbed lat={office.lat} lon={office.lon} title={`Map of our ${office.name} office`} class="h-full min-h-[40rem] max-lg:hidden" />}
</div>
</Section>
Show codeHide code
---
/**
* Form and map: A heading and contact form beside a map (the map shows from lg).
*
* @block contact
* @order 2
*/
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 MapEmbed from '@/components/apogee/MapEmbed/MapEmbed.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { ContactContent } from '@/components/apogee/sections/_shared/contact.ts'
/** @composable */
interface Props extends ContactContent {
/** 1 when the block opens a page; its items move one level down with it. */
headingLevel?: 1 | 2
}
const {
headingLevel = 2,
eyebrow = 'Contact us',
heading = 'Get in touch',
description = "We'd love to hear from you. Please fill out this form.",
locations = [
{ name: 'Melbourne', address: '100 Flinders Street, Melbourne VIC 3000 AU', lat: -37.8183, lon: 144.9671 },
],
action,
method,
submitLabel = 'Send message',
} = Astro.props
const office = locations?.[0]
---
<Section spacing="large">
<div class="grid gap-16 lg:grid-cols-2">
<div>
<SectionHeader headingLevel={headingLevel} eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} class="mb-12" />
<ContactForm action={action} method={method} submitLabel={submitLabel} />
</div>
{office && <MapEmbed lat={office.lat} lon={office.lon} title={`Map of our ${office.name} office`} class="h-full min-h-[40rem] max-lg:hidden" />}
</div>
</Section>Add
npx @ava-ui/apogee add contact/form-and-map
This copies the block to src/components/apogee/blocks/contact/ with everything it uses: ContactForm, 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
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.