@vvedantb/ui 0.47.0 → 0.48.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/README.md +2 -0
- package/dist/src/marketing/SiteHeader.js +51 -45
- package/package.json +1 -1
- package/src/marketing/SiteHeader.tsx +34 -7
package/README.md
CHANGED
|
@@ -916,6 +916,8 @@ It is plain markup with no motion and needs no `createLandingKit`.
|
|
|
916
916
|
| Prop | |
|
|
917
917
|
| --- | --- |
|
|
918
918
|
| `app` | `vibot`, `vmem`, `verve`, `velth` or `vhub`. |
|
|
919
|
+
| `brand` | In place of `app`, for a site that is not a product app (0.48.0): the site's own wordmark node. Set `githubLabel` for the GitHub button's `aria-label`. |
|
|
920
|
+
| `actions` | Optional small control before the CTA, shown at every width, for example a theme toggle (0.48.0). |
|
|
919
921
|
| `homeLabel` | `aria-label` of the home wordmark link. |
|
|
920
922
|
| `homeHref` | Default `#home`. |
|
|
921
923
|
| `links` | `{ label, href }[]`, at most 4. More logs a development warning and only the first 4 render. |
|
|
@@ -129,7 +129,7 @@ function SiteHeaderMenu(t0) {
|
|
|
129
129
|
* Marketing header for the Project V apps: a `FloatingBar` with `AppWordmark` at `SITE_HEADER_WORDMARK_SIZE`, up to
|
|
130
130
|
* four links, one `cta` and an optional GitHub button. Below `md` the menu button sits on the left, the wordmark is
|
|
131
131
|
* centred, and the links, the CTA and GitHub move into one dropdown menu. Plain markup with no motion, so any app can
|
|
132
|
-
* use it.
|
|
132
|
+
* use it. A site that is not a product app passes `brand` in place of `app`.
|
|
133
133
|
*/
|
|
134
134
|
function _temp(link) {
|
|
135
135
|
return /*#__PURE__*/_jsx(DropdownMenuItem, {
|
|
@@ -142,14 +142,17 @@ function _temp(link) {
|
|
|
142
142
|
}, link.href);
|
|
143
143
|
}
|
|
144
144
|
export function SiteHeader(t0) {
|
|
145
|
-
const $ = _c(
|
|
145
|
+
const $ = _c(38);
|
|
146
146
|
const {
|
|
147
147
|
app,
|
|
148
|
+
brand,
|
|
149
|
+
githubLabel,
|
|
148
150
|
homeHref: t1,
|
|
149
151
|
homeLabel,
|
|
150
152
|
links,
|
|
151
153
|
cta,
|
|
152
154
|
githubUrl,
|
|
155
|
+
actions,
|
|
153
156
|
className
|
|
154
157
|
} = t0;
|
|
155
158
|
const homeHref = t1 === undefined ? "#home" : t1;
|
|
@@ -208,53 +211,54 @@ export function SiteHeader(t0) {
|
|
|
208
211
|
t6 = $[10];
|
|
209
212
|
}
|
|
210
213
|
let t7;
|
|
211
|
-
if ($[11] !== app) {
|
|
212
|
-
t7 = /*#__PURE__*/_jsx(AppWordmark, {
|
|
214
|
+
if ($[11] !== app || $[12] !== brand) {
|
|
215
|
+
t7 = app ? /*#__PURE__*/_jsx(AppWordmark, {
|
|
213
216
|
app: app,
|
|
214
217
|
size: SITE_HEADER_WORDMARK_SIZE
|
|
215
|
-
});
|
|
218
|
+
}) : brand;
|
|
216
219
|
$[11] = app;
|
|
217
|
-
$[12] =
|
|
220
|
+
$[12] = brand;
|
|
221
|
+
$[13] = t7;
|
|
218
222
|
} else {
|
|
219
|
-
t7 = $[
|
|
223
|
+
t7 = $[13];
|
|
220
224
|
}
|
|
221
225
|
let t8;
|
|
222
|
-
if ($[
|
|
226
|
+
if ($[14] !== homeHref || $[15] !== homeLabel || $[16] !== t7) {
|
|
223
227
|
t8 = /*#__PURE__*/_jsx("a", {
|
|
224
228
|
href: homeHref,
|
|
225
229
|
className: t6,
|
|
226
230
|
"aria-label": homeLabel,
|
|
227
231
|
children: t7
|
|
228
232
|
});
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
+
$[14] = homeHref;
|
|
234
|
+
$[15] = homeLabel;
|
|
235
|
+
$[16] = t7;
|
|
236
|
+
$[17] = t8;
|
|
233
237
|
} else {
|
|
234
|
-
t8 = $[
|
|
238
|
+
t8 = $[17];
|
|
235
239
|
}
|
|
236
240
|
let t9;
|
|
237
|
-
if ($[
|
|
241
|
+
if ($[18] !== shown) {
|
|
238
242
|
t9 = shown.map(_temp2);
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
243
|
+
$[18] = shown;
|
|
244
|
+
$[19] = t9;
|
|
241
245
|
} else {
|
|
242
|
-
t9 = $[
|
|
246
|
+
t9 = $[19];
|
|
243
247
|
}
|
|
244
248
|
let t10;
|
|
245
|
-
if ($[
|
|
249
|
+
if ($[20] !== t9) {
|
|
246
250
|
t10 = /*#__PURE__*/_jsx("nav", {
|
|
247
251
|
className: "hidden items-center gap-1 md:flex",
|
|
248
252
|
"aria-label": "Page",
|
|
249
253
|
children: t9
|
|
250
254
|
});
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
255
|
+
$[20] = t9;
|
|
256
|
+
$[21] = t10;
|
|
253
257
|
} else {
|
|
254
|
-
t10 = $[
|
|
258
|
+
t10 = $[21];
|
|
255
259
|
}
|
|
256
260
|
let t11;
|
|
257
|
-
if ($[
|
|
261
|
+
if ($[22] !== app || $[23] !== githubLabel || $[24] !== githubUrl) {
|
|
258
262
|
t11 = githubUrl ? /*#__PURE__*/_jsx(Button, {
|
|
259
263
|
asChild: true,
|
|
260
264
|
variant: "ghost",
|
|
@@ -264,56 +268,58 @@ export function SiteHeader(t0) {
|
|
|
264
268
|
href: githubUrl,
|
|
265
269
|
target: "_blank",
|
|
266
270
|
rel: "noreferrer",
|
|
267
|
-
"aria-label": `${app} on GitHub
|
|
271
|
+
"aria-label": app ? `${app} on GitHub` : githubLabel ?? "GitHub",
|
|
268
272
|
children: /*#__PURE__*/_jsx(GitHubIcon, {
|
|
269
273
|
size: 18
|
|
270
274
|
})
|
|
271
275
|
})
|
|
272
276
|
}) : null;
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
277
|
+
$[22] = app;
|
|
278
|
+
$[23] = githubLabel;
|
|
279
|
+
$[24] = githubUrl;
|
|
280
|
+
$[25] = t11;
|
|
276
281
|
} else {
|
|
277
|
-
t11 = $[
|
|
282
|
+
t11 = $[25];
|
|
278
283
|
}
|
|
279
284
|
let t12;
|
|
280
|
-
if ($[
|
|
285
|
+
if ($[26] !== cta) {
|
|
281
286
|
t12 = /*#__PURE__*/_jsx("div", {
|
|
282
287
|
className: "hidden md:flex",
|
|
283
288
|
children: cta
|
|
284
289
|
});
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
290
|
+
$[26] = cta;
|
|
291
|
+
$[27] = t12;
|
|
287
292
|
} else {
|
|
288
|
-
t12 = $[
|
|
293
|
+
t12 = $[27];
|
|
289
294
|
}
|
|
290
295
|
let t13;
|
|
291
|
-
if ($[
|
|
296
|
+
if ($[28] !== actions || $[29] !== t11 || $[30] !== t12) {
|
|
292
297
|
t13 = /*#__PURE__*/_jsxs("div", {
|
|
293
298
|
className: "flex items-center gap-1.5",
|
|
294
|
-
children: [t11, t12]
|
|
299
|
+
children: [t11, actions, t12]
|
|
295
300
|
});
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
301
|
+
$[28] = actions;
|
|
302
|
+
$[29] = t11;
|
|
303
|
+
$[30] = t12;
|
|
304
|
+
$[31] = t13;
|
|
299
305
|
} else {
|
|
300
|
-
t13 = $[
|
|
306
|
+
t13 = $[31];
|
|
301
307
|
}
|
|
302
308
|
let t14;
|
|
303
|
-
if ($[
|
|
309
|
+
if ($[32] !== className || $[33] !== t10 || $[34] !== t13 || $[35] !== t5 || $[36] !== t8) {
|
|
304
310
|
t14 = /*#__PURE__*/_jsxs(FloatingBar, {
|
|
305
311
|
className: className,
|
|
306
312
|
barClassName: "justify-between gap-3 md:pl-5",
|
|
307
313
|
children: [t5, t8, t10, t13]
|
|
308
314
|
});
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
+
$[32] = className;
|
|
316
|
+
$[33] = t10;
|
|
317
|
+
$[34] = t13;
|
|
318
|
+
$[35] = t5;
|
|
319
|
+
$[36] = t8;
|
|
320
|
+
$[37] = t14;
|
|
315
321
|
} else {
|
|
316
|
-
t14 = $[
|
|
322
|
+
t14 = $[37];
|
|
317
323
|
}
|
|
318
324
|
return t14;
|
|
319
325
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
|
|
6
6
|
"type": "module",
|
|
@@ -21,9 +21,22 @@ const MAX_LINKS = 4;
|
|
|
21
21
|
|
|
22
22
|
export type SiteHeaderLink = { label: string; href: string };
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
type SiteHeaderIdentity =
|
|
25
|
+
| {
|
|
26
|
+
/** Product app id for `AppWordmark`. */
|
|
27
|
+
app: ProductAppName;
|
|
28
|
+
brand?: undefined;
|
|
29
|
+
githubLabel?: undefined;
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
app?: undefined;
|
|
33
|
+
/** The site's own wordmark, for a site that is not a product app. It replaces `AppWordmark`. */
|
|
34
|
+
brand: ReactNode;
|
|
35
|
+
/** `aria-label` of the GitHub button, for example "Bee on GitHub". Default "GitHub". */
|
|
36
|
+
githubLabel?: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type SiteHeaderProps = SiteHeaderIdentity & {
|
|
27
40
|
/** Home link `href`. Default `#home`. */
|
|
28
41
|
homeHref?: string;
|
|
29
42
|
/** `aria-label` of the home wordmark link. */
|
|
@@ -38,6 +51,8 @@ export type SiteHeaderProps = {
|
|
|
38
51
|
cta: ReactNode;
|
|
39
52
|
/** Optional GitHub URL. An icon button from `sm`, and the last item in the mobile menu. */
|
|
40
53
|
githubUrl?: string;
|
|
54
|
+
/** Optional small control before the CTA, shown at every width, for example a theme toggle. */
|
|
55
|
+
actions?: ReactNode;
|
|
41
56
|
/** Classes for the fixed `<header>` wrapper. */
|
|
42
57
|
className?: string;
|
|
43
58
|
};
|
|
@@ -88,9 +103,20 @@ function SiteHeaderMenu({ links, cta, githubUrl }: Pick<SiteHeaderProps, "links"
|
|
|
88
103
|
* Marketing header for the Project V apps: a `FloatingBar` with `AppWordmark` at `SITE_HEADER_WORDMARK_SIZE`, up to
|
|
89
104
|
* four links, one `cta` and an optional GitHub button. Below `md` the menu button sits on the left, the wordmark is
|
|
90
105
|
* centred, and the links, the CTA and GitHub move into one dropdown menu. Plain markup with no motion, so any app can
|
|
91
|
-
* use it.
|
|
106
|
+
* use it. A site that is not a product app passes `brand` in place of `app`.
|
|
92
107
|
*/
|
|
93
|
-
export function SiteHeader({
|
|
108
|
+
export function SiteHeader({
|
|
109
|
+
app,
|
|
110
|
+
brand,
|
|
111
|
+
githubLabel,
|
|
112
|
+
homeHref = "#home",
|
|
113
|
+
homeLabel,
|
|
114
|
+
links,
|
|
115
|
+
cta,
|
|
116
|
+
githubUrl,
|
|
117
|
+
actions,
|
|
118
|
+
className,
|
|
119
|
+
}: SiteHeaderProps) {
|
|
94
120
|
const tooMany = links.length > MAX_LINKS;
|
|
95
121
|
useEffect(() => {
|
|
96
122
|
if (!tooMany) return;
|
|
@@ -112,7 +138,7 @@ export function SiteHeader({ app, homeHref = "#home", homeLabel, links, cta, git
|
|
|
112
138
|
)}
|
|
113
139
|
aria-label={homeLabel}
|
|
114
140
|
>
|
|
115
|
-
<AppWordmark app={app} size={SITE_HEADER_WORDMARK_SIZE} />
|
|
141
|
+
{app ? <AppWordmark app={app} size={SITE_HEADER_WORDMARK_SIZE} /> : brand}
|
|
116
142
|
</a>
|
|
117
143
|
|
|
118
144
|
<nav className="hidden items-center gap-1 md:flex" aria-label="Page">
|
|
@@ -126,11 +152,12 @@ export function SiteHeader({ app, homeHref = "#home", homeLabel, links, cta, git
|
|
|
126
152
|
<div className="flex items-center gap-1.5">
|
|
127
153
|
{githubUrl ? (
|
|
128
154
|
<Button asChild variant="ghost" size="icon-sm" className="hidden rounded-full sm:inline-flex">
|
|
129
|
-
<a href={githubUrl} target="_blank" rel="noreferrer" aria-label={`${app} on GitHub`}>
|
|
155
|
+
<a href={githubUrl} target="_blank" rel="noreferrer" aria-label={app ? `${app} on GitHub` : (githubLabel ?? "GitHub")}>
|
|
130
156
|
<GitHubIcon size={18} />
|
|
131
157
|
</a>
|
|
132
158
|
</Button>
|
|
133
159
|
) : null}
|
|
160
|
+
{actions}
|
|
134
161
|
<div className="hidden md:flex">{cta}</div>
|
|
135
162
|
</div>
|
|
136
163
|
</FloatingBar>
|