@vvedantb/ui 0.45.0 → 0.46.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 CHANGED
@@ -899,8 +899,9 @@ for the footer's `actions` slot `landingFooterLinkClass` (a text link) and
899
899
  ### `SiteHeader`
900
900
 
901
901
  Marketing header (0.38.0): `AppWordmark` at `SITE_HEADER_WORDMARK_SIZE` (20px, icon 28px; no size prop), up to four
902
- links from `md`, one CTA and an optional GitHub button. Below `md` the links, the CTA and GitHub sit in one full-width
903
- dropdown menu, in that order. It is plain markup with no motion and needs no `createLandingKit`.
902
+ links from `md`, one CTA and an optional GitHub button, in a `FloatingBar`. Below `md` the menu button sits on the
903
+ left, the wordmark is centred, and the links, the CTA and GitHub sit in one full-width dropdown menu, in that order.
904
+ It is plain markup with no motion and needs no `createLandingKit`.
904
905
 
905
906
  ```tsx
906
907
  <SiteHeader
@@ -921,7 +922,28 @@ dropdown menu, in that order. It is plain markup with no motion and needs no `cr
921
922
  | `cta` | One node. Use `Button` (default variant) with `size="sm"` and `className="rounded-full"`. Shows in the bar from `md` and full width in the menu below. No second slot. |
922
923
  | `githubUrl` | Optional. Ghost icon button from `sm`, labelled "{app} on GitHub", and the last menu item. |
923
924
 
924
- The bar is `sticky top-0 z-50`, `h-14 sm:h-16`, `bg-background/80 backdrop-blur-md` with a `border-separator` bottom border.
925
+ `className` goes on the fixed `<header>` wrapper.
926
+
927
+ ### `FloatingBar`
928
+
929
+ The floating pill that `SiteHeader` sits in: a transparent `fixed top-0 z-50` `<header>` with a `rounded-full`,
930
+ `h-14`, `max-w-4xl` bar on `floatingSurfaceClass`. A spacer of the same height holds its place, so the page needs no
931
+ top padding. It is fixed, not sticky, because `sticky` stops working inside a wrapper that sets `overflow-x-hidden`.
932
+ Only the pill takes pointer events. Use it directly when the header needs its own navigation, such as a menu with panels.
933
+
934
+ ```tsx
935
+ <FloatingBar barClassName="justify-between pl-5">
936
+ <Logo />
937
+ <MyNavigation />
938
+ </FloatingBar>
939
+ ```
940
+
941
+ | Prop | |
942
+ | --- | --- |
943
+ | `children` | The bar's content, laid out in one flex row. |
944
+ | `className` | Classes for the `<header>` wrapper, for example an entrance animation. |
945
+ | `barClassName` | Classes for the pill, for example another `max-w-*`. |
946
+
925
947
  `createLandingKit().LandingNav` and `LandingNavMenu` are deprecated in favour of `SiteHeader`.
926
948
 
927
949
  ### `SiteFooter`
@@ -187,6 +187,7 @@ export { railBadgeClass, railTileClass, SIDEBAR_RAIL_APP_ICON_SIZE, railTileStat
187
187
  export { LandingFeatureCard, LandingFooter, LandingLattice, LandingNavMenu, LandingPageLayout, LandingSection, LandingSectionHeading, landingItemVariants } from "./marketing/landing.js";
188
188
  export { createLandingKit } from "./marketing/createLandingKit.js";
189
189
  export { landingFooterButtonClass, landingFooterLinkClass, landingPanelClass, landingShellClass } from "./marketing/marketing-classes.js";
190
+ export { FloatingBar } from "./marketing/FloatingBar.js";
190
191
  export { SITE_HEADER_WORDMARK_SIZE, SiteHeader } from "./marketing/SiteHeader.js";
191
192
  export { PROJECT_V_LEGAL_LINKS, PROJECT_V_SOCIALS, SITE_FOOTER_WORDMARK_SIZE, SiteFooter } from "./marketing/SiteFooter.js";
192
193
  export { ProductHero } from "./marketing/ProductHero.js";
package/dist/src/index.js CHANGED
@@ -187,6 +187,7 @@ export { railBadgeClass, railTileClass, SIDEBAR_RAIL_APP_ICON_SIZE, railTileStat
187
187
  export { LandingFeatureCard, LandingFooter, LandingLattice, LandingNavMenu, LandingPageLayout, LandingSection, LandingSectionHeading, landingItemVariants } from "./marketing/landing.js";
188
188
  export { createLandingKit } from "./marketing/createLandingKit.js";
189
189
  export { landingFooterButtonClass, landingFooterLinkClass, landingPanelClass, landingShellClass } from "./marketing/marketing-classes.js";
190
+ export { FloatingBar } from "./marketing/FloatingBar.js";
190
191
  export { SITE_HEADER_WORDMARK_SIZE, SiteHeader } from "./marketing/SiteHeader.js";
191
192
  export { PROJECT_V_LEGAL_LINKS, PROJECT_V_SOCIALS, SITE_FOOTER_WORDMARK_SIZE, SiteFooter } from "./marketing/SiteFooter.js";
192
193
  export { ProductHero } from "./marketing/ProductHero.js";
@@ -0,0 +1,74 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { floatingSurfaceClass } from "../ui/_menu-classes.js";
3
+ import { cn } from "../utils/cn.js";
4
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
5
+ /**
6
+ * The floating pill that marketing headers sit in: a fixed, transparent `<header>` with a rounded bar on the shared
7
+ * floating surface. A spacer of the same height holds its place in the page, so the page needs no top padding. It is
8
+ * fixed, not sticky, because `sticky` stops working inside a wrapper that sets `overflow-x-hidden`. Only the pill
9
+ * takes pointer events; the gap around it lets clicks through. `SiteHeader` is built on it. Use it directly when the
10
+ * header needs its own navigation, such as a menu with panels.
11
+ */
12
+ export function FloatingBar(t0) {
13
+ const $ = _c(11);
14
+ const {
15
+ children,
16
+ className,
17
+ barClassName
18
+ } = t0;
19
+ let t1;
20
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
21
+ t1 = /*#__PURE__*/_jsx("div", {
22
+ "aria-hidden": "true",
23
+ "data-floating-bar-spacer": "",
24
+ className: "h-[4.25rem] sm:h-[4.5rem]"
25
+ });
26
+ $[0] = t1;
27
+ } else {
28
+ t1 = $[0];
29
+ }
30
+ let t2;
31
+ if ($[1] !== className) {
32
+ t2 = cn("pointer-events-none fixed inset-x-0 top-0 z-50 px-4 pt-3 sm:pt-4", className);
33
+ $[1] = className;
34
+ $[2] = t2;
35
+ } else {
36
+ t2 = $[2];
37
+ }
38
+ let t3;
39
+ if ($[3] !== barClassName) {
40
+ t3 = cn(floatingSurfaceClass, "pointer-events-auto relative mx-auto flex h-14 w-full max-w-4xl items-center rounded-full px-2", barClassName);
41
+ $[3] = barClassName;
42
+ $[4] = t3;
43
+ } else {
44
+ t3 = $[4];
45
+ }
46
+ let t4;
47
+ if ($[5] !== children || $[6] !== t3) {
48
+ t4 = /*#__PURE__*/_jsx("div", {
49
+ "data-floating-bar": "",
50
+ className: t3,
51
+ children: children
52
+ });
53
+ $[5] = children;
54
+ $[6] = t3;
55
+ $[7] = t4;
56
+ } else {
57
+ t4 = $[7];
58
+ }
59
+ let t5;
60
+ if ($[8] !== t2 || $[9] !== t4) {
61
+ t5 = /*#__PURE__*/_jsxs(_Fragment, {
62
+ children: [t1, /*#__PURE__*/_jsx("header", {
63
+ className: t2,
64
+ children: t4
65
+ })]
66
+ });
67
+ $[8] = t2;
68
+ $[9] = t4;
69
+ $[10] = t5;
70
+ } else {
71
+ t5 = $[10];
72
+ }
73
+ return t5;
74
+ }
@@ -6,7 +6,8 @@ import { GitHubIcon } from "../logos/index.js";
6
6
  import { Button } from "../ui/button.js";
7
7
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../ui/dropdown-menu.js";
8
8
  import { cn } from "../utils/cn.js";
9
- import { landingClasses, landingShellClass } from "./marketing-classes.js";
9
+ import { FloatingBar } from "./FloatingBar.js";
10
+ import { landingClasses } from "./marketing-classes.js";
10
11
 
11
12
  /** Wordmark text size in px. The icon is `Math.round(20 * 1.4)` = 28px. There is no size prop. */
12
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -41,7 +42,7 @@ function SiteHeaderMenu(t0) {
41
42
  variant: "ghost",
42
43
  size: "icon-sm",
43
44
  "aria-label": t1,
44
- className: "md:hidden",
45
+ className: "rounded-full md:hidden",
45
46
  children: t2
46
47
  })
47
48
  });
@@ -95,7 +96,8 @@ function SiteHeaderMenu(t0) {
95
96
  let t7;
96
97
  if ($[11] !== t4 || $[12] !== t5 || $[13] !== t6) {
97
98
  t7 = /*#__PURE__*/_jsxs(DropdownMenuContent, {
98
- align: "end",
99
+ align: "start",
100
+ sideOffset: 12,
99
101
  className: "max-h-[70dvh] w-[calc(100vw-2.5rem)] max-w-none overflow-y-auto sm:w-[calc(100vw-4rem)]",
100
102
  children: [t4, t5, t6]
101
103
  });
@@ -124,9 +126,10 @@ function SiteHeaderMenu(t0) {
124
126
  }
125
127
 
126
128
  /**
127
- * Marketing header for the Project V apps: sticky, blurred, `AppWordmark` at `SITE_HEADER_WORDMARK_SIZE`, up to four
128
- * links, one `cta` and an optional GitHub button. Below `md` the links, the CTA and GitHub move into one dropdown menu.
129
- * Plain markup with no motion, so any app can use it.
129
+ * Marketing header for the Project V apps: a `FloatingBar` with `AppWordmark` at `SITE_HEADER_WORDMARK_SIZE`, up to
130
+ * four links, one `cta` and an optional GitHub button. Below `md` the menu button sits on the left, the wordmark is
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.
130
133
  */
131
134
  function _temp(link) {
132
135
  return /*#__PURE__*/_jsx(DropdownMenuItem, {
@@ -139,7 +142,7 @@ function _temp(link) {
139
142
  }, link.href);
140
143
  }
141
144
  export function SiteHeader(t0) {
142
- const $ = _c(51);
145
+ const $ = _c(35);
143
146
  const {
144
147
  app,
145
148
  homeHref: t1,
@@ -174,105 +177,89 @@ export function SiteHeader(t0) {
174
177
  t3 = $[3];
175
178
  }
176
179
  useEffect(t2, t3);
177
- let shown;
178
180
  let t4;
181
+ if ($[4] !== links) {
182
+ t4 = links.slice(0, MAX_LINKS);
183
+ $[4] = links;
184
+ $[5] = t4;
185
+ } else {
186
+ t4 = $[5];
187
+ }
188
+ const shown = t4;
179
189
  let t5;
190
+ if ($[6] !== cta || $[7] !== githubUrl || $[8] !== shown) {
191
+ t5 = /*#__PURE__*/_jsx(SiteHeaderMenu, {
192
+ links: shown,
193
+ cta: cta,
194
+ githubUrl: githubUrl
195
+ });
196
+ $[6] = cta;
197
+ $[7] = githubUrl;
198
+ $[8] = shown;
199
+ $[9] = t5;
200
+ } else {
201
+ t5 = $[9];
202
+ }
180
203
  let t6;
204
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
205
+ t6 = cn("group min-w-0 shrink-0 rounded-lg max-md:absolute max-md:left-1/2 max-md:-translate-x-1/2", focusRing);
206
+ $[10] = t6;
207
+ } else {
208
+ t6 = $[10];
209
+ }
181
210
  let t7;
211
+ if ($[11] !== app) {
212
+ t7 = /*#__PURE__*/_jsx(AppWordmark, {
213
+ app: app,
214
+ size: SITE_HEADER_WORDMARK_SIZE
215
+ });
216
+ $[11] = app;
217
+ $[12] = t7;
218
+ } else {
219
+ t7 = $[12];
220
+ }
182
221
  let t8;
222
+ if ($[13] !== homeHref || $[14] !== homeLabel || $[15] !== t7) {
223
+ t8 = /*#__PURE__*/_jsx("a", {
224
+ href: homeHref,
225
+ className: t6,
226
+ "aria-label": homeLabel,
227
+ children: t7
228
+ });
229
+ $[13] = homeHref;
230
+ $[14] = homeLabel;
231
+ $[15] = t7;
232
+ $[16] = t8;
233
+ } else {
234
+ t8 = $[16];
235
+ }
183
236
  let t9;
184
- if ($[4] !== app || $[5] !== className || $[6] !== homeHref || $[7] !== homeLabel || $[8] !== links) {
185
- shown = links.slice(0, MAX_LINKS);
186
- if ($[16] !== className) {
187
- t9 = cn("sticky top-0 z-50 border-b border-separator bg-background/80 backdrop-blur-md", className);
188
- $[16] = className;
189
- $[17] = t9;
190
- } else {
191
- t9 = $[17];
192
- }
193
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
194
- t7 = cn(landingShellClass, "flex h-14 items-center justify-between gap-3 sm:h-16");
195
- $[18] = t7;
196
- } else {
197
- t7 = $[18];
198
- }
199
- let t10;
200
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
201
- t10 = cn("group min-w-0 shrink-0 rounded-lg", focusRing);
202
- $[19] = t10;
203
- } else {
204
- t10 = $[19];
205
- }
206
- let t11;
207
- if ($[20] !== app) {
208
- t11 = /*#__PURE__*/_jsx(AppWordmark, {
209
- app: app,
210
- size: SITE_HEADER_WORDMARK_SIZE
211
- });
212
- $[20] = app;
213
- $[21] = t11;
214
- } else {
215
- t11 = $[21];
216
- }
217
- if ($[22] !== homeHref || $[23] !== homeLabel || $[24] !== t11) {
218
- t8 = /*#__PURE__*/_jsx("a", {
219
- href: homeHref,
220
- className: t10,
221
- "aria-label": homeLabel,
222
- children: t11
223
- });
224
- $[22] = homeHref;
225
- $[23] = homeLabel;
226
- $[24] = t11;
227
- $[25] = t8;
228
- } else {
229
- t8 = $[25];
230
- }
231
- t4 = "hidden items-center gap-1 md:flex";
232
- t5 = "Page";
233
- t6 = shown.map(_temp2);
234
- $[4] = app;
235
- $[5] = className;
236
- $[6] = homeHref;
237
- $[7] = homeLabel;
238
- $[8] = links;
239
- $[9] = shown;
240
- $[10] = t4;
241
- $[11] = t5;
242
- $[12] = t6;
243
- $[13] = t7;
244
- $[14] = t8;
245
- $[15] = t9;
237
+ if ($[17] !== shown) {
238
+ t9 = shown.map(_temp2);
239
+ $[17] = shown;
240
+ $[18] = t9;
246
241
  } else {
247
- shown = $[9];
248
- t4 = $[10];
249
- t5 = $[11];
250
- t6 = $[12];
251
- t7 = $[13];
252
- t8 = $[14];
253
- t9 = $[15];
242
+ t9 = $[18];
254
243
  }
255
244
  let t10;
256
- if ($[26] !== t4 || $[27] !== t5 || $[28] !== t6) {
245
+ if ($[19] !== t9) {
257
246
  t10 = /*#__PURE__*/_jsx("nav", {
258
- className: t4,
259
- "aria-label": t5,
260
- children: t6
247
+ className: "hidden items-center gap-1 md:flex",
248
+ "aria-label": "Page",
249
+ children: t9
261
250
  });
262
- $[26] = t4;
263
- $[27] = t5;
264
- $[28] = t6;
265
- $[29] = t10;
251
+ $[19] = t9;
252
+ $[20] = t10;
266
253
  } else {
267
- t10 = $[29];
254
+ t10 = $[20];
268
255
  }
269
256
  let t11;
270
- if ($[30] !== app || $[31] !== githubUrl) {
257
+ if ($[21] !== app || $[22] !== githubUrl) {
271
258
  t11 = githubUrl ? /*#__PURE__*/_jsx(Button, {
272
259
  asChild: true,
273
260
  variant: "ghost",
274
261
  size: "icon-sm",
275
- className: "hidden sm:inline-flex",
262
+ className: "hidden rounded-full sm:inline-flex",
276
263
  children: /*#__PURE__*/_jsx("a", {
277
264
  href: githubUrl,
278
265
  target: "_blank",
@@ -283,82 +270,57 @@ export function SiteHeader(t0) {
283
270
  })
284
271
  })
285
272
  }) : null;
286
- $[30] = app;
287
- $[31] = githubUrl;
288
- $[32] = t11;
273
+ $[21] = app;
274
+ $[22] = githubUrl;
275
+ $[23] = t11;
289
276
  } else {
290
- t11 = $[32];
277
+ t11 = $[23];
291
278
  }
292
279
  let t12;
293
- if ($[33] !== cta) {
280
+ if ($[24] !== cta) {
294
281
  t12 = /*#__PURE__*/_jsx("div", {
295
282
  className: "hidden md:flex",
296
283
  children: cta
297
284
  });
298
- $[33] = cta;
299
- $[34] = t12;
285
+ $[24] = cta;
286
+ $[25] = t12;
300
287
  } else {
301
- t12 = $[34];
288
+ t12 = $[25];
302
289
  }
303
290
  let t13;
304
- if ($[35] !== cta || $[36] !== githubUrl || $[37] !== shown) {
305
- t13 = /*#__PURE__*/_jsx(SiteHeaderMenu, {
306
- links: shown,
307
- cta: cta,
308
- githubUrl: githubUrl
309
- });
310
- $[35] = cta;
311
- $[36] = githubUrl;
312
- $[37] = shown;
313
- $[38] = t13;
314
- } else {
315
- t13 = $[38];
316
- }
317
- let t14;
318
- if ($[39] !== t11 || $[40] !== t12 || $[41] !== t13) {
319
- t14 = /*#__PURE__*/_jsxs("div", {
291
+ if ($[26] !== t11 || $[27] !== t12) {
292
+ t13 = /*#__PURE__*/_jsxs("div", {
320
293
  className: "flex items-center gap-1.5",
321
- children: [t11, t12, t13]
294
+ children: [t11, t12]
322
295
  });
323
- $[39] = t11;
324
- $[40] = t12;
325
- $[41] = t13;
326
- $[42] = t14;
296
+ $[26] = t11;
297
+ $[27] = t12;
298
+ $[28] = t13;
327
299
  } else {
328
- t14 = $[42];
300
+ t13 = $[28];
329
301
  }
330
- let t15;
331
- if ($[43] !== t10 || $[44] !== t14 || $[45] !== t7 || $[46] !== t8) {
332
- t15 = /*#__PURE__*/_jsxs("div", {
333
- className: t7,
334
- children: [t8, t10, t14]
335
- });
336
- $[43] = t10;
337
- $[44] = t14;
338
- $[45] = t7;
339
- $[46] = t8;
340
- $[47] = t15;
341
- } else {
342
- t15 = $[47];
343
- }
344
- let t16;
345
- if ($[48] !== t15 || $[49] !== t9) {
346
- t16 = /*#__PURE__*/_jsx("header", {
347
- className: t9,
348
- children: t15
302
+ let t14;
303
+ if ($[29] !== className || $[30] !== t10 || $[31] !== t13 || $[32] !== t5 || $[33] !== t8) {
304
+ t14 = /*#__PURE__*/_jsxs(FloatingBar, {
305
+ className: className,
306
+ barClassName: "justify-between gap-3 md:pl-5",
307
+ children: [t5, t8, t10, t13]
349
308
  });
350
- $[48] = t15;
351
- $[49] = t9;
352
- $[50] = t16;
309
+ $[29] = className;
310
+ $[30] = t10;
311
+ $[31] = t13;
312
+ $[32] = t5;
313
+ $[33] = t8;
314
+ $[34] = t14;
353
315
  } else {
354
- t16 = $[50];
316
+ t14 = $[34];
355
317
  }
356
- return t16;
318
+ return t14;
357
319
  }
358
320
  function _temp2(link) {
359
321
  return /*#__PURE__*/_jsx("a", {
360
322
  href: link.href,
361
- className: landingClasses.navLink,
323
+ className: cn(landingClasses.navLink, "rounded-full"),
362
324
  children: link.label
363
325
  }, link.href);
364
326
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/ui",
3
- "version": "0.45.0",
3
+ "version": "0.46.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",
package/src/client.ts CHANGED
@@ -320,6 +320,8 @@ export {
320
320
  landingPanelClass,
321
321
  landingShellClass,
322
322
  } from "./marketing/marketing-classes";
323
+ export { FloatingBar } from "./marketing/FloatingBar";
324
+ export type { FloatingBarProps } from "./marketing/FloatingBar";
323
325
  export { SITE_HEADER_WORDMARK_SIZE, SiteHeader } from "./marketing/SiteHeader";
324
326
  export type { SiteHeaderLink, SiteHeaderProps } from "./marketing/SiteHeader";
325
327
  export type { PricingModalTone, SiteFooterVariant } from "./marketing/marketing-classes";
package/src/index.ts CHANGED
@@ -320,6 +320,8 @@ export {
320
320
  landingPanelClass,
321
321
  landingShellClass,
322
322
  } from "./marketing/marketing-classes";
323
+ export { FloatingBar } from "./marketing/FloatingBar";
324
+ export type { FloatingBarProps } from "./marketing/FloatingBar";
323
325
  export { SITE_HEADER_WORDMARK_SIZE, SiteHeader } from "./marketing/SiteHeader";
324
326
  export type { SiteHeaderLink, SiteHeaderProps } from "./marketing/SiteHeader";
325
327
  export type { PricingModalTone, SiteFooterVariant } from "./marketing/marketing-classes";
@@ -0,0 +1,39 @@
1
+ import type { ReactNode } from "react";
2
+ import { floatingSurfaceClass } from "../ui/_menu-classes";
3
+ import { cn } from "../utils/cn";
4
+
5
+ export type FloatingBarProps = {
6
+ /** The bar's content, laid out in one row. */
7
+ children: ReactNode;
8
+ /** Classes for the fixed `<header>` wrapper, for example an entrance animation. */
9
+ className?: string;
10
+ /** Classes for the pill itself, for example another `max-w-*`. */
11
+ barClassName?: string;
12
+ };
13
+
14
+ /**
15
+ * The floating pill that marketing headers sit in: a fixed, transparent `<header>` with a rounded bar on the shared
16
+ * floating surface. A spacer of the same height holds its place in the page, so the page needs no top padding. It is
17
+ * fixed, not sticky, because `sticky` stops working inside a wrapper that sets `overflow-x-hidden`. Only the pill
18
+ * takes pointer events; the gap around it lets clicks through. `SiteHeader` is built on it. Use it directly when the
19
+ * header needs its own navigation, such as a menu with panels.
20
+ */
21
+ export function FloatingBar({ children, className, barClassName }: FloatingBarProps) {
22
+ return (
23
+ <>
24
+ <div aria-hidden="true" data-floating-bar-spacer="" className="h-[4.25rem] sm:h-[4.5rem]" />
25
+ <header className={cn("pointer-events-none fixed inset-x-0 top-0 z-50 px-4 pt-3 sm:pt-4", className)}>
26
+ <div
27
+ data-floating-bar=""
28
+ className={cn(
29
+ floatingSurfaceClass,
30
+ "pointer-events-auto relative mx-auto flex h-14 w-full max-w-4xl items-center rounded-full px-2",
31
+ barClassName,
32
+ )}
33
+ >
34
+ {children}
35
+ </div>
36
+ </header>
37
+ </>
38
+ );
39
+ }
@@ -11,7 +11,8 @@ import {
11
11
  DropdownMenuTrigger,
12
12
  } from "../ui/dropdown-menu";
13
13
  import { cn } from "../utils/cn";
14
- import { landingClasses, landingShellClass } from "./marketing-classes";
14
+ import { FloatingBar } from "./FloatingBar";
15
+ import { landingClasses } from "./marketing-classes";
15
16
 
16
17
  /** Wordmark text size in px. The icon is `Math.round(20 * 1.4)` = 28px. There is no size prop. */
17
18
  export const SITE_HEADER_WORDMARK_SIZE = 20;
@@ -37,6 +38,7 @@ export type SiteHeaderProps = {
37
38
  cta: ReactNode;
38
39
  /** Optional GitHub URL. An icon button from `sm`, and the last item in the mobile menu. */
39
40
  githubUrl?: string;
41
+ /** Classes for the fixed `<header>` wrapper. */
40
42
  className?: string;
41
43
  };
42
44
 
@@ -49,12 +51,13 @@ function SiteHeaderMenu({ links, cta, githubUrl }: Pick<SiteHeaderProps, "links"
49
51
  return (
50
52
  <DropdownMenu open={open} onOpenChange={setOpen}>
51
53
  <DropdownMenuTrigger asChild>
52
- <Button variant="ghost" size="icon-sm" aria-label={open ? "Close menu" : "Open menu"} className="md:hidden">
54
+ <Button variant="ghost" size="icon-sm" aria-label={open ? "Close menu" : "Open menu"} className="rounded-full md:hidden">
53
55
  <Icon size={20} />
54
56
  </Button>
55
57
  </DropdownMenuTrigger>
56
58
  <DropdownMenuContent
57
- align="end"
59
+ align="start"
60
+ sideOffset={12}
58
61
  className="max-h-[70dvh] w-[calc(100vw-2.5rem)] max-w-none overflow-y-auto sm:w-[calc(100vw-4rem)]"
59
62
  >
60
63
  {links.slice(0, MAX_LINKS).map((link) => (
@@ -82,9 +85,10 @@ function SiteHeaderMenu({ links, cta, githubUrl }: Pick<SiteHeaderProps, "links"
82
85
  }
83
86
 
84
87
  /**
85
- * Marketing header for the Project V apps: sticky, blurred, `AppWordmark` at `SITE_HEADER_WORDMARK_SIZE`, up to four
86
- * links, one `cta` and an optional GitHub button. Below `md` the links, the CTA and GitHub move into one dropdown menu.
87
- * Plain markup with no motion, so any app can use it.
88
+ * Marketing header for the Project V apps: a `FloatingBar` with `AppWordmark` at `SITE_HEADER_WORDMARK_SIZE`, up to
89
+ * four links, one `cta` and an optional GitHub button. Below `md` the menu button sits on the left, the wordmark is
90
+ * 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.
88
92
  */
89
93
  export function SiteHeader({ app, homeHref = "#home", homeLabel, links, cta, githubUrl, className }: SiteHeaderProps) {
90
94
  const tooMany = links.length > MAX_LINKS;
@@ -97,32 +101,38 @@ export function SiteHeader({ app, homeHref = "#home", homeLabel, links, cta, git
97
101
 
98
102
  const shown = links.slice(0, MAX_LINKS);
99
103
  return (
100
- <header className={cn("sticky top-0 z-50 border-b border-separator bg-background/80 backdrop-blur-md", className)}>
101
- <div className={cn(landingShellClass, "flex h-14 items-center justify-between gap-3 sm:h-16")}>
102
- <a href={homeHref} className={cn("group min-w-0 shrink-0 rounded-lg", focusRing)} aria-label={homeLabel}>
103
- <AppWordmark app={app} size={SITE_HEADER_WORDMARK_SIZE} />
104
- </a>
104
+ <FloatingBar className={className} barClassName="justify-between gap-3 md:pl-5">
105
+ <SiteHeaderMenu links={shown} cta={cta} githubUrl={githubUrl} />
105
106
 
106
- <nav className="hidden items-center gap-1 md:flex" aria-label="Page">
107
- {shown.map((link) => (
108
- <a key={link.href} href={link.href} className={landingClasses.navLink}>
109
- {link.label}
110
- </a>
111
- ))}
112
- </nav>
107
+ <a
108
+ href={homeHref}
109
+ className={cn(
110
+ "group min-w-0 shrink-0 rounded-lg max-md:absolute max-md:left-1/2 max-md:-translate-x-1/2",
111
+ focusRing,
112
+ )}
113
+ aria-label={homeLabel}
114
+ >
115
+ <AppWordmark app={app} size={SITE_HEADER_WORDMARK_SIZE} />
116
+ </a>
113
117
 
114
- <div className="flex items-center gap-1.5">
115
- {githubUrl ? (
116
- <Button asChild variant="ghost" size="icon-sm" className="hidden sm:inline-flex">
117
- <a href={githubUrl} target="_blank" rel="noreferrer" aria-label={`${app} on GitHub`}>
118
- <GitHubIcon size={18} />
119
- </a>
120
- </Button>
121
- ) : null}
122
- <div className="hidden md:flex">{cta}</div>
123
- <SiteHeaderMenu links={shown} cta={cta} githubUrl={githubUrl} />
124
- </div>
118
+ <nav className="hidden items-center gap-1 md:flex" aria-label="Page">
119
+ {shown.map((link) => (
120
+ <a key={link.href} href={link.href} className={cn(landingClasses.navLink, "rounded-full")}>
121
+ {link.label}
122
+ </a>
123
+ ))}
124
+ </nav>
125
+
126
+ <div className="flex items-center gap-1.5">
127
+ {githubUrl ? (
128
+ <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`}>
130
+ <GitHubIcon size={18} />
131
+ </a>
132
+ </Button>
133
+ ) : null}
134
+ <div className="hidden md:flex">{cta}</div>
125
135
  </div>
126
- </header>
136
+ </FloatingBar>
127
137
  );
128
138
  }