@contentrain/astro-kit 0.22.0 → 0.23.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/catalog.json +25 -0
- package/components/header/Header.astro +22 -8
- package/components/header/meta.json +6 -0
- package/package.json +2 -2
package/catalog.json
CHANGED
|
@@ -1491,6 +1491,31 @@
|
|
|
1491
1491
|
"type": "string",
|
|
1492
1492
|
"description": "The site name's size where the source theme sets its own (a CSS length)."
|
|
1493
1493
|
},
|
|
1494
|
+
"bordered": {
|
|
1495
|
+
"type": "boolean",
|
|
1496
|
+
"default": true,
|
|
1497
|
+
"description": "The line under the bar on the default tone; false where the source's header draws none."
|
|
1498
|
+
},
|
|
1499
|
+
"brandWeight": {
|
|
1500
|
+
"type": "string",
|
|
1501
|
+
"description": "The site name's weight where the source theme sets its own (a CSS font-weight)."
|
|
1502
|
+
},
|
|
1503
|
+
"brandTracking": {
|
|
1504
|
+
"type": "string",
|
|
1505
|
+
"description": "The site name's letter-spacing where the source theme sets its own (a CSS length, or normal)."
|
|
1506
|
+
},
|
|
1507
|
+
"offsetTop": {
|
|
1508
|
+
"type": "string",
|
|
1509
|
+
"description": "Space above the bar where the source's header has its own (a CSS length)."
|
|
1510
|
+
},
|
|
1511
|
+
"padTop": {
|
|
1512
|
+
"type": "string",
|
|
1513
|
+
"description": "Space inside the bar above its content where the source's header has its own (a CSS length)."
|
|
1514
|
+
},
|
|
1515
|
+
"padBottom": {
|
|
1516
|
+
"type": "string",
|
|
1517
|
+
"description": "Space inside the bar below its content where the source's header has its own (a CSS length)."
|
|
1518
|
+
},
|
|
1494
1519
|
"linkNav": {
|
|
1495
1520
|
"type": "boolean",
|
|
1496
1521
|
"default": false,
|
|
@@ -20,13 +20,15 @@ const header = tv({
|
|
|
20
20
|
'brand-left': { inner: 'justify-start [&>nav]:ms-10' },
|
|
21
21
|
},
|
|
22
22
|
tone: {
|
|
23
|
-
default: { root: '
|
|
23
|
+
default: { root: 'bg-surface text-ink' },
|
|
24
24
|
inverse: { root: 'bg-ink text-surface' },
|
|
25
25
|
transparent: { root: 'absolute inset-x-0 top-0 bg-transparent text-surface' },
|
|
26
26
|
},
|
|
27
27
|
position: { static: {}, sticky: { root: 'sticky top-0' } },
|
|
28
|
+
bordered: { true: {}, false: {} },
|
|
28
29
|
},
|
|
29
|
-
|
|
30
|
+
compoundVariants: [{ tone: 'default', bordered: true, class: { root: 'border-b border-line' } }],
|
|
31
|
+
defaultVariants: { layout: 'split', tone: 'default', position: 'static', bordered: true },
|
|
30
32
|
})
|
|
31
33
|
|
|
32
34
|
interface Props {
|
|
@@ -35,6 +37,15 @@ interface Props {
|
|
|
35
37
|
tagline?: string | undefined
|
|
36
38
|
/** The site name's size, where the source theme sets its own (a CSS length). */
|
|
37
39
|
brandSize?: string | undefined
|
|
40
|
+
/** The line under the bar on the default tone; `false` where the source's header draws none. */
|
|
41
|
+
bordered?: boolean | undefined
|
|
42
|
+
/** The site name's weight and letter-spacing, where the source theme sets its own (CSS values). */
|
|
43
|
+
brandWeight?: string | undefined
|
|
44
|
+
brandTracking?: string | undefined
|
|
45
|
+
/** Space above the bar, and inside it above and below the content, where the source's header has its own (CSS lengths). */
|
|
46
|
+
offsetTop?: string | undefined
|
|
47
|
+
padTop?: string | undefined
|
|
48
|
+
padBottom?: string | undefined
|
|
38
49
|
/** The navigation in the site's link colour, as themes that colour every link do (Hello Elementor). */
|
|
39
50
|
linkNav?: boolean | undefined
|
|
40
51
|
logo?: ImageInput | undefined
|
|
@@ -51,17 +62,20 @@ interface Props {
|
|
|
51
62
|
position?: 'static' | 'sticky' | undefined
|
|
52
63
|
}
|
|
53
64
|
|
|
54
|
-
const { siteName, tagline, brandSize, linkNav, logo, showName = true, homeHref = '/', items, action, navLabel, menuLabel, closeLabel, layout, tone, position } = Astro.props
|
|
55
|
-
const { root, inner, brand } = header({ layout, tone, position })
|
|
65
|
+
const { siteName, tagline, brandSize, brandWeight, brandTracking, bordered, offsetTop, padTop, padBottom, linkNav, logo, showName = true, homeHref = '/', items, action, navLabel, menuLabel, closeLabel, layout, tone, position } = Astro.props
|
|
66
|
+
const { root, inner, brand } = header({ layout, tone, position, bordered })
|
|
67
|
+
const rootStyle = offsetTop ? `margin-top: ${offsetTop}` : undefined
|
|
68
|
+
const innerStyle = [padTop && `padding-top: ${padTop}`, padBottom && `padding-bottom: ${padBottom}`].filter(Boolean).join('; ') || undefined
|
|
69
|
+
const brandStyle = [brandSize && `font-size: ${brandSize}`, brandWeight && `font-weight: ${brandWeight}`, brandTracking && `letter-spacing: ${brandTracking}`].filter(Boolean).join('; ') || undefined
|
|
56
70
|
// A tagline under the name keeps its line on a phone, as themes print it: the navigation wraps below.
|
|
57
71
|
const wrap = tagline ? 'flex-wrap md:flex-nowrap' : undefined
|
|
58
72
|
---
|
|
59
|
-
<header class={root()}>
|
|
60
|
-
<div class={inner({ class: wrap })}>
|
|
73
|
+
<header class={root()} style={rootStyle}>
|
|
74
|
+
<div class={inner({ class: wrap })} style={innerStyle}>
|
|
61
75
|
{tagline
|
|
62
76
|
? (
|
|
63
77
|
<div class="flex min-w-0 basis-full flex-col gap-1 md:basis-auto">
|
|
64
|
-
<a href={homeHref} class={brand()} aria-label={showName ? undefined : siteName} style={
|
|
78
|
+
<a href={homeHref} class={brand()} aria-label={showName ? undefined : siteName} style={brandStyle} data-kit-brand>
|
|
65
79
|
{logo && <KitImage image={logo} priority class="h-8 w-auto" sizes="160px" />}
|
|
66
80
|
{showName && <span>{siteName}</span>}
|
|
67
81
|
</a>
|
|
@@ -69,7 +83,7 @@ const wrap = tagline ? 'flex-wrap md:flex-nowrap' : undefined
|
|
|
69
83
|
</div>
|
|
70
84
|
)
|
|
71
85
|
: (
|
|
72
|
-
<a href={homeHref} class={brand()} aria-label={showName ? undefined : siteName} style={
|
|
86
|
+
<a href={homeHref} class={brand()} aria-label={showName ? undefined : siteName} style={brandStyle} data-kit-brand>
|
|
73
87
|
{logo && <KitImage image={logo} priority class="h-8 w-auto" sizes="160px" />}
|
|
74
88
|
{showName && <span>{siteName}</span>}
|
|
75
89
|
</a>
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
"siteName": { "type": "string", "required": true, "description": "Site title (site.title)." },
|
|
15
15
|
"tagline": { "type": "string", "description": "A line under the site name, as themes that print the tagline in the header do (site.tagline)." },
|
|
16
16
|
"brandSize": { "type": "string", "description": "The site name's size where the source theme sets its own (a CSS length)." },
|
|
17
|
+
"bordered": { "type": "boolean", "default": true, "description": "The line under the bar on the default tone; false where the source's header draws none." },
|
|
18
|
+
"brandWeight": { "type": "string", "description": "The site name's weight where the source theme sets its own (a CSS font-weight)." },
|
|
19
|
+
"brandTracking": { "type": "string", "description": "The site name's letter-spacing where the source theme sets its own (a CSS length, or normal)." },
|
|
20
|
+
"offsetTop": { "type": "string", "description": "Space above the bar where the source's header has its own (a CSS length)." },
|
|
21
|
+
"padTop": { "type": "string", "description": "Space inside the bar above its content where the source's header has its own (a CSS length)." },
|
|
22
|
+
"padBottom": { "type": "string", "description": "Space inside the bar below its content where the source's header has its own (a CSS length)." },
|
|
17
23
|
"linkNav": { "type": "boolean", "default": false, "description": "The navigation in the site's link colour, as themes that colour every link do." },
|
|
18
24
|
"logo": { "type": "object", "fields": { "src": { "type": "image", "required": true }, "alt": { "type": "string", "required": true }, "width": { "type": "integer" }, "height": { "type": "integer" } }, "description": "Logo image (site.logo)." },
|
|
19
25
|
"showName": { "type": "boolean", "default": true, "description": "Show the site name next to the logo." },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentrain/astro-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Copy-in Astro components for Contentrain sites (shadcn model): typed props, tailwind-variants, zero JavaScript by default — with a machine-readable catalog",
|
|
6
6
|
"type": "module",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"mapping"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@contentrain/types": "1.
|
|
45
|
+
"@contentrain/types": "1.42.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^22.10.0",
|