@sinnstack/ui 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -0
- package/LICENSE +373 -0
- package/README.md +188 -2
- package/docs/blocks.md +373 -0
- package/docs/data.md +128 -0
- package/docs/finishes.md +165 -0
- package/docs/motion.md +166 -0
- package/docs/primitives.md +510 -0
- package/docs/seo.md +191 -0
- package/docs/tokens.md +122 -0
- package/package.json +132 -3
- package/scripts/check-contrast.mjs +180 -0
- package/src/blocks/BlockRenderer.astro +60 -0
- package/src/blocks/CTABanner.astro +121 -0
- package/src/blocks/CTAPair.astro +110 -0
- package/src/blocks/CardGrid.astro +167 -0
- package/src/blocks/ConsentEmbed.astro +125 -0
- package/src/blocks/ConsentManager.astro +147 -0
- package/src/blocks/ConsentScript.astro +47 -0
- package/src/blocks/ContactCard.astro +164 -0
- package/src/blocks/ContactForm.astro +224 -0
- package/src/blocks/ErrorPage.astro +242 -0
- package/src/blocks/FAQ.astro +135 -0
- package/src/blocks/FeatureGrid.astro +148 -0
- package/src/blocks/Hero.astro +171 -0
- package/src/blocks/HeroCarousel.astro +220 -0
- package/src/blocks/HighlightCards.astro +107 -0
- package/src/blocks/LocationHours.astro +311 -0
- package/src/blocks/LogoCloud.astro +135 -0
- package/src/blocks/MaintenancePage.astro +173 -0
- package/src/blocks/MediaText.astro +177 -0
- package/src/blocks/PageHeader.astro +126 -0
- package/src/blocks/ProseSection.astro +98 -0
- package/src/blocks/Reviews.astro +194 -0
- package/src/blocks/RichText.astro +58 -0
- package/src/blocks/StatsBand.astro +117 -0
- package/src/blocks/Steps.astro +141 -0
- package/src/blocks/Testimonials.astro +144 -0
- package/src/blocks/Topbar.astro +158 -0
- package/src/blocks/cms/card-grid.ts +48 -0
- package/src/blocks/cms/consent.ts +16 -0
- package/src/blocks/cms/contact-card.ts +46 -0
- package/src/blocks/cms/contact-form.ts +37 -0
- package/src/blocks/cms/cta-banner.ts +27 -0
- package/src/blocks/cms/cta-pair.ts +30 -0
- package/src/blocks/cms/data-base.ts +5 -0
- package/src/blocks/cms/data.ts +257 -0
- package/src/blocks/cms/faq.ts +38 -0
- package/src/blocks/cms/feature-grid.ts +47 -0
- package/src/blocks/cms/fixtures.ts +591 -0
- package/src/blocks/cms/hero-carousel.ts +36 -0
- package/src/blocks/cms/hero.ts +33 -0
- package/src/blocks/cms/highlight-cards.ts +41 -0
- package/src/blocks/cms/images.ts +37 -0
- package/src/blocks/cms/index.ts +59 -0
- package/src/blocks/cms/location-hours.ts +67 -0
- package/src/blocks/cms/logo-cloud.ts +36 -0
- package/src/blocks/cms/media-text.ts +26 -0
- package/src/blocks/cms/page-header.ts +27 -0
- package/src/blocks/cms/pages.ts +35 -0
- package/src/blocks/cms/prose-section.ts +25 -0
- package/src/blocks/cms/reviews.ts +50 -0
- package/src/blocks/cms/schema-dsl.ts +134 -0
- package/src/blocks/cms/schema.ts +794 -0
- package/src/blocks/cms/shared.ts +63 -0
- package/src/blocks/cms/stats-band.ts +35 -0
- package/src/blocks/cms/steps.ts +40 -0
- package/src/blocks/cms/testimonials.ts +46 -0
- package/src/blocks/cms/topbar.ts +27 -0
- package/src/blocks/cms/types.ts +27 -0
- package/src/blocks/consent.ts +14 -0
- package/src/blocks/icons.ts +47 -0
- package/src/blocks/index.ts +42 -0
- package/src/blocks/internal/Actions.astro +35 -0
- package/src/blocks/internal/BlockHeader.astro +45 -0
- package/src/blocks/internal/BlockShell.astro +58 -0
- package/src/blocks/internal/CarouselScript.astro +7 -0
- package/src/blocks/internal/ConsentEmbedScript.astro +7 -0
- package/src/blocks/internal/ConsentManagerScript.astro +7 -0
- package/src/blocks/internal/HoursScript.astro +7 -0
- package/src/blocks/internal/Placeholder.astro +13 -0
- package/src/blocks/internal/RichTextNode.astro +133 -0
- package/src/blocks/internal/StandaloneDocument.astro +53 -0
- package/src/blocks/internal/consent.ts +96 -0
- package/src/blocks/internal/fields.ts +18 -0
- package/src/blocks/internal/registry-contract.ts +67 -0
- package/src/blocks/internal/reviews.ts +22 -0
- package/src/blocks/internal/slug.ts +12 -0
- package/src/blocks/internal/util.ts +23 -0
- package/src/blocks/lib/contact.ts +92 -0
- package/src/blocks/lib/error-pages.ts +119 -0
- package/src/blocks/lib/faq.ts +37 -0
- package/src/blocks/lib/hours.ts +201 -0
- package/src/blocks/lib/maintenance.ts +129 -0
- package/src/blocks/lib/markdown.ts +350 -0
- package/src/blocks/lib/rich-text.ts +132 -0
- package/src/blocks/registry.ts +79 -0
- package/src/blocks/scripts/carousel.ts +218 -0
- package/src/blocks/scripts/consent-embed.ts +105 -0
- package/src/blocks/scripts/consent-manager.ts +112 -0
- package/src/blocks/scripts/consent-store.ts +86 -0
- package/src/blocks/scripts/error-page.ts +71 -0
- package/src/blocks/scripts/hours.ts +107 -0
- package/src/blocks/scripts/maintenance.ts +109 -0
- package/src/blocks/styles/blocks.css +1320 -0
- package/src/blocks/styles/consent.css +102 -0
- package/src/blocks/styles/faq.css +28 -0
- package/src/blocks/styles/location.css +92 -0
- package/src/blocks/styles/prose-section.css +13 -0
- package/src/blocks/styles/quotes.css +123 -0
- package/src/blocks/styles/rich-text.css +14 -0
- package/src/blocks/types.ts +293 -0
- package/src/data/ChartAxis.astro +19 -0
- package/src/data/ChartContainer.astro +152 -0
- package/src/data/ChartLegend.astro +25 -0
- package/src/data/ChartSeries.astro +14 -0
- package/src/data/ChartTable.astro +17 -0
- package/src/data/ChartTooltip.astro +20 -0
- package/src/data/Sparkline.astro +55 -0
- package/src/data/cms.ts +130 -0
- package/src/data/index.ts +10 -0
- package/src/data/internal/scale.ts +107 -0
- package/src/data/lib/chart.ts +459 -0
- package/src/data/lib/render.ts +219 -0
- package/src/data/lib/sparkline.ts +117 -0
- package/src/data/schema.ts +65 -0
- package/src/data/scripts/chart.ts +324 -0
- package/src/data/styles/chart.css +392 -0
- package/src/finishes/aurora.css +75 -0
- package/src/finishes/autumn.css +87 -0
- package/src/finishes/blueprint.css +69 -0
- package/src/finishes/brutalist.css +55 -0
- package/src/finishes/clay.css +48 -0
- package/src/finishes/day-cycle.css +46 -0
- package/src/finishes/fog.css +71 -0
- package/src/finishes/glass.css +149 -0
- package/src/finishes/holographic.css +91 -0
- package/src/finishes/night.css +77 -0
- package/src/finishes/paper.css +58 -0
- package/src/finishes/polished-glass.css +159 -0
- package/src/finishes/rain.css +84 -0
- package/src/finishes/scripts/day-cycle.ts +30 -0
- package/src/finishes/scripts/holographic.ts +37 -0
- package/src/finishes/scripts/spotlight.ts +30 -0
- package/src/finishes/spotlight.css +41 -0
- package/src/finishes/spring.css +80 -0
- package/src/finishes/terminal.css +49 -0
- package/src/motion/Marquee.astro +90 -0
- package/src/motion/MotionProvider.astro +50 -0
- package/src/motion/PageTransitions.astro +61 -0
- package/src/motion/Parallax.astro +44 -0
- package/src/motion/ParallaxLayer.astro +31 -0
- package/src/motion/RevealOnScroll.astro +59 -0
- package/src/motion/SceneRegistry.astro +38 -0
- package/src/motion/ScrollScene.astro +81 -0
- package/src/motion/index.ts +12 -0
- package/src/motion/integration.ts +48 -0
- package/src/motion/runtime/page-transitions.ts +68 -0
- package/src/motion/runtime/runtime.ts +180 -0
- package/src/motion/runtime/scenes.ts +248 -0
- package/src/motion/runtime/types.ts +103 -0
- package/src/motion/styles/motion.css +332 -0
- package/src/motion/transitions.ts +74 -0
- package/src/motion/virtual.d.ts +4 -0
- package/src/primitives/Accordion.astro +129 -0
- package/src/primitives/Breadcrumbs.astro +50 -0
- package/src/primitives/BulletList.astro +69 -0
- package/src/primitives/Button.astro +73 -0
- package/src/primitives/ButtonGroup.astro +54 -0
- package/src/primitives/Callout.astro +137 -0
- package/src/primitives/Caption.astro +35 -0
- package/src/primitives/Card.astro +72 -0
- package/src/primitives/CardContent.astro +24 -0
- package/src/primitives/CardFooter.astro +36 -0
- package/src/primitives/CardHeader.astro +86 -0
- package/src/primitives/Checkbox.astro +38 -0
- package/src/primitives/ChoiceGroup.astro +23 -0
- package/src/primitives/Cluster.astro +49 -0
- package/src/primitives/Container.astro +44 -0
- package/src/primitives/DescriptionList.astro +83 -0
- package/src/primitives/Dialog.astro +38 -0
- package/src/primitives/Disclosure.astro +67 -0
- package/src/primitives/Divider.astro +93 -0
- package/src/primitives/Drawer.astro +33 -0
- package/src/primitives/Fieldset.astro +80 -0
- package/src/primitives/Flex.astro +64 -0
- package/src/primitives/FocusRing.astro +63 -0
- package/src/primitives/FocusTrap.astro +64 -0
- package/src/primitives/Footer.astro +155 -0
- package/src/primitives/Form.astro +68 -0
- package/src/primitives/FormDescription.astro +26 -0
- package/src/primitives/FormError.astro +106 -0
- package/src/primitives/FormField.astro +72 -0
- package/src/primitives/Grid.astro +64 -0
- package/src/primitives/Heading.astro +45 -0
- package/src/primitives/IconButton.astro +48 -0
- package/src/primitives/Image.astro +125 -0
- package/src/primitives/Input.astro +86 -0
- package/src/primitives/Label.astro +50 -0
- package/src/primitives/Link.astro +81 -0
- package/src/primitives/LinkButton.astro +66 -0
- package/src/primitives/List.astro +39 -0
- package/src/primitives/ListItem.astro +178 -0
- package/src/primitives/MediaObject.astro +66 -0
- package/src/primitives/MetricCard.astro +278 -0
- package/src/primitives/NavLink.astro +81 -0
- package/src/primitives/NavMenu.astro +109 -0
- package/src/primitives/Navbar.astro +197 -0
- package/src/primitives/Panel.astro +153 -0
- package/src/primitives/Picture.astro +167 -0
- package/src/primitives/Popover.astro +95 -0
- package/src/primitives/Prose.astro +45 -0
- package/src/primitives/Radio.astro +21 -0
- package/src/primitives/Rating.astro +135 -0
- package/src/primitives/ReducedMotion.astro +90 -0
- package/src/primitives/SegmentedControl.astro +132 -0
- package/src/primitives/Select.astro +109 -0
- package/src/primitives/Sheet.astro +45 -0
- package/src/primitives/SkipLink.astro +31 -0
- package/src/primitives/Slider.astro +186 -0
- package/src/primitives/Spacer.astro +35 -0
- package/src/primitives/Stack.astro +51 -0
- package/src/primitives/Surface.astro +70 -0
- package/src/primitives/Switch.astro +22 -0
- package/src/primitives/Table.astro +382 -0
- package/src/primitives/Tabs.astro +126 -0
- package/src/primitives/Text.astro +56 -0
- package/src/primitives/Textarea.astro +75 -0
- package/src/primitives/Thumbnail.astro +154 -0
- package/src/primitives/Toggle.astro +99 -0
- package/src/primitives/Tooltip.astro +50 -0
- package/src/primitives/VisuallyHidden.astro +29 -0
- package/src/primitives/index.ts +103 -0
- package/src/primitives/internal/AccordionScript.astro +7 -0
- package/src/primitives/internal/ChoiceField.astro +91 -0
- package/src/primitives/internal/FocusTrapScript.astro +8 -0
- package/src/primitives/internal/FormValidationScript.astro +10 -0
- package/src/primitives/internal/IndeterminateScript.astro +13 -0
- package/src/primitives/internal/ModalPanel.astro +114 -0
- package/src/primitives/internal/OverlayScript.astro +7 -0
- package/src/primitives/internal/ReducedMotionScript.astro +7 -0
- package/src/primitives/internal/SliderScript.astro +7 -0
- package/src/primitives/internal/SparklineScript.astro +7 -0
- package/src/primitives/internal/TableSortScript.astro +7 -0
- package/src/primitives/internal/TabsScript.astro +7 -0
- package/src/primitives/internal/TooltipScript.astro +7 -0
- package/src/primitives/internal/image-plan.ts +82 -0
- package/src/primitives/internal/image.ts +129 -0
- package/src/primitives/internal/slider.ts +170 -0
- package/src/primitives/lib/deprecate.ts +47 -0
- package/src/primitives/lib/focus-trap.ts +197 -0
- package/src/primitives/lib/focus.ts +60 -0
- package/src/primitives/lib/motion.ts +68 -0
- package/src/primitives/scripts/accordion.ts +123 -0
- package/src/primitives/scripts/form-validation.ts +225 -0
- package/src/primitives/scripts/overlay.ts +71 -0
- package/src/primitives/scripts/reduced-motion.ts +59 -0
- package/src/primitives/scripts/slider.ts +150 -0
- package/src/primitives/scripts/sparkline.ts +131 -0
- package/src/primitives/scripts/table-sort.ts +68 -0
- package/src/primitives/scripts/tabs.ts +151 -0
- package/src/primitives/scripts/tooltip.ts +28 -0
- package/src/primitives/styles/a11y.css +104 -0
- package/src/primitives/styles/accordion.css +53 -0
- package/src/primitives/styles/breadcrumbs.css +59 -0
- package/src/primitives/styles/bullet-list.css +89 -0
- package/src/primitives/styles/button.css +237 -0
- package/src/primitives/styles/choice.css +164 -0
- package/src/primitives/styles/cluster.css +24 -0
- package/src/primitives/styles/container.css +19 -0
- package/src/primitives/styles/data.css +849 -0
- package/src/primitives/styles/disclosure.css +140 -0
- package/src/primitives/styles/divider.css +50 -0
- package/src/primitives/styles/flex.css +42 -0
- package/src/primitives/styles/form.css +241 -0
- package/src/primitives/styles/grid.css +36 -0
- package/src/primitives/styles/media.css +247 -0
- package/src/primitives/styles/nav.css +792 -0
- package/src/primitives/styles/overlay.css +362 -0
- package/src/primitives/styles/prose.css +146 -0
- package/src/primitives/styles/scale.css +175 -0
- package/src/primitives/styles/segmented.css +165 -0
- package/src/primitives/styles/slider.css +170 -0
- package/src/primitives/styles/spacer.css +17 -0
- package/src/primitives/styles/stack.css +25 -0
- package/src/primitives/styles/surface.css +403 -0
- package/src/primitives/styles/tabs.css +223 -0
- package/src/primitives/styles/typography.css +144 -0
- package/src/primitives/styles/utilities.css +24 -0
- package/src/primitives/types.ts +385 -0
- package/src/primitives/utils.ts +254 -0
- package/src/seo/JSONLD.astro +35 -0
- package/src/seo/SEOHead.astro +47 -0
- package/src/seo/cms.ts +59 -0
- package/src/seo/index.ts +10 -0
- package/src/seo/integration.ts +268 -0
- package/src/seo/internal/url.ts +68 -0
- package/src/seo/lib/jsonld.ts +342 -0
- package/src/seo/lib/meta.ts +205 -0
- package/src/seo/lib/redirects.ts +293 -0
- package/src/seo/lib/robots.ts +33 -0
- package/src/seo/lib/rss.ts +98 -0
- package/src/seo/lib/sitemap.ts +105 -0
- package/src/seo/schema.ts +43 -0
- package/src/tokens/base.css +71 -0
- package/src/tokens/tokens.css +210 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* LocationHours: where to find you and when you're open. Address, phone and email, a
|
|
4
|
+
* directions link, regular and holiday hours with "Open now", and a map that loads only after
|
|
5
|
+
* consent.
|
|
6
|
+
*
|
|
7
|
+
* - **Hours** are grouped ("Mon–Fri 8:00 AM – 5:00 PM", "Sat–Sun Closed") and formatted for
|
|
8
|
+
* `locale`. Days are read in full by screen readers ("Monday to Friday"). Days no row mentions
|
|
9
|
+
* are closed. A range that ends at or before it starts runs past midnight; 00:00–24:00 is
|
|
10
|
+
* open all day.
|
|
11
|
+
* - **Open now** is worked out in the browser in the business's `timeZone` (not the visitor's),
|
|
12
|
+
* with today's row marked; it's re-checked every minute. Without JavaScript, or without
|
|
13
|
+
* `timeZone`, the status line is left out rather than guessed at build time.
|
|
14
|
+
* - **Holiday hours** (`special`) override the regular hours on their date; past dates hide.
|
|
15
|
+
* - **Map**: `map="embed"` (default) shows a Google Maps embed through ConsentEmbed (category
|
|
16
|
+
* `media`), so Google gets nothing until the visitor allows it; `map="link"` shows only the
|
|
17
|
+
* links; `"none"` neither. Directions and "Open in Google Maps" are plain links.
|
|
18
|
+
* - **Structured data:** `locationStructuredData(props)` gives the address, phone and hours in
|
|
19
|
+
* the shape `localBusiness()` from `@sinnstack/ui/seo/jsonld` takes.
|
|
20
|
+
* - Placeholder: no address and no hours → dashed placeholder in dev/CMS preview.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <LocationHours heading="Visit the studio" name="Sinnstack" timeZone="America/Chicago"
|
|
24
|
+
* address={{ street: '500 Main St', street2: 'Suite 210', city: 'Fort Worth', region: 'TX', postalCode: '76102' }}
|
|
25
|
+
* phone="(817) 555-0100" email="hello@sinnstack.com"
|
|
26
|
+
* hours={[{ days: ['Mo', 'Tu', 'We', 'Th', 'Fr'], opens: '09:00', closes: '17:00' }]}
|
|
27
|
+
* special={[{ date: '2026-12-25', label: 'Christmas Day', closed: true }]} />
|
|
28
|
+
*/
|
|
29
|
+
import Heading from '../primitives/Heading.astro';
|
|
30
|
+
import Link from '../primitives/Link.astro';
|
|
31
|
+
import LinkButton from '../primitives/LinkButton.astro';
|
|
32
|
+
import Text from '../primitives/Text.astro';
|
|
33
|
+
import VisuallyHidden from '../primitives/VisuallyHidden.astro';
|
|
34
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
35
|
+
import type { BlockProps, HeadingLevel, HoursRow, ImageSource, PostalAddress, SpecialHours } from './types';
|
|
36
|
+
import BlockShell from './internal/BlockShell.astro';
|
|
37
|
+
import BlockHeader from './internal/BlockHeader.astro';
|
|
38
|
+
import Placeholder from './internal/Placeholder.astro';
|
|
39
|
+
import HoursScript from './internal/HoursScript.astro';
|
|
40
|
+
import ConsentEmbed from './ConsentEmbed.astro';
|
|
41
|
+
import { mailHref, telHref } from './lib/contact';
|
|
42
|
+
import { addressLine, dayRangeLabel, directionsHref, formatHours, groupWeek, mapEmbedSrc, mapSearchHref, parseTime, weekHours } from './lib/hours';
|
|
43
|
+
import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
|
|
44
|
+
import { sf, joinField } from './internal/fields';
|
|
45
|
+
import './styles/blocks.css';
|
|
46
|
+
import './styles/location.css';
|
|
47
|
+
|
|
48
|
+
type Props = Omit<HTMLAttributes<'section'>, 'title'> &
|
|
49
|
+
BlockProps & {
|
|
50
|
+
eyebrow?: string;
|
|
51
|
+
heading?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
headingLevel?: HeadingLevel;
|
|
54
|
+
/** Heading level of "Address", "Hours"… Default: one below the section heading. */
|
|
55
|
+
itemTitleLevel?: Exclude<HeadingLevel, 1>;
|
|
56
|
+
/** Business or location name, shown with the address. */
|
|
57
|
+
name?: string;
|
|
58
|
+
address?: PostalAddress;
|
|
59
|
+
phone?: string;
|
|
60
|
+
email?: string;
|
|
61
|
+
hours?: HoursRow[];
|
|
62
|
+
special?: SpecialHours[];
|
|
63
|
+
/** A short note under the hours ("Visits by appointment"). */
|
|
64
|
+
hoursNote?: string;
|
|
65
|
+
/** IANA time zone of the location ("America/Chicago"), for "Open now". */
|
|
66
|
+
timeZone?: string;
|
|
67
|
+
/** `embed` (consent-gated map), `link` (links only) or `none`. */
|
|
68
|
+
map?: 'embed' | 'link' | 'none';
|
|
69
|
+
/** Your own embed URL (e.g. Google Maps → Share → Embed a map). Default: built from the address. */
|
|
70
|
+
mapEmbedUrl?: string;
|
|
71
|
+
mapProvider?: string;
|
|
72
|
+
/** A local still of the map, shown behind the consent notice. */
|
|
73
|
+
mapPoster?: ImageSource;
|
|
74
|
+
/** `split` (details beside the map when there's room) or `stacked`. */
|
|
75
|
+
layout?: 'split' | 'stacked';
|
|
76
|
+
locale?: string;
|
|
77
|
+
/** Phone numbers' default country calling code. */
|
|
78
|
+
countryCode?: string;
|
|
79
|
+
/** UI text; `{time}`, `{day}` and `{provider}` are replaced. Translate per site. */
|
|
80
|
+
labels?: Partial<{
|
|
81
|
+
address: string;
|
|
82
|
+
hours: string;
|
|
83
|
+
special: string;
|
|
84
|
+
phone: string;
|
|
85
|
+
email: string;
|
|
86
|
+
directions: string;
|
|
87
|
+
openMap: string;
|
|
88
|
+
closed: string;
|
|
89
|
+
allDay: string;
|
|
90
|
+
today: string;
|
|
91
|
+
to: string;
|
|
92
|
+
openNow: string;
|
|
93
|
+
closedNow: string;
|
|
94
|
+
openAllDay: string;
|
|
95
|
+
closes: string;
|
|
96
|
+
closesTomorrow: string;
|
|
97
|
+
opensToday: string;
|
|
98
|
+
opensTomorrow: string;
|
|
99
|
+
opensDay: string;
|
|
100
|
+
mapTitle: string;
|
|
101
|
+
}>;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const {
|
|
105
|
+
eyebrow,
|
|
106
|
+
heading,
|
|
107
|
+
description,
|
|
108
|
+
headingLevel = 2,
|
|
109
|
+
itemTitleLevel,
|
|
110
|
+
name,
|
|
111
|
+
address,
|
|
112
|
+
phone,
|
|
113
|
+
email,
|
|
114
|
+
hours = [],
|
|
115
|
+
special = [],
|
|
116
|
+
hoursNote,
|
|
117
|
+
timeZone,
|
|
118
|
+
map = 'embed',
|
|
119
|
+
mapEmbedUrl,
|
|
120
|
+
mapProvider = 'Google Maps',
|
|
121
|
+
mapPoster,
|
|
122
|
+
layout = 'split',
|
|
123
|
+
locale = 'en-US',
|
|
124
|
+
countryCode = '1',
|
|
125
|
+
labels = {},
|
|
126
|
+
align = 'start',
|
|
127
|
+
anchor,
|
|
128
|
+
spacing = 'l',
|
|
129
|
+
background = 'none',
|
|
130
|
+
tone = 'accent',
|
|
131
|
+
scheme,
|
|
132
|
+
containerSize = 'default',
|
|
133
|
+
placeholder = PLACEHOLDER_DEFAULT,
|
|
134
|
+
fieldPath,
|
|
135
|
+
id,
|
|
136
|
+
class: className,
|
|
137
|
+
...rest
|
|
138
|
+
} = Astro.props;
|
|
139
|
+
|
|
140
|
+
const L = {
|
|
141
|
+
address: 'Address',
|
|
142
|
+
hours: 'Hours',
|
|
143
|
+
special: 'Holiday hours',
|
|
144
|
+
phone: 'Phone',
|
|
145
|
+
email: 'Email',
|
|
146
|
+
directions: 'Get directions',
|
|
147
|
+
openMap: 'Open in {provider}',
|
|
148
|
+
closed: 'Closed',
|
|
149
|
+
allDay: 'Open 24 hours',
|
|
150
|
+
today: 'Today',
|
|
151
|
+
to: 'to',
|
|
152
|
+
openNow: 'Open now',
|
|
153
|
+
closedNow: 'Closed now',
|
|
154
|
+
openAllDay: 'Open 24 hours',
|
|
155
|
+
closes: 'Closes {time}',
|
|
156
|
+
closesTomorrow: 'Closes {time} tomorrow',
|
|
157
|
+
opensToday: 'Opens {time}',
|
|
158
|
+
opensTomorrow: 'Opens {time} tomorrow',
|
|
159
|
+
opensDay: 'Opens {day} {time}',
|
|
160
|
+
mapTitle: 'Map of {place}',
|
|
161
|
+
...labels,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const hasAddress = Boolean(address?.street?.trim() && address?.city?.trim());
|
|
165
|
+
const groups = groupWeek(weekHours(hours));
|
|
166
|
+
const hasHours = groups.some((g) => !g.hours.closed);
|
|
167
|
+
const specials = (special ?? [])
|
|
168
|
+
.filter((s) => s && /^\d{4}-\d{2}-\d{2}$/.test(s.date ?? ''))
|
|
169
|
+
.sort((a, b) => a.date.localeCompare(b.date))
|
|
170
|
+
.map((s) => ({
|
|
171
|
+
...s,
|
|
172
|
+
dateText: new Intl.DateTimeFormat(locale, { weekday: 'short', month: 'short', day: 'numeric', timeZone: 'UTC' }).format(new Date(`${s.date}T00:00:00Z`)),
|
|
173
|
+
hoursText: s.closed || parseTime(s.opens) === undefined || parseTime(s.closes) === undefined ? L.closed : formatHours({ closed: false, opens: s.opens, closes: s.closes }, locale, { closed: L.closed, allDay: L.allDay }),
|
|
174
|
+
}));
|
|
175
|
+
const tel = phone ? telHref(phone, countryCode) : undefined;
|
|
176
|
+
const mail = email ? mailHref(email) : undefined;
|
|
177
|
+
const { sectionId, headingId } = blockIds('location', anchor, id);
|
|
178
|
+
const hasHeading = Boolean(heading?.trim());
|
|
179
|
+
const subLevel = (itemTitleLevel ?? Math.min(6, (hasHeading ? headingLevel : 1) + 1)) as Exclude<HeadingLevel, 1>;
|
|
180
|
+
const showMap = map === 'embed' && hasAddress;
|
|
181
|
+
const place = name?.trim() || (address ? addressLine(address) : '');
|
|
182
|
+
const statusLabels = JSON.stringify({
|
|
183
|
+
openNow: L.openNow,
|
|
184
|
+
closed: L.closedNow,
|
|
185
|
+
openAllDay: L.openAllDay,
|
|
186
|
+
closes: L.closes,
|
|
187
|
+
closesTomorrow: L.closesTomorrow,
|
|
188
|
+
opensToday: L.opensToday,
|
|
189
|
+
opensTomorrow: L.opensTomorrow,
|
|
190
|
+
opensDay: L.opensDay,
|
|
191
|
+
});
|
|
192
|
+
const hoursData = JSON.stringify((hours ?? []).map(({ days, opens, closes, closed }) => ({ days, opens, closes, closed })));
|
|
193
|
+
const specialData = JSON.stringify(specials.map(({ date, opens, closes, closed }) => ({ date, opens, closes, closed })));
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
{
|
|
197
|
+
!hasAddress && !hasHours ? (
|
|
198
|
+
placeholder && <Placeholder label="Location and hours" hint="Add an address or opening hours." field={joinField(fieldPath, 'address')} />
|
|
199
|
+
) : (
|
|
200
|
+
<BlockShell
|
|
201
|
+
name="location"
|
|
202
|
+
id={sectionId}
|
|
203
|
+
class={className}
|
|
204
|
+
spacing={spacing}
|
|
205
|
+
background={background}
|
|
206
|
+
tone={tone}
|
|
207
|
+
scheme={scheme}
|
|
208
|
+
containerSize={containerSize}
|
|
209
|
+
labelledby={hasHeading ? headingId : undefined}
|
|
210
|
+
align={align}
|
|
211
|
+
data-layout={showMap ? layout : 'stacked'}
|
|
212
|
+
{...sf(fieldPath)}
|
|
213
|
+
{...rest}
|
|
214
|
+
>
|
|
215
|
+
<BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description} fieldPath={fieldPath} />
|
|
216
|
+
<div class="sinn-location__inner">
|
|
217
|
+
<div class="sinn-location__details" data-sinn-hours={hasHours ? '' : undefined} data-tz={timeZone} data-locale={locale} data-hours={hasHours ? hoursData : undefined} data-special={specials.length ? specialData : undefined}>
|
|
218
|
+
{hasAddress && address && (
|
|
219
|
+
<div class="sinn-location__group">
|
|
220
|
+
<Heading level={subLevel} size="s" weight="semibold" class="sinn-location__label">{L.address}</Heading>
|
|
221
|
+
<address class="sinn-location__address" {...sf(fieldPath, 'address')}>
|
|
222
|
+
{name?.trim() && <span class="sinn-location__name" {...sf(fieldPath, 'name')}>{name}</span>}
|
|
223
|
+
<span>{address.street}</span>
|
|
224
|
+
{address.street2?.trim() && <span>{address.street2}</span>}
|
|
225
|
+
<span>{`${address.city}, ${address.region} ${address.postalCode}`.trim()}</span>
|
|
226
|
+
{address.country && address.country !== 'US' && <span>{address.country}</span>}
|
|
227
|
+
</address>
|
|
228
|
+
{(tel || mail) && (
|
|
229
|
+
<dl class="sinn-location__contact">
|
|
230
|
+
{tel && phone && (
|
|
231
|
+
<div>
|
|
232
|
+
<dt>{L.phone}</dt>
|
|
233
|
+
<dd><Link href={tel} {...sf(fieldPath, 'phone')}>{phone}</Link></dd>
|
|
234
|
+
</div>
|
|
235
|
+
)}
|
|
236
|
+
{mail && email && (
|
|
237
|
+
<div>
|
|
238
|
+
<dt>{L.email}</dt>
|
|
239
|
+
<dd><Link href={mail} {...sf(fieldPath, 'email')}>{email}</Link></dd>
|
|
240
|
+
</div>
|
|
241
|
+
)}
|
|
242
|
+
</dl>
|
|
243
|
+
)}
|
|
244
|
+
{map !== 'none' && (
|
|
245
|
+
<div class="sinn-location__links">
|
|
246
|
+
<LinkButton href={directionsHref(address)} variant="outline" size="m" rel="noopener">
|
|
247
|
+
{L.directions}
|
|
248
|
+
<VisuallyHidden>{` (${mapProvider})`}</VisuallyHidden>
|
|
249
|
+
</LinkButton>
|
|
250
|
+
{map === 'link' && <Link href={mapSearchHref(address)} external>{L.openMap.replace('{provider}', () => mapProvider)}</Link>}
|
|
251
|
+
</div>
|
|
252
|
+
)}
|
|
253
|
+
</div>
|
|
254
|
+
)}
|
|
255
|
+
{hasHours && (
|
|
256
|
+
<div class="sinn-location__group">
|
|
257
|
+
<Heading level={subLevel} size="s" weight="semibold" class="sinn-location__label">{L.hours}</Heading>
|
|
258
|
+
<p class="sinn-hours__status" data-hours-status data-labels={statusLabels} hidden>
|
|
259
|
+
<span class="sinn-hours__dot" aria-hidden="true"></span>
|
|
260
|
+
<span class="sinn-hours__state" data-hours-state></span>
|
|
261
|
+
<span class="sinn-sr-only">, </span>
|
|
262
|
+
<span class="sinn-hours__detail" data-hours-detail></span>
|
|
263
|
+
</p>
|
|
264
|
+
<dl class="sinn-hours" {...sf(fieldPath, 'hours')}>
|
|
265
|
+
{groups.map((g) => (
|
|
266
|
+
<div class="sinn-hours__row" data-hours-days={g.days.join(' ')}>
|
|
267
|
+
<dt>
|
|
268
|
+
<span aria-hidden="true">{dayRangeLabel(g.days, locale, 'short')}</span>
|
|
269
|
+
<VisuallyHidden>{dayRangeLabel(g.days, locale, 'long', L.to)}</VisuallyHidden>
|
|
270
|
+
<span class="sinn-hours__today" data-hours-today hidden>{L.today}</span>
|
|
271
|
+
</dt>
|
|
272
|
+
<dd data-closed={g.hours.closed ? '' : undefined}>{formatHours(g.hours, locale, { closed: L.closed, allDay: L.allDay })}</dd>
|
|
273
|
+
</div>
|
|
274
|
+
))}
|
|
275
|
+
</dl>
|
|
276
|
+
{hoursNote?.trim() && <Text size="s" tone="muted" class="sinn-hours__note" {...sf(fieldPath, 'hoursNote')}>{hoursNote}</Text>}
|
|
277
|
+
{specials.length > 0 && (
|
|
278
|
+
<div class="sinn-hours__special" data-hours-special>
|
|
279
|
+
<Heading level={Math.min(6, subLevel + 1) as Exclude<HeadingLevel, 1>} size="xs" weight="semibold" class="sinn-location__label">{L.special}</Heading>
|
|
280
|
+
<dl class="sinn-hours" {...sf(fieldPath, 'special')}>
|
|
281
|
+
{specials.map((s) => (
|
|
282
|
+
<div class="sinn-hours__row" data-hours-date={s.date}>
|
|
283
|
+
<dt><time datetime={s.date}>{s.dateText}</time>{s.label?.trim() && <span class="sinn-hours__label">{` · ${s.label.trim()}`}</span>}</dt>
|
|
284
|
+
<dd data-closed={s.hoursText === L.closed ? '' : undefined}>{s.hoursText}</dd>
|
|
285
|
+
</div>
|
|
286
|
+
))}
|
|
287
|
+
</dl>
|
|
288
|
+
</div>
|
|
289
|
+
)}
|
|
290
|
+
</div>
|
|
291
|
+
)}
|
|
292
|
+
</div>
|
|
293
|
+
{showMap && address && (
|
|
294
|
+
<div class="sinn-location__map">
|
|
295
|
+
<ConsentEmbed
|
|
296
|
+
src={mapEmbedUrl ?? mapEmbedSrc(address)}
|
|
297
|
+
title={L.mapTitle.replace('{place}', () => place)}
|
|
298
|
+
provider={mapProvider}
|
|
299
|
+
kind="map"
|
|
300
|
+
aspect="4/3"
|
|
301
|
+
fallbackHref={mapSearchHref(address)}
|
|
302
|
+
poster={mapPoster}
|
|
303
|
+
labels={{ open: L.openMap }}
|
|
304
|
+
/>
|
|
305
|
+
</div>
|
|
306
|
+
)}
|
|
307
|
+
</div>
|
|
308
|
+
</BlockShell>
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
{hasHours && timeZone && <HoursScript />}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* LogoCloud — client, partner, insurer or certification logos.
|
|
4
|
+
*
|
|
5
|
+
* - `layout`: `grid` (equal cells, `columns` per row, stepping down to 3 then 2) or `strip`
|
|
6
|
+
* (one centered row that wraps).
|
|
7
|
+
* - `alt` is required on every logo: the organization's name. Linked logos are links named by it.
|
|
8
|
+
* - Every logo gets a reserved box (no layout shift) and loads lazily. Raster files are resized
|
|
9
|
+
* for the display height at 2× and converted to WebP; SVGs are used as-is. URL strings need
|
|
10
|
+
* `width` and `height`.
|
|
11
|
+
* - `size` sets the logo height (s 24px · m 36px · l 48px); width follows the artwork, and a logo
|
|
12
|
+
* wider than its cell scales down as a whole.
|
|
13
|
+
* - `mono`: grayscale at rest, color on hover/focus. Off by default (dark logos vanish when
|
|
14
|
+
* desaturated on dark backgrounds). `tile`: each logo on a white tile, for artwork made for white.
|
|
15
|
+
* - `compact`: a small muted heading ("Trusted by"), still a real heading.
|
|
16
|
+
* - Scrolling row? Put the same images in <Marquee> from @sinnstack/ui/motion.
|
|
17
|
+
* - Empty: placeholder in dev/CMS preview, nothing in builds.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <LogoCloud heading="Trusted by" compact layout="strip"
|
|
21
|
+
* logos={[{ src: aetna, alt: 'Aetna' }, { src: bcbs, alt: 'Blue Cross Blue Shield', href: '/billing#bcbs' }]} />
|
|
22
|
+
*/
|
|
23
|
+
import { getImage } from 'astro:assets';
|
|
24
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
25
|
+
import type { BlockProps, HeadingLevelNumber, LogoItem } from './types';
|
|
26
|
+
import BlockShell from './internal/BlockShell.astro';
|
|
27
|
+
import BlockHeader from './internal/BlockHeader.astro';
|
|
28
|
+
import Placeholder from './internal/Placeholder.astro';
|
|
29
|
+
import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
|
|
30
|
+
import { sf, joinField } from './internal/fields';
|
|
31
|
+
import { renameProp } from '../primitives/lib/deprecate';
|
|
32
|
+
|
|
33
|
+
type Props = Omit<HTMLAttributes<'section'>, 'title'> &
|
|
34
|
+
BlockProps & {
|
|
35
|
+
eyebrow?: string;
|
|
36
|
+
heading?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
headingLevel?: HeadingLevelNumber;
|
|
39
|
+
compact?: boolean;
|
|
40
|
+
logos?: LogoItem[];
|
|
41
|
+
/** Arrangement: `grid` or `strip`. */
|
|
42
|
+
layout?: 'grid' | 'strip';
|
|
43
|
+
/** @deprecated Use `layout`. */
|
|
44
|
+
variant?: 'grid' | 'strip';
|
|
45
|
+
columns?: 2 | 3 | 4 | 5 | 6;
|
|
46
|
+
size?: 's' | 'm' | 'l';
|
|
47
|
+
mono?: boolean;
|
|
48
|
+
tile?: boolean;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
eyebrow,
|
|
53
|
+
heading,
|
|
54
|
+
description,
|
|
55
|
+
headingLevel = 2,
|
|
56
|
+
compact = false,
|
|
57
|
+
logos = [],
|
|
58
|
+
layout: layoutProp,
|
|
59
|
+
variant,
|
|
60
|
+
columns = 4,
|
|
61
|
+
size = 'm',
|
|
62
|
+
mono = false,
|
|
63
|
+
tile = false,
|
|
64
|
+
align = 'center',
|
|
65
|
+
anchor,
|
|
66
|
+
spacing = 'm',
|
|
67
|
+
background = 'none',
|
|
68
|
+
tone = 'accent',
|
|
69
|
+
scheme,
|
|
70
|
+
containerSize = 'default',
|
|
71
|
+
placeholder = PLACEHOLDER_DEFAULT,
|
|
72
|
+
fieldPath,
|
|
73
|
+
id,
|
|
74
|
+
class: className,
|
|
75
|
+
...rest
|
|
76
|
+
} = Astro.props;
|
|
77
|
+
const layout = renameProp('LogoCloud', 'layout', layoutProp, 'variant', variant) ?? 'grid';
|
|
78
|
+
|
|
79
|
+
const { sectionId, headingId } = blockIds('logos', anchor, id);
|
|
80
|
+
const displayHeight = ({ s: 24, m: 36, l: 48 } as const)[size];
|
|
81
|
+
|
|
82
|
+
const resolved = await Promise.all(
|
|
83
|
+
logos.map(async (logo) => {
|
|
84
|
+
if (typeof logo.src === 'string') {
|
|
85
|
+
if (!logo.width || !logo.height) throw new Error(`LogoCloud "${logo.alt}": URL logos need width and height.`);
|
|
86
|
+
return { ...logo, url: logo.src, w: Math.round((logo.width / logo.height) * displayHeight), h: displayHeight };
|
|
87
|
+
}
|
|
88
|
+
const meta = logo.src;
|
|
89
|
+
const w = Math.round((meta.width / meta.height) * displayHeight);
|
|
90
|
+
if (meta.format === 'svg') return { ...logo, url: meta.src, w, h: displayHeight };
|
|
91
|
+
const img = await getImage({ src: meta, height: displayHeight * 2, format: 'webp' });
|
|
92
|
+
return { ...logo, url: img.src, w, h: displayHeight };
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
{
|
|
98
|
+
resolved.length === 0 ? (
|
|
99
|
+
placeholder && <Placeholder label="Logo cloud" hint="Add at least one logo." field={joinField(fieldPath, 'logos')} />
|
|
100
|
+
) : (
|
|
101
|
+
<BlockShell
|
|
102
|
+
name="logos"
|
|
103
|
+
id={sectionId}
|
|
104
|
+
class={className}
|
|
105
|
+
spacing={spacing}
|
|
106
|
+
background={background}
|
|
107
|
+
tone={tone}
|
|
108
|
+
scheme={scheme}
|
|
109
|
+
size={size}
|
|
110
|
+
containerSize={containerSize}
|
|
111
|
+
labelledby={heading ? headingId : undefined}
|
|
112
|
+
align={align}
|
|
113
|
+
data-layout={layout}
|
|
114
|
+
data-mono={mono ? '' : undefined}
|
|
115
|
+
data-tile={tile ? '' : undefined}
|
|
116
|
+
{...sf(fieldPath)}
|
|
117
|
+
{...rest}
|
|
118
|
+
>
|
|
119
|
+
<BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} compact={compact} description={description} fieldPath={fieldPath} />
|
|
120
|
+
<ul class="sinn-logos__list" role="list" data-columns={layout === 'grid' ? columns : undefined} {...sf(fieldPath, 'logos')}>
|
|
121
|
+
{resolved.map((logo, i) => (
|
|
122
|
+
<li class="sinn-logos__item" {...sf(fieldPath, logo.field)}>
|
|
123
|
+
{logo.href ? (
|
|
124
|
+
<a class="sinn-logos__link" href={logo.href}>
|
|
125
|
+
<img src={logo.url} alt={logo.alt} width={logo.w} height={logo.h} loading="lazy" decoding="async" />
|
|
126
|
+
</a>
|
|
127
|
+
) : (
|
|
128
|
+
<img src={logo.url} alt={logo.alt} width={logo.w} height={logo.h} loading="lazy" decoding="async" />
|
|
129
|
+
)}
|
|
130
|
+
</li>
|
|
131
|
+
))}
|
|
132
|
+
</ul>
|
|
133
|
+
</BlockShell>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* MaintenancePage — tells visitors the site is temporarily unavailable and when to come back.
|
|
4
|
+
*
|
|
5
|
+
* Renders a complete, self-contained HTML page by default (no site layout, CMS or nav data, which
|
|
6
|
+
* may be down too); `document={false}` renders just the section.
|
|
7
|
+
*
|
|
8
|
+
* - `until` (ISO 8601 with offset): shown in the site's `timeZone` in the HTML, then in the
|
|
9
|
+
* visitor's own zone with "(in about 2 hours)", kept current. Once it passes, the page says it's
|
|
10
|
+
* taking longer than planned instead of showing a time in the past.
|
|
11
|
+
* - Comes back by itself: after `until` (or right away without one) it checks `pollUrl` every
|
|
12
|
+
* `pollInterval` seconds (with backoff, only while the tab is visible and online) and reloads
|
|
13
|
+
* once the real site answers. "Check now" does it on demand and announces the result.
|
|
14
|
+
* - `contact`: buttons for people who can't wait (phone, email). `notice`: an important message,
|
|
15
|
+
* e.g. "Client dashboards are unaffected." (a warning callout).
|
|
16
|
+
* - HTTP: serve it with `503 Service Unavailable` and `Retry-After` so search engines treat the
|
|
17
|
+
* outage as temporary: `createMaintenanceMiddleware` from `@sinnstack/ui/blocks/maintenance` does
|
|
18
|
+
* this on SSR sites; static hosts need a host rule (see README). This component can't set the
|
|
19
|
+
* status itself, because only the page can.
|
|
20
|
+
*/
|
|
21
|
+
import Heading from '../primitives/Heading.astro';
|
|
22
|
+
import Text from '../primitives/Text.astro';
|
|
23
|
+
import Button from '../primitives/Button.astro';
|
|
24
|
+
import Callout from '../primitives/Callout.astro';
|
|
25
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
26
|
+
import type { ActionItem, BlockProps } from './types';
|
|
27
|
+
import BlockShell from './internal/BlockShell.astro';
|
|
28
|
+
import Actions from './internal/Actions.astro';
|
|
29
|
+
import StandaloneDocument from './internal/StandaloneDocument.astro';
|
|
30
|
+
import { blockIds } from './internal/util';
|
|
31
|
+
import { formatUntil, relativeUntil } from './lib/maintenance';
|
|
32
|
+
import { renameValue } from '../primitives/lib/deprecate';
|
|
33
|
+
|
|
34
|
+
type Props = Omit<HTMLAttributes<'section'>, 'title'> &
|
|
35
|
+
Omit<BlockProps, 'placeholder' | 'fieldPath'> & {
|
|
36
|
+
heading?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
/** When you expect to be back: ISO 8601 with an offset ("2026-11-15T15:00:00-06:00"). */
|
|
39
|
+
until?: string | Date;
|
|
40
|
+
/** Time zone for the server-rendered time (the site's). The browser re-renders it in the visitor's. */
|
|
41
|
+
timeZone?: string;
|
|
42
|
+
locale?: string;
|
|
43
|
+
untilLabel?: string;
|
|
44
|
+
lateMessage?: string;
|
|
45
|
+
contact?: ActionItem[];
|
|
46
|
+
contactHeading?: string;
|
|
47
|
+
notice?: string;
|
|
48
|
+
/** The notice's Callout tone. `accent` is the deprecated name for `info`. */
|
|
49
|
+
noticeTone?: 'info' | 'success' | 'warning' | 'danger' | 'neutral' | 'accent';
|
|
50
|
+
links?: Array<{ label: string; href: string }>;
|
|
51
|
+
autoRefresh?: boolean;
|
|
52
|
+
pollUrl?: string;
|
|
53
|
+
pollInterval?: number;
|
|
54
|
+
document?: boolean;
|
|
55
|
+
title?: string;
|
|
56
|
+
siteName?: string;
|
|
57
|
+
lang?: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
heading = 'We’ll be back soon',
|
|
62
|
+
description = 'We’re doing some scheduled maintenance to improve the site. Thanks for your patience.',
|
|
63
|
+
until,
|
|
64
|
+
timeZone,
|
|
65
|
+
locale = 'en-US',
|
|
66
|
+
untilLabel = 'Expected back',
|
|
67
|
+
lateMessage = 'This is taking a little longer than planned. We’re working on it.',
|
|
68
|
+
contact = [],
|
|
69
|
+
contactHeading = 'Need help right now?',
|
|
70
|
+
notice,
|
|
71
|
+
noticeTone: noticeToneProp = 'warning',
|
|
72
|
+
links = [],
|
|
73
|
+
autoRefresh = true,
|
|
74
|
+
pollUrl = '/',
|
|
75
|
+
pollInterval = 60,
|
|
76
|
+
document: asDocument = true,
|
|
77
|
+
title = 'Down for maintenance',
|
|
78
|
+
siteName,
|
|
79
|
+
lang,
|
|
80
|
+
anchor,
|
|
81
|
+
spacing = 'xl',
|
|
82
|
+
background = 'none',
|
|
83
|
+
tone = 'accent',
|
|
84
|
+
scheme,
|
|
85
|
+
align = 'center',
|
|
86
|
+
containerSize = 'narrow',
|
|
87
|
+
id,
|
|
88
|
+
class: className,
|
|
89
|
+
...rest
|
|
90
|
+
} = Astro.props;
|
|
91
|
+
// `accent` was never a Callout tone: the notice looked like `info` but lost its screen-reader
|
|
92
|
+
// prefix ("Note:"). It now maps to `info`.
|
|
93
|
+
const noticeTone = renameValue('MaintenancePage', 'noticeTone', noticeToneProp, { accent: 'info' }) as Exclude<typeof noticeToneProp, 'accent'>;
|
|
94
|
+
|
|
95
|
+
const { sectionId, headingId } = blockIds('maintenance', anchor, id);
|
|
96
|
+
const iso = until ? new Date(until).toISOString() : undefined;
|
|
97
|
+
const serverTime = until ? formatUntil(until, locale, timeZone) : undefined;
|
|
98
|
+
const serverRelative = until ? relativeUntil(until, locale) : undefined;
|
|
99
|
+
const late = Boolean(until) && !serverRelative;
|
|
100
|
+
const Wrapper = asDocument ? StandaloneDocument : Fragment;
|
|
101
|
+
const wrapperProps = asDocument ? { title, lang, siteName } : {};
|
|
102
|
+
const toolIcon = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M14.7 6.3a4 4 0 0 0 5 5L21 13l-2.3 2.3-1.3-1.3a4 4 0 0 0-5-5l-1.3-1.3L13.4 5.4Z"/><path d="m11.1 9.6-7.6 7.6a2 2 0 0 0 2.8 2.8l7.6-7.6"/></svg>';
|
|
103
|
+
const clockIcon = '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="10" cy="10" r="7.25"/><path d="M10 6v4l2.5 1.5"/></svg>';
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
<Wrapper {...wrapperProps}>
|
|
107
|
+
<BlockShell
|
|
108
|
+
name="maintenance"
|
|
109
|
+
id={sectionId}
|
|
110
|
+
class={className}
|
|
111
|
+
spacing={spacing}
|
|
112
|
+
background={background}
|
|
113
|
+
tone={tone}
|
|
114
|
+
scheme={scheme}
|
|
115
|
+
containerSize={containerSize}
|
|
116
|
+
labelledby={headingId}
|
|
117
|
+
align={align}
|
|
118
|
+
data-sinn-maintenance
|
|
119
|
+
data-until={iso}
|
|
120
|
+
data-poll-url={pollUrl}
|
|
121
|
+
data-poll-interval={pollInterval}
|
|
122
|
+
data-auto-refresh={autoRefresh ? undefined : 'false'}
|
|
123
|
+
{...rest}
|
|
124
|
+
>
|
|
125
|
+
<div class="sinn-maintenance__panel">
|
|
126
|
+
<span class="sinn-maintenance__icon" aria-hidden="true" set:html={toolIcon} />
|
|
127
|
+
<Heading level={1} size="3xl" weight="bold" id={headingId} class="sinn-maintenance__title">{heading}</Heading>
|
|
128
|
+
<Text size="l" tone="muted" class="sinn-maintenance__description" measure>{description}</Text>
|
|
129
|
+
{
|
|
130
|
+
until && (
|
|
131
|
+
<div class="sinn-maintenance__until">
|
|
132
|
+
<span class="sinn-maintenance__until-icon" aria-hidden="true" set:html={clockIcon} />
|
|
133
|
+
<p>
|
|
134
|
+
<span class="sinn-maintenance__until-label">{untilLabel}</span>{' '}
|
|
135
|
+
<time datetime={iso} data-sinn-until>{serverTime}</time>{' '}
|
|
136
|
+
<span class="sinn-maintenance__relative" data-sinn-until-relative hidden={!serverRelative}>{serverRelative && `(${serverRelative})`}</span>
|
|
137
|
+
</p>
|
|
138
|
+
</div>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
{until && <p class="sinn-maintenance__late" data-sinn-late hidden={!late}>{lateMessage}</p>}
|
|
142
|
+
{notice && <Callout tone={noticeTone} size="s" class="sinn-maintenance__notice">{notice}</Callout>}
|
|
143
|
+
{
|
|
144
|
+
contact.length > 0 && (
|
|
145
|
+
<div class="sinn-maintenance__contact">
|
|
146
|
+
<p class="sinn-maintenance__contact-heading">{contactHeading}</p>
|
|
147
|
+
<Actions actions={contact} size="m" class="sinn-maintenance__actions" />
|
|
148
|
+
</div>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
<div class="sinn-maintenance__check">
|
|
152
|
+
<Button variant="ghost" size="s" data-sinn-check hidden>Check now</Button>
|
|
153
|
+
<p class="sinn-maintenance__status" role="status" data-sinn-maintenance-status></p>
|
|
154
|
+
{autoRefresh && <p class="sinn-maintenance__auto" data-sinn-auto-note hidden>This page will reload by itself when we’re back.</p>}
|
|
155
|
+
</div>
|
|
156
|
+
{
|
|
157
|
+
links.length > 0 && (
|
|
158
|
+
<ul class="sinn-maintenance__links" role="list">
|
|
159
|
+
{links.map((l) => (
|
|
160
|
+
<li>
|
|
161
|
+
<a href={l.href}>{l.label}</a>
|
|
162
|
+
</li>
|
|
163
|
+
))}
|
|
164
|
+
</ul>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
</div>
|
|
168
|
+
<script>
|
|
169
|
+
import './scripts/maintenance';
|
|
170
|
+
</script>
|
|
171
|
+
</BlockShell>
|
|
172
|
+
</Wrapper>
|
|
173
|
+
|