@luhtech/site-template 0.3.1 → 0.3.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luhtech/site-template",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Shared Astro component library + content-instance contract for LuhTech venture marketing sites -- one template renders every site from content/page.schema.json + content/site.schema.json instances.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -36,11 +36,18 @@ const ICONS: Record<string, string> = {
36
36
  };
37
37
 
38
38
  export interface Props {
39
- name: keyof typeof ICONS;
39
+ /**
40
+ * A real ICONS key. Typed as string (not keyof typeof ICONS) because
41
+ * callers building a name from content data (block.label -> icon,
42
+ * see Section.astro's SectionIcons) can't statically narrow to the
43
+ * literal union -- an unknown name renders nothing rather than
44
+ * failing the build.
45
+ */
46
+ name: string;
40
47
  class?: string;
41
48
  }
42
49
  const { name, class: className = 'w-6 h-6' } = Astro.props;
43
- const inner = ICONS[name] ?? '';
50
+ const inner = ICONS[name as keyof typeof ICONS] ?? '';
44
51
  ---
45
52
  <svg
46
53
  xmlns="http://www.w3.org/2000/svg"
@@ -31,12 +31,28 @@ const SECTION_COMPONENTS: Record<string, any> = {
31
31
  legal: Legal,
32
32
  };
33
33
 
34
+ // icons is an optional, generic per-page mapping a consumer passes to opt a
35
+ // page into the shared line-icon set (Icon.astro) without page.schema.json
36
+ // growing an icon field -- the schema has no such field, and content
37
+ // instances can't carry one, so the mapping lives in the .astro caller
38
+ // (real venture vocabulary: block.label / sectionId -> a real ICONS key)
39
+ // and flows through here to whichever sections/*.astro component knows how
40
+ // to use it. Absent for a section kind that doesn't look at it -- a no-op,
41
+ // not an error.
42
+ export interface SectionIcons {
43
+ /** sectionId -> icon name, for a section-level heading icon. */
44
+ section?: Record<string, string>;
45
+ /** block.label -> icon name, for a per-block icon (e.g. Audiences cards). */
46
+ block?: Record<string, string>;
47
+ }
48
+
34
49
  export interface Props {
35
50
  section: any;
36
51
  site?: any;
37
52
  companyLabel?: string;
53
+ icons?: SectionIcons;
38
54
  }
39
- const { section, site, companyLabel } = Astro.props;
55
+ const { section, site, companyLabel, icons } = Astro.props;
40
56
  const Component = SECTION_COMPONENTS[section.sectionKind];
41
57
  if (!Component) {
42
58
  throw new Error(`Section.astro: unknown sectionKind "${section.sectionKind}" (id: ${section.sectionId})`);
@@ -45,7 +61,7 @@ if (!Component) {
45
61
  {section.sectionKind === 'cta' ? (
46
62
  <Cta section={section} leadCapture={site?.leadCapture} companyLabel={companyLabel} />
47
63
  ) : (
48
- <Component section={section} />
64
+ <Component section={section} icons={icons} />
49
65
  )}
50
66
  {
51
67
  // crossLinks[] is schema-legal on any section kind (not sectionKind-
@@ -24,8 +24,6 @@
24
24
  // Hero.astro for a page that wants the trigger-flow treatment, not a
25
25
  // different binding rule. A consumer still calls applyBrandDefaults()
26
26
  // and reads heading/lede off the result the same way.
27
- import CtaLink from './CtaLink.astro';
28
-
29
27
  export interface Props {
30
28
  photoSrc: string;
31
29
  photoAlt: string;
@@ -63,7 +61,7 @@ const {
63
61
 
64
62
  const rowPositions = [4, 24, 40, 62, 80, 96];
65
63
  ---
66
- <section class="relative w-full h-[85vh] min-h-[520px] overflow-hidden hero-motion" id="hero">
64
+ <section class="relative w-screen left-1/2 -translate-x-1/2 h-[85vh] min-h-[520px] overflow-hidden hero-motion" id="hero">
67
65
  <img src={photoSrc} alt={photoAlt} width="1376" height="768" class="absolute inset-0 w-full h-full object-cover" />
68
66
  <div class="absolute inset-0 hero-gradient"></div>
69
67
  {dataLines.length > 0 && (
@@ -81,8 +79,17 @@ const rowPositions = [4, 24, 40, 62, 80, 96];
81
79
  </div>
82
80
  <p class="mt-5 text-lg text-canvas/85 max-w-2xl">{lede}</p>
83
81
  {ctas.length > 0 && (
84
- <div class="mt-8 flex gap-4">
85
- {ctas.map((cta, i) => <CtaLink cta={cta} variant={i === 0 ? 'primary' : 'secondary'} />)}
82
+ <div class="mt-8 flex gap-4 flex-wrap">
83
+ {ctas.map((cta, i) => (
84
+ <a
85
+ href={cta.href}
86
+ class={i === 0
87
+ ? 'px-5 py-2.5 rounded-md bg-accent-secondary text-ink font-medium transition-all duration-200 hover:opacity-90 hover:shadow-lg hover:-translate-y-0.5 focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-secondary focus-visible:rounded'
88
+ : 'px-5 py-2.5 rounded-md border border-canvas/40 text-canvas font-medium transition-all duration-200 hover:border-canvas/70 hover:-translate-y-0.5 focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-secondary focus-visible:rounded'}
89
+ >
90
+ {cta.label}
91
+ </a>
92
+ ))}
86
93
  </div>
87
94
  )}
88
95
  </div>
@@ -1,10 +1,15 @@
1
1
  ---
2
- // sectionKind: audiences -- one block per buyer role.
2
+ // sectionKind: audiences -- one block per buyer role. icons.block (keyed by
3
+ // block.label, see Section.astro's SectionIcons) is optional -- a consumer
4
+ // with a real per-role icon set opts in; without it every card renders
5
+ // exactly as before.
3
6
  import Block from '../Block.astro';
4
7
  import CtaLink from '../CtaLink.astro';
8
+ import Icon from '../Icon.astro';
9
+ import type { SectionIcons } from '../Section.astro';
5
10
 
6
- export interface Props { section: any }
7
- const { section } = Astro.props;
11
+ export interface Props { section: any; icons?: SectionIcons }
12
+ const { section, icons } = Astro.props;
8
13
  ---
9
14
  <section id={section.sectionId} class="py-8" data-reveal>
10
15
  {section.eyebrow && <p class="text-sm font-mono uppercase tracking-wide text-accent-primary mb-3">{section.eyebrow}</p>}
@@ -12,6 +17,9 @@ const { section } = Astro.props;
12
17
  <div class="grid gap-4 sm:grid-cols-2">
13
18
  {section.blocks?.map((b: any) => (
14
19
  <div class="rounded-md border border-ink/15 p-4">
20
+ {icons?.block?.[b.label] && (
21
+ <Icon name={icons.block[b.label]} class="w-7 h-7 text-accent-primary mb-2" />
22
+ )}
15
23
  <Block block={b} />
16
24
  </div>
17
25
  ))}
@@ -3,12 +3,16 @@
3
3
  // (the schema-legal way a section names a sibling brand) render once,
4
4
  // generically, for every sectionKind -- see Section.astro.
5
5
  import Block from '../Block.astro';
6
+ import Icon from '../Icon.astro';
7
+ import type { SectionIcons } from '../Section.astro';
6
8
 
7
- export interface Props { section: any }
8
- const { section } = Astro.props;
9
+ export interface Props { section: any; icons?: SectionIcons }
10
+ const { section, icons } = Astro.props;
11
+ const sectionIcon = icons?.section?.[section.sectionId];
9
12
  ---
10
13
  <section id={section.sectionId} class="py-8" data-reveal>
11
14
  {section.eyebrow && <p class="text-sm font-mono uppercase tracking-wide text-accent-primary mb-3">{section.eyebrow}</p>}
15
+ {sectionIcon && <Icon name={sectionIcon} class="w-8 h-8 text-accent-primary mb-3" />}
12
16
  {section.heading && <h2 class="font-display text-2xl font-bold mb-3">{section.heading}</h2>}
13
17
  {section.subheading && <p class="text-ink/80 max-w-2xl mb-4">{section.subheading}</p>}
14
18
  {section.blocks?.map((b: any) => <Block block={b} class="mb-3" />)}