bearminion 1.8.0 → 1.9.1
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 +18 -0
- package/dist/astro.js +5 -5
- package/dist/cli.js +762 -25
- package/dist/content.js +2 -2
- package/dist/hash-BeBymBO1.js +59 -0
- package/dist/index.js +4 -4
- package/dist/marks-DPBilumg.js +174 -0
- package/dist/marks.js +1 -174
- package/dist/{page-NOFVEqn1.js → page-X-WnOu7-.js} +1 -1
- package/dist/{preview--S1QUrMM.js → preview-B_88I5Jm.js} +1 -1
- package/dist/{reload-BPkPoQ-P.js → reload-Dkp3xC0l.js} +1 -1
- package/dist/rich-text-70hddxMC.js +403 -0
- package/dist/rich-text.js +1 -403
- package/dist/{sections-manifest-CU-xBjMi.js → sections-manifest-CO9QfJPG.js} +1 -1
- package/dist/{theme-DFjHjgFO.js → theme-Dv7_7B56.js} +2 -2
- package/dist/ui/mount.js +20 -7
- package/package.json +4 -1
- package/registry/default/files/src/components/atoms/Button.astro +64 -0
- package/registry/default/files/src/components/atoms/Emphasis.astro +24 -0
- package/registry/default/files/src/components/atoms/Image.astro +78 -0
- package/registry/default/files/src/components/atoms/Typography.astro +53 -0
- package/registry/default/files/src/components/atoms/button.ts +31 -0
- package/registry/default/files/src/components/atoms/image.ts +34 -0
- package/registry/default/files/src/components/atoms/options.ts +39 -0
- package/registry/default/files/src/components/atoms/typography.ts +64 -0
- package/registry/default/files/src/components/molecules/CommandLine.astro +109 -0
- package/registry/default/files/src/components/molecules/MediaFrame.astro +71 -0
- package/registry/default/files/src/components/molecules/Pill.astro +24 -0
- package/registry/default/files/src/components/molecules/SectionHeader.astro +63 -0
- package/registry/default/files/src/components/molecules/SectionShell.astro +33 -0
- package/registry/default/files/src/components/sections/contact/Contact.astro +231 -0
- package/registry/default/files/src/components/sections/contact/definition.ts +52 -0
- package/registry/default/files/src/components/sections/contact/form.ts +313 -0
- package/registry/default/files/src/components/sections/contact/wireframe.ts +15 -0
- package/registry/default/files/src/components/sections/cta/Cta.astro +206 -0
- package/registry/default/files/src/components/sections/cta/definition.ts +49 -0
- package/registry/default/files/src/components/sections/cta/wireframe.ts +9 -0
- package/registry/default/files/src/components/sections/faq/Faq.astro +136 -0
- package/registry/default/files/src/components/sections/faq/definition.ts +54 -0
- package/registry/default/files/src/components/sections/faq/wireframe.ts +19 -0
- package/registry/default/files/src/components/sections/features/Features.astro +146 -0
- package/registry/default/files/src/components/sections/features/definition.ts +54 -0
- package/registry/default/files/src/components/sections/features/wireframe.ts +19 -0
- package/registry/default/files/src/components/sections/gallery/Gallery.astro +128 -0
- package/registry/default/files/src/components/sections/gallery/definition.ts +59 -0
- package/registry/default/files/src/components/sections/gallery/lightbox.ts +159 -0
- package/registry/default/files/src/components/sections/gallery/wireframe.ts +12 -0
- package/registry/default/files/src/components/sections/hero/Hero.astro +185 -0
- package/registry/default/files/src/components/sections/hero/HeroBadge.astro +26 -0
- package/registry/default/files/src/components/sections/hero/definition.ts +74 -0
- package/registry/default/files/src/components/sections/hero/wireframe.ts +12 -0
- package/registry/default/files/src/components/sections/logo-strip/LogoStrip.astro +107 -0
- package/registry/default/files/src/components/sections/logo-strip/definition.ts +30 -0
- package/registry/default/files/src/components/sections/logo-strip/wireframe.ts +11 -0
- package/registry/default/files/src/components/sections/media/Media.astro +118 -0
- package/registry/default/files/src/components/sections/media/MediaPlayer.astro +176 -0
- package/registry/default/files/src/components/sections/media/definition.ts +77 -0
- package/registry/default/files/src/components/sections/media/source.ts +3 -0
- package/registry/default/files/src/components/sections/media/wireframe.ts +9 -0
- package/registry/default/files/src/components/sections/pricing/Pricing.astro +210 -0
- package/registry/default/files/src/components/sections/pricing/definition.ts +62 -0
- package/registry/default/files/src/components/sections/pricing/wireframe.ts +18 -0
- package/registry/default/files/src/components/sections/shared.ts +13 -0
- package/registry/default/files/src/components/sections/stats/Stats.astro +110 -0
- package/registry/default/files/src/components/sections/stats/definition.ts +41 -0
- package/registry/default/files/src/components/sections/stats/wireframe.ts +15 -0
- package/registry/default/files/src/components/sections/steps/Steps.astro +139 -0
- package/registry/default/files/src/components/sections/steps/definition.ts +62 -0
- package/registry/default/files/src/components/sections/steps/icons.ts +27 -0
- package/registry/default/files/src/components/sections/steps/wireframe.ts +16 -0
- package/registry/default/files/src/components/sections/testimonials/Testimonials.astro +172 -0
- package/registry/default/files/src/components/sections/testimonials/definition.ts +42 -0
- package/registry/default/files/src/components/sections/testimonials/wireframe.ts +21 -0
- package/registry/default/files/src/components/sections/text/Text.astro +43 -0
- package/registry/default/files/src/components/sections/text/definition.ts +36 -0
- package/registry/default/files/src/components/sections/text/wireframe.ts +12 -0
- package/registry/default/files/src/components/sections/text-image/TextImage.astro +107 -0
- package/registry/default/files/src/components/sections/text-image/definition.ts +39 -0
- package/registry/default/files/src/components/sections/text-image/wireframe.ts +12 -0
- package/registry/default/files/src/lib/assets.ts +13 -0
- package/registry/default/files/src/lib/cn.ts +6 -0
- package/registry/default/files/src/lib/contact-form.ts +97 -0
- package/registry/default/files/src/lib/hidden-text.ts +32 -0
- package/registry/default/files/src/lib/image-url.ts +38 -0
- package/registry/default/files/src/lib/link-attrs.ts +74 -0
- package/registry/default/registry.json +670 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { defineSection, linkSchema, richTextSchema, textSchema, withEmphasis, type CountRule } from 'bearminion'
|
|
3
|
+
import { accent, eyebrow, heading } from '../shared'
|
|
4
|
+
import { stepIconPaths } from './icons'
|
|
5
|
+
import { stepsWireframe } from './wireframe'
|
|
6
|
+
|
|
7
|
+
export const stepsVariants = ['columns', 'rail', 'list'] as const
|
|
8
|
+
|
|
9
|
+
/** 24px stroke icons; the paths are in `icons.ts`. */
|
|
10
|
+
export const stepIcons = ['terminal', 'edit', 'upload', 'moon', 'git', 'check', 'bolt', 'cursor', 'sliders', 'database'] as const
|
|
11
|
+
|
|
12
|
+
export const stepsCounts = {
|
|
13
|
+
steps: { recommended: '3 or 4', min: 2, max: 6 },
|
|
14
|
+
} as const satisfies Record<string, CountRule>
|
|
15
|
+
|
|
16
|
+
export const stepItemSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
icon: z.enum(stepIcons),
|
|
19
|
+
title: textSchema,
|
|
20
|
+
/** One sentence. Text in backticks shows as code. */
|
|
21
|
+
description: richTextSchema.optional(),
|
|
22
|
+
})
|
|
23
|
+
.strict()
|
|
24
|
+
|
|
25
|
+
export const stepsSchema = withEmphasis({
|
|
26
|
+
eyebrow,
|
|
27
|
+
heading,
|
|
28
|
+
body: richTextSchema.optional(),
|
|
29
|
+
link: linkSchema.optional(),
|
|
30
|
+
/** Off: no "01" or "Step 01" over each item, for points that are not a sequence. */
|
|
31
|
+
numbered: z.boolean().default(true),
|
|
32
|
+
steps: z.array(stepItemSchema).min(stepsCounts.steps.min).max(stepsCounts.steps.max),
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
export type StepItem = z.infer<typeof stepItemSchema>
|
|
36
|
+
export type StepsProps = z.infer<typeof stepsSchema>
|
|
37
|
+
|
|
38
|
+
export const steps = defineSection({
|
|
39
|
+
type: 'steps',
|
|
40
|
+
label: 'Steps',
|
|
41
|
+
description: 'A few short points with an icon each: steps, or reasons.',
|
|
42
|
+
schema: stepsSchema,
|
|
43
|
+
defaults: {
|
|
44
|
+
eyebrow: 'How it works',
|
|
45
|
+
heading: 'Three steps to get going.',
|
|
46
|
+
marks: accent('Three steps to get going.', 'get going.'),
|
|
47
|
+
body: 'Say what the reader does first, then what happens next. Keep each step to one sentence.',
|
|
48
|
+
numbered: true,
|
|
49
|
+
steps: [
|
|
50
|
+
{ icon: 'cursor', title: 'Pick', description: 'Name the first thing the reader does.' },
|
|
51
|
+
{ icon: 'edit', title: 'Shape', description: 'Say what they change or decide next.' },
|
|
52
|
+
{ icon: 'check', title: 'Done', description: 'End with what they have when they finish.' },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
variants: stepsVariants,
|
|
56
|
+
defaultVariant: 'columns',
|
|
57
|
+
options: [{ name: 'numbered', label: 'Show numbers', type: 'boolean', default: true }],
|
|
58
|
+
optional: { props: ['eyebrow', 'heading', 'body', 'link'], items: { steps: ['description'] } },
|
|
59
|
+
counts: stepsCounts,
|
|
60
|
+
icons: { 'steps[].icon': stepIconPaths },
|
|
61
|
+
wireframe: stepsWireframe,
|
|
62
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { StepItem } from './definition'
|
|
2
|
+
|
|
3
|
+
/** 24px, stroke 1.8, round caps and joins. */
|
|
4
|
+
export const stepIconPaths: Record<StepItem['icon'], string> = {
|
|
5
|
+
terminal: 'M4 5h16v14H4zM8 10l2.5 2L8 14M12.5 14H16',
|
|
6
|
+
edit: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4',
|
|
7
|
+
upload: 'M12 16V4M7 9l5-5 5 5M5 20h14',
|
|
8
|
+
moon: 'M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z',
|
|
9
|
+
git: 'M6 3v12M6 15a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 9c0 5-6 4-12 6',
|
|
10
|
+
check: 'M5 12.5l4.5 4.5L19 7',
|
|
11
|
+
bolt: 'M13 3L5 13.5h6L10 21l8-10.5h-6z',
|
|
12
|
+
cursor: 'M5 4l5.5 15 2.2-6.3L19 10.5zM13 13l5 5',
|
|
13
|
+
sliders: 'M4 7h9M17 7h3M4 17h3M11 17h9M15 5v4M9 15v4',
|
|
14
|
+
database: 'M4 6c0-1.7 3.6-3 8-3s8 1.3 8 3-3.6 3-8 3-8-1.3-8-3zM4 6v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Columns for the step grid, by item count. A row never leaves an orphan: the count drops to the widest divisor that
|
|
19
|
+
* fits, with about 15.5rem per column (4 items: 4, then 2 × 2, then 1; 3 items: 3, then 1).
|
|
20
|
+
*/
|
|
21
|
+
export const stepColumns: Record<number, string> = {
|
|
22
|
+
2: '@min-[34rem]:grid-cols-2',
|
|
23
|
+
3: '@min-[49.5rem]:grid-cols-3',
|
|
24
|
+
4: '@min-[34rem]:grid-cols-2 @min-[65rem]:grid-cols-4',
|
|
25
|
+
5: '@min-[80.5rem]:grid-cols-5',
|
|
26
|
+
6: '@min-[34rem]:grid-cols-2 @min-[49.5rem]:grid-cols-3 @min-[96rem]:grid-cols-6',
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineWireframe } from 'bearminion'
|
|
2
|
+
|
|
3
|
+
/** Add section picker thumbnail: [left %, top %, width %, height %, kind]. */
|
|
4
|
+
export const stepsWireframe = defineWireframe([
|
|
5
|
+
[8, 12, 40, 8, 'title'],
|
|
6
|
+
[8, 25, 30, 4, 'text'],
|
|
7
|
+
[8, 40, 26, 46, 'card'],
|
|
8
|
+
[37, 40, 26, 46, 'card'],
|
|
9
|
+
[66, 40, 26, 46, 'card'],
|
|
10
|
+
[12, 46, 7, 9, 'highlight'],
|
|
11
|
+
[41, 46, 7, 9, 'highlight'],
|
|
12
|
+
[70, 46, 7, 9, 'highlight'],
|
|
13
|
+
[12, 62, 16, 4, 'text'],
|
|
14
|
+
[41, 62, 16, 4, 'text'],
|
|
15
|
+
[70, 62, 16, 4, 'text'],
|
|
16
|
+
])
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { Section } from '../definitions'
|
|
3
|
+
import Typography from '../../atoms/Typography.astro'
|
|
4
|
+
import SectionHeader from '../../molecules/SectionHeader.astro'
|
|
5
|
+
import SectionShell from '../../molecules/SectionShell.astro'
|
|
6
|
+
import MediaFrame from '../../molecules/MediaFrame.astro'
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
section: Extract<Section, { type: 'testimonials' }>
|
|
10
|
+
index: number
|
|
11
|
+
motion?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { section, index, motion = true } = Astro.props
|
|
15
|
+
const props = section.props
|
|
16
|
+
const field = (path: string) => `sections.${index}.props.${path}`
|
|
17
|
+
const reveal = section.motion ?? motion
|
|
18
|
+
const featured = props.items[0]
|
|
19
|
+
const rest = props.items.slice(1)
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<SectionShell id={section.id} anchor={section.anchor} type={section.type} variant={section.variant} tone={section.tone} motion={reveal}>
|
|
23
|
+
{
|
|
24
|
+
section.variant === 'grid' && (
|
|
25
|
+
<div class="section-container">
|
|
26
|
+
<SectionHeader eyebrow={props.eyebrow} heading={props.heading} marks={props.marks} field={field} />
|
|
27
|
+
<ul class="mt-12 grid grid-cols-[repeat(auto-fit,minmax(min(100%,18rem),1fr))] gap-4">
|
|
28
|
+
{props.items.map((item, itemIndex) => (
|
|
29
|
+
<li class="flex flex-col justify-between gap-8 rounded-card-lg bg-surface p-7 ring-line">
|
|
30
|
+
<Typography as="blockquote" class="text-[1.125rem] leading-[1.45] tracking-[-0.02em]" data-field={field(`items.${itemIndex}.quote`)} markdown={item.quote} />
|
|
31
|
+
<div class="flex items-center gap-3">
|
|
32
|
+
{item.image && !item.image.hidden ? (
|
|
33
|
+
<MediaFrame src={item.image.src} alt={item.image.alt} aspectClass="size-10 shrink-0" roundedClass="rounded-full" class="p-0" fit={item.image?.fit} position={item.image?.position} data-field={field(`items.${itemIndex}.image.alt`)} />
|
|
34
|
+
) : (
|
|
35
|
+
<span class="inline-flex size-10 items-center justify-center rounded-full bg-fg font-mono text-[0.75rem] text-bg">
|
|
36
|
+
{item.name.slice(0, 1)}
|
|
37
|
+
</span>
|
|
38
|
+
)}
|
|
39
|
+
<div>
|
|
40
|
+
<p class="text-[0.9375rem] font-medium" data-field={field(`items.${itemIndex}.name`)}>{item.name}</p>
|
|
41
|
+
{item.role && (
|
|
42
|
+
<p class="text-[0.8125rem] text-muted" data-field={field(`items.${itemIndex}.role`)}>{item.role}</p>
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</li>
|
|
47
|
+
))}
|
|
48
|
+
</ul>
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
{
|
|
53
|
+
section.variant === 'featured' && featured && (
|
|
54
|
+
<div class="section-container">
|
|
55
|
+
<figure class="mx-auto max-w-4xl text-center">
|
|
56
|
+
<Typography as="blockquote" class="font-serif text-[clamp(1.75rem,1rem+2.4cqi,3rem)] leading-[1.2] font-normal tracking-[-0.03em] italic" data-field={field('items.0.quote')} markdown={featured.quote} />
|
|
57
|
+
<figcaption class="mt-6 text-[0.9375rem]">
|
|
58
|
+
<span data-field={field('items.0.name')}>{featured.name}</span>
|
|
59
|
+
{featured.role && (
|
|
60
|
+
<span class="text-muted">
|
|
61
|
+
{' '}
|
|
62
|
+
· <span data-field={field('items.0.role')}>{featured.role}</span>
|
|
63
|
+
</span>
|
|
64
|
+
)}
|
|
65
|
+
</figcaption>
|
|
66
|
+
</figure>
|
|
67
|
+
{rest.length > 0 && (
|
|
68
|
+
<ul class="mt-14 grid grid-cols-1 border-t border-[var(--line)] @min-[700px]:grid-cols-2">
|
|
69
|
+
{rest.map((item, offset) => {
|
|
70
|
+
const itemIndex = offset + 1
|
|
71
|
+
return (
|
|
72
|
+
<li class="border-t border-[var(--line)] py-8 @min-[700px]:border-t-0 @min-[700px]:border-l @min-[700px]:px-8 @min-[700px]:first:border-l-0 @min-[700px]:first:pl-0">
|
|
73
|
+
<Typography as="blockquote" class="text-[1.0625rem] leading-[1.5]" data-field={field(`items.${itemIndex}.quote`)} markdown={item.quote} />
|
|
74
|
+
<p class="mt-4 text-[0.875rem]">
|
|
75
|
+
<span data-field={field(`items.${itemIndex}.name`)}>{item.name}</span>
|
|
76
|
+
{item.role && (
|
|
77
|
+
<span class="text-muted">
|
|
78
|
+
{' '}
|
|
79
|
+
· <span data-field={field(`items.${itemIndex}.role`)}>{item.role}</span>
|
|
80
|
+
</span>
|
|
81
|
+
)}
|
|
82
|
+
</p>
|
|
83
|
+
</li>
|
|
84
|
+
)
|
|
85
|
+
})}
|
|
86
|
+
</ul>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
{
|
|
92
|
+
section.variant === 'carousel' && (
|
|
93
|
+
<div class="section-container" data-carousel>
|
|
94
|
+
<div class="flex flex-wrap items-end justify-between gap-6">
|
|
95
|
+
<SectionHeader eyebrow={props.eyebrow} heading={props.heading} marks={props.marks} field={field} />
|
|
96
|
+
<div class="flex items-center gap-3">
|
|
97
|
+
<p class="font-mono text-[0.75rem] tracking-[0.08em] text-muted" data-carousel-counter>
|
|
98
|
+
01 / {String(props.items.length).padStart(2, '0')}
|
|
99
|
+
</p>
|
|
100
|
+
<button type="button" data-carousel-prev class="inline-flex size-11 items-center justify-center rounded-full shadow-[inset_0_0_0_1px_var(--line)]" aria-label="Previous testimonial">
|
|
101
|
+
←
|
|
102
|
+
</button>
|
|
103
|
+
<button type="button" data-carousel-next class="inline-flex size-11 items-center justify-center rounded-full shadow-[inset_0_0_0_1px_var(--line)]" aria-label="Next testimonial">
|
|
104
|
+
→
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="mt-10 overflow-hidden">
|
|
109
|
+
<div data-carousel-track class="flex transition-transform duration-[600ms] ease-[cubic-bezier(.2,.7,.2,1)]">
|
|
110
|
+
{props.items.map((item, itemIndex) => (
|
|
111
|
+
<article class="grid w-full shrink-0 items-center gap-8 @min-[760px]:grid-cols-[minmax(16rem,0.8fr)_minmax(0,1.2fr)]">
|
|
112
|
+
{!item.image?.hidden && (
|
|
113
|
+
<MediaFrame
|
|
114
|
+
src={item.image?.src}
|
|
115
|
+
alt={item.image?.alt ?? item.name}
|
|
116
|
+
aspectClass="aspect-square"
|
|
117
|
+
roundedClass="rounded-[clamp(1rem,2cqi,1.75rem)]"
|
|
118
|
+
fit={item.image?.fit} position={item.image?.position} data-field={field(`items.${itemIndex}.image.alt`)}
|
|
119
|
+
/>
|
|
120
|
+
)}
|
|
121
|
+
<div>
|
|
122
|
+
<Typography as="blockquote" class="font-serif text-[clamp(1.75rem,1rem+2cqi,2.75rem)] leading-[1.2] italic tracking-[-0.03em]" data-field={field(`items.${itemIndex}.quote`)} markdown={item.quote} />
|
|
123
|
+
<p class="mt-6 text-[0.9375rem]">
|
|
124
|
+
<span data-field={field(`items.${itemIndex}.name`)}>{item.name}</span>
|
|
125
|
+
{item.role && (
|
|
126
|
+
<span class="text-muted">
|
|
127
|
+
{' '}
|
|
128
|
+
· <span data-field={field(`items.${itemIndex}.role`)}>{item.role}</span>
|
|
129
|
+
</span>
|
|
130
|
+
)}
|
|
131
|
+
</p>
|
|
132
|
+
</div>
|
|
133
|
+
</article>
|
|
134
|
+
))}
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
</SectionShell>
|
|
141
|
+
|
|
142
|
+
<script>
|
|
143
|
+
function bindTestimonials() {
|
|
144
|
+
document.querySelectorAll('[data-carousel]').forEach((root) => {
|
|
145
|
+
if (!(root instanceof HTMLElement) || root.dataset.bound === 'true') return
|
|
146
|
+
root.dataset.bound = 'true'
|
|
147
|
+
const track = root.querySelector('[data-carousel-track]')
|
|
148
|
+
const counter = root.querySelector('[data-carousel-counter]')
|
|
149
|
+
const prev = root.querySelector('[data-carousel-prev]')
|
|
150
|
+
const next = root.querySelector('[data-carousel-next]')
|
|
151
|
+
if (!(track instanceof HTMLElement) || !(prev instanceof HTMLButtonElement) || !(next instanceof HTMLButtonElement)) return
|
|
152
|
+
const total = track.children.length
|
|
153
|
+
let index = 0
|
|
154
|
+
const render = () => {
|
|
155
|
+
track.style.transform = `translateX(-${index * 100}%)`
|
|
156
|
+
if (counter) {
|
|
157
|
+
counter.textContent = `${String(index + 1).padStart(2, '0')} / ${String(total).padStart(2, '0')}`
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
prev.addEventListener('click', () => {
|
|
161
|
+
index = (index - 1 + total) % total
|
|
162
|
+
render()
|
|
163
|
+
})
|
|
164
|
+
next.addEventListener('click', () => {
|
|
165
|
+
index = (index + 1) % total
|
|
166
|
+
render()
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
bindTestimonials()
|
|
171
|
+
document.addEventListener('bearminion:preview', bindTestimonials)
|
|
172
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { defineSection, imageSchema, richTextSchema, textSchema, withEmphasis } from 'bearminion'
|
|
3
|
+
import { accent, eyebrow, heading } from '../shared'
|
|
4
|
+
import { testimonialsWireframe } from './wireframe'
|
|
5
|
+
|
|
6
|
+
export const testimonialsVariants = ['grid', 'featured', 'carousel'] as const
|
|
7
|
+
|
|
8
|
+
export const testimonialItemSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
quote: richTextSchema,
|
|
11
|
+
name: textSchema,
|
|
12
|
+
role: textSchema.optional(),
|
|
13
|
+
image: imageSchema.optional(),
|
|
14
|
+
})
|
|
15
|
+
.strict()
|
|
16
|
+
|
|
17
|
+
export const testimonialsSchema = withEmphasis({
|
|
18
|
+
eyebrow,
|
|
19
|
+
heading,
|
|
20
|
+
items: z.array(testimonialItemSchema).min(1),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export type TestimonialItem = z.infer<typeof testimonialItemSchema>
|
|
24
|
+
export type TestimonialsProps = z.infer<typeof testimonialsSchema>
|
|
25
|
+
|
|
26
|
+
export const testimonials = defineSection({
|
|
27
|
+
type: 'testimonials',
|
|
28
|
+
label: 'Testimonials',
|
|
29
|
+
description: 'Quotes with a name and avatar.',
|
|
30
|
+
schema: testimonialsSchema,
|
|
31
|
+
defaults: {
|
|
32
|
+
eyebrow: 'Testimonials',
|
|
33
|
+
heading: 'What people say',
|
|
34
|
+
marks: accent('What people say', 'people say'),
|
|
35
|
+
items: [{ quote: 'A short quote from a happy customer, in their own words.', name: 'Alex Morgan', role: 'Role, Company' }],
|
|
36
|
+
},
|
|
37
|
+
variants: testimonialsVariants,
|
|
38
|
+
defaultVariant: 'grid',
|
|
39
|
+
optional: { props: ['eyebrow', 'heading'], items: { items: ['role', 'image'] } },
|
|
40
|
+
counts: { items: { recommended: 3 } },
|
|
41
|
+
wireframe: testimonialsWireframe,
|
|
42
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineWireframe } from 'bearminion'
|
|
2
|
+
|
|
3
|
+
/** Add section picker thumbnail: [left %, top %, width %, height %, kind]. */
|
|
4
|
+
export const testimonialsWireframe = defineWireframe([
|
|
5
|
+
[8, 12, 36, 8, 'title'],
|
|
6
|
+
[8, 32, 26, 56, 'card'],
|
|
7
|
+
[37, 32, 26, 56, 'card'],
|
|
8
|
+
[66, 32, 26, 56, 'card'],
|
|
9
|
+
[11, 40, 20, 4, 'text'],
|
|
10
|
+
[40, 40, 20, 4, 'text'],
|
|
11
|
+
[69, 40, 20, 4, 'text'],
|
|
12
|
+
[11, 48, 16, 4, 'text'],
|
|
13
|
+
[40, 48, 16, 4, 'text'],
|
|
14
|
+
[69, 48, 16, 4, 'text'],
|
|
15
|
+
[11, 70, 7, 12, 'avatar'],
|
|
16
|
+
[40, 70, 7, 12, 'avatar'],
|
|
17
|
+
[69, 70, 7, 12, 'avatar'],
|
|
18
|
+
[20, 74, 9, 4, 'title'],
|
|
19
|
+
[49, 74, 9, 4, 'title'],
|
|
20
|
+
[78, 74, 9, 4, 'title'],
|
|
21
|
+
])
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { Section } from '../definitions'
|
|
3
|
+
import Typography from '../../atoms/Typography.astro'
|
|
4
|
+
import SectionHeader from '../../molecules/SectionHeader.astro'
|
|
5
|
+
import SectionShell from '../../molecules/SectionShell.astro'
|
|
6
|
+
import { cn } from '../../../lib/cn'
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
section: Extract<Section, { type: 'text' }>
|
|
10
|
+
index: number
|
|
11
|
+
motion?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { section, index, motion = true } = Astro.props
|
|
15
|
+
const props = section.props
|
|
16
|
+
const field = (path: string) => `sections.${index}.props.${path}`
|
|
17
|
+
const reveal = section.motion ?? motion
|
|
18
|
+
const center = section.variant === 'center'
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<SectionShell id={section.id} anchor={section.anchor} type={section.type} variant={section.variant} tone={section.tone} motion={reveal}>
|
|
22
|
+
<div class={cn('section-container flex flex-col gap-[clamp(1.75rem,3.5cqi,2.75rem)]', center && 'items-center')}>
|
|
23
|
+
<div class={cn('flex w-full flex-col', props.narrow && 'max-w-[42rem]', center && 'items-center text-center')}>
|
|
24
|
+
<SectionHeader
|
|
25
|
+
eyebrow={props.eyebrow}
|
|
26
|
+
heading={props.heading}
|
|
27
|
+
marks={props.marks}
|
|
28
|
+
size="h2-md"
|
|
29
|
+
align={center ? 'center' : 'left'}
|
|
30
|
+
field={field}
|
|
31
|
+
class="gap-5"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
<Typography
|
|
35
|
+
as="div"
|
|
36
|
+
size="lead"
|
|
37
|
+
class={cn('w-full', props.narrow && 'max-w-[42rem]', center && 'text-left')}
|
|
38
|
+
data-field={field('body')}
|
|
39
|
+
markdown={props.body}
|
|
40
|
+
richHeadings
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</SectionShell>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { defineSection, richTextSchema, withEmphasis } from 'bearminion'
|
|
3
|
+
import { accent, eyebrow, heading } from '../shared'
|
|
4
|
+
import { textWireframe } from './wireframe'
|
|
5
|
+
|
|
6
|
+
export const textVariants = ['left', 'center'] as const
|
|
7
|
+
|
|
8
|
+
export const textSchema = withEmphasis({
|
|
9
|
+
eyebrow,
|
|
10
|
+
heading,
|
|
11
|
+
/** Long-form text. Besides bold, italic, links, code and lists it may hold `##` and `###` headings. */
|
|
12
|
+
body: richTextSchema,
|
|
13
|
+
/** On: a readable column about 65 characters wide. Off: the full width of the page. */
|
|
14
|
+
narrow: z.boolean().default(true),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export type TextProps = z.infer<typeof textSchema>
|
|
18
|
+
|
|
19
|
+
export const text = defineSection({
|
|
20
|
+
type: 'text',
|
|
21
|
+
label: 'Text',
|
|
22
|
+
description: 'Plain long-form text with headings, lists and links. For an About, a policy or any simple page.',
|
|
23
|
+
schema: textSchema,
|
|
24
|
+
defaults: {
|
|
25
|
+
eyebrow: 'About',
|
|
26
|
+
heading: 'A page of plain words.',
|
|
27
|
+
marks: accent('A page of plain words.', 'plain words.'),
|
|
28
|
+
body: 'Write as much as you need. Select a few words to make them **bold**, *italic* or a link.\n\n## A heading\n\nHeadings split a long page into parts a reader can scan.\n\n- Lists work too\n- With as many items as you need',
|
|
29
|
+
narrow: true,
|
|
30
|
+
},
|
|
31
|
+
variants: textVariants,
|
|
32
|
+
defaultVariant: 'left',
|
|
33
|
+
options: [{ name: 'narrow', label: 'Narrow column (easier to read)', type: 'boolean', default: true }],
|
|
34
|
+
optional: { props: ['eyebrow', 'heading'] },
|
|
35
|
+
wireframe: textWireframe,
|
|
36
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineWireframe } from 'bearminion'
|
|
2
|
+
|
|
3
|
+
/** Add section picker thumbnail: [left %, top %, width %, height %, kind]. */
|
|
4
|
+
export const textWireframe = defineWireframe([
|
|
5
|
+
[20, 12, 40, 8, 'title'],
|
|
6
|
+
[20, 30, 60, 3, 'text'],
|
|
7
|
+
[20, 38, 60, 3, 'text'],
|
|
8
|
+
[20, 46, 52, 3, 'text'],
|
|
9
|
+
[20, 58, 30, 5, 'title'],
|
|
10
|
+
[20, 70, 60, 3, 'text'],
|
|
11
|
+
[20, 78, 44, 3, 'text'],
|
|
12
|
+
])
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { Section } from '../definitions'
|
|
3
|
+
import Button from '../../atoms/Button.astro'
|
|
4
|
+
import { buttonLinkProps, buttonVariant } from '../../../lib/link-attrs'
|
|
5
|
+
import Typography from '../../atoms/Typography.astro'
|
|
6
|
+
import MediaFrame from '../../molecules/MediaFrame.astro'
|
|
7
|
+
import SectionHeader from '../../molecules/SectionHeader.astro'
|
|
8
|
+
import SectionShell from '../../molecules/SectionShell.astro'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
section: Extract<Section, { type: 'textImage' }>
|
|
12
|
+
index: number
|
|
13
|
+
motion?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { section, index, motion = true } = Astro.props
|
|
17
|
+
const props = section.props
|
|
18
|
+
const field = (path: string) => `sections.${index}.props.${path}`
|
|
19
|
+
const reveal = section.motion ?? motion
|
|
20
|
+
const left = section.variant === 'left'
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<SectionShell id={section.id} anchor={section.anchor} type={section.type} variant={section.variant} tone={section.tone} motion={reveal}>
|
|
24
|
+
{
|
|
25
|
+
section.variant !== 'wide' && (
|
|
26
|
+
<div class="section-container grid items-center gap-12 @min-[760px]:grid-cols-2">
|
|
27
|
+
{
|
|
28
|
+
(props.eyebrow || props.heading || props.body || props.points.length > 0 || props.link) && (
|
|
29
|
+
<div class:list={['flex flex-col items-start gap-6', left && '@min-[760px]:order-2']}>
|
|
30
|
+
<SectionHeader eyebrow={props.eyebrow} heading={props.heading} marks={props.marks} field={field} />
|
|
31
|
+
{props.body && <Typography as="p" size="body" color="muted" data-field={field('body')} markdown={props.body} />}
|
|
32
|
+
{
|
|
33
|
+
props.points.length > 0 && (
|
|
34
|
+
<ul class="flex flex-col gap-3">
|
|
35
|
+
{props.points.map((point, pointIndex) => (
|
|
36
|
+
<li class="flex gap-3 text-[0.9375rem]">
|
|
37
|
+
<span class="text-accent" aria-hidden="true">
|
|
38
|
+
✓
|
|
39
|
+
</span>
|
|
40
|
+
<Typography as="div" size="body" class="text-[0.9375rem]" data-field={field(`points.${pointIndex}`)} markdown={point} />
|
|
41
|
+
</li>
|
|
42
|
+
))}
|
|
43
|
+
</ul>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
{
|
|
47
|
+
props.link && (
|
|
48
|
+
<Button {...buttonLinkProps(props.link)} variant={buttonVariant(props.link, 'secondary')} data-field={field('link.label')}>
|
|
49
|
+
{props.link.label}
|
|
50
|
+
</Button>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
</div>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
{!props.image?.hidden && (
|
|
57
|
+
<MediaFrame
|
|
58
|
+
src={props.image.src}
|
|
59
|
+
alt={props.image.alt}
|
|
60
|
+
aspectClass={left ? 'aspect-[4/4.6] @min-[760px]:order-1' : 'aspect-[4/4.6]'}
|
|
61
|
+
fit={props.image?.fit} position={props.image?.position} data-field={field('image.alt')}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
{
|
|
68
|
+
section.variant === 'wide' && (
|
|
69
|
+
<div class="section-container">
|
|
70
|
+
{
|
|
71
|
+
(props.eyebrow || props.heading || props.body || props.link) && (
|
|
72
|
+
<div class="grid items-end gap-8 @min-[760px]:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]">
|
|
73
|
+
<SectionHeader eyebrow={props.eyebrow} heading={props.heading} marks={props.marks} field={field} />
|
|
74
|
+
{
|
|
75
|
+
(props.body || props.link) && (
|
|
76
|
+
<div class="flex flex-col items-start gap-5">
|
|
77
|
+
{props.body && <Typography as="p" size="lead" color="muted" data-field={field('body')} markdown={props.body} />}
|
|
78
|
+
{props.link && (
|
|
79
|
+
<Button {...buttonLinkProps(props.link)} variant={buttonVariant(props.link, 'text')} arrow data-field={field('link.label')}>
|
|
80
|
+
{props.link.label}
|
|
81
|
+
</Button>
|
|
82
|
+
)}
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
{!props.image?.hidden && (
|
|
90
|
+
<MediaFrame src={props.image.src} alt={props.image.alt} aspectClass="mt-12 aspect-[16/7]" fit={props.image?.fit} position={props.image?.position} data-field={field('image.alt')} />
|
|
91
|
+
)}
|
|
92
|
+
{
|
|
93
|
+
props.points.length > 0 && (
|
|
94
|
+
<ol class="mt-8 grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] border-t border-[var(--line)]">
|
|
95
|
+
{props.points.map((point, pointIndex) => (
|
|
96
|
+
<li class="border-t border-[var(--line)] py-6 @min-[700px]:border-t-0 @min-[700px]:border-l @min-[700px]:px-6 @min-[700px]:first:border-l-0 @min-[700px]:first:pl-0">
|
|
97
|
+
<span class="font-mono text-[0.75rem] tracking-[0.08em] text-muted">{String(pointIndex + 1).padStart(2, '0')}</span>
|
|
98
|
+
<Typography as="div" size="body" class="mt-3" data-field={field(`points.${pointIndex}`)} markdown={point} />
|
|
99
|
+
</li>
|
|
100
|
+
))}
|
|
101
|
+
</ol>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
</div>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
</SectionShell>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { defineSection, imageSchema, linkSchema, richTextSchema, withEmphasis } from 'bearminion'
|
|
3
|
+
import { accent, eyebrow, heading } from '../shared'
|
|
4
|
+
import { textImageWireframe } from './wireframe'
|
|
5
|
+
|
|
6
|
+
export const textImageVariants = ['right', 'left', 'wide'] as const
|
|
7
|
+
|
|
8
|
+
export const textImageSchema = withEmphasis({
|
|
9
|
+
eyebrow,
|
|
10
|
+
heading,
|
|
11
|
+
body: richTextSchema.optional(),
|
|
12
|
+
/** Rich text: bold, italic, links and `code` in backticks. Plain strings render as before. */
|
|
13
|
+
points: z.array(richTextSchema),
|
|
14
|
+
link: linkSchema.optional(),
|
|
15
|
+
image: imageSchema,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export type TextImageProps = z.infer<typeof textImageSchema>
|
|
19
|
+
|
|
20
|
+
export const textImage = defineSection({
|
|
21
|
+
type: 'textImage',
|
|
22
|
+
label: 'Text + Image',
|
|
23
|
+
description: 'Text beside an image, with points and a link.',
|
|
24
|
+
schema: textImageSchema,
|
|
25
|
+
defaults: {
|
|
26
|
+
eyebrow: 'How it works',
|
|
27
|
+
heading: 'Explain it in three steps.',
|
|
28
|
+
marks: accent('Explain it in three steps.', 'three steps.'),
|
|
29
|
+
body: 'A paragraph that walks through how it works, from the first contact to the result.',
|
|
30
|
+
points: ['Step one: what happens first'],
|
|
31
|
+
link: { label: 'Learn more', href: '#' },
|
|
32
|
+
image: { src: 'placeholder', alt: '' },
|
|
33
|
+
},
|
|
34
|
+
variants: textImageVariants,
|
|
35
|
+
defaultVariant: 'right',
|
|
36
|
+
optional: { props: ['eyebrow', 'heading', 'body', 'link'] },
|
|
37
|
+
counts: { points: { recommended: 3 } },
|
|
38
|
+
wireframe: textImageWireframe,
|
|
39
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineWireframe } from 'bearminion'
|
|
2
|
+
|
|
3
|
+
/** Add section picker thumbnail: [left %, top %, width %, height %, kind]. */
|
|
4
|
+
export const textImageWireframe = defineWireframe([
|
|
5
|
+
[8, 14, 40, 72, 'block'],
|
|
6
|
+
[56, 22, 20, 5, 'text'],
|
|
7
|
+
[56, 34, 34, 8, 'title'],
|
|
8
|
+
[56, 50, 32, 4, 'text'],
|
|
9
|
+
[56, 58, 28, 4, 'text'],
|
|
10
|
+
[56, 66, 30, 4, 'text'],
|
|
11
|
+
[56, 76, 14, 9, 'button'],
|
|
12
|
+
])
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ImageMetadata } from 'astro'
|
|
2
|
+
|
|
3
|
+
const localAssets = import.meta.glob<ImageMetadata>('/src/assets/**/*.{png,jpg,jpeg,webp,gif,avif}', { eager: true, import: 'default' })
|
|
4
|
+
|
|
5
|
+
export function isRemote(src: string): boolean {
|
|
6
|
+
return /^https?:\/\//i.test(src)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Match a content path such as `src/assets/hero.png` to an imported asset. */
|
|
10
|
+
export function resolveLocalAsset(src: string): ImageMetadata | undefined {
|
|
11
|
+
const normalized = src.startsWith('/') ? src : `/${src}`
|
|
12
|
+
return localAssets[normalized]
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { twMerge } from 'tailwind-merge'
|
|
2
|
+
|
|
3
|
+
/** Merge Tailwind classes, letting later utilities win. */
|
|
4
|
+
export function cn(...classes: Array<string | false | null | undefined>): string {
|
|
5
|
+
return twMerge(classes.filter((value): value is string => Boolean(value)).join(' '))
|
|
6
|
+
}
|