@coralreefventures/site 0.2.0 → 0.4.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
@@ -35,6 +35,8 @@ export const site = createSite({
35
35
  { label: "Sign in", href: "https://app.streamlane.app", kind: "link", hideBelow: "md" },
36
36
  { label: "Start free", href: "/pricing/", kind: "primary" },
37
37
  ],
38
+ // Optional: something in the bar that is not a link, such as a color-scheme control.
39
+ headerTools: <SchemeControl />,
38
40
  footer: {
39
41
  maker: <>Streamlane · made by <a href="https://coralreefventures.com/">Coral Reef Ventures</a> · source on <a href="...">GitHub</a></>,
40
42
  links: [{ label: "Docs", href: "/docs/" }, { label: "Changelog", href: "/changelog/" } /* ... */],
@@ -65,6 +67,12 @@ const PricingPage = () => (
65
67
  );
66
68
  ```
67
69
 
70
+ `headerTools` (optional, since 0.3.0) is for something in the header that is not a link, such as a color-scheme
71
+ control. It renders in the actions group after the actions and before the folded menu's button, vertically centered in
72
+ the 64 px bar, at every width: never hidden below a breakpoint and never copied into the folded menu. The header stays a
73
+ server component; the element is the product's own, and may be one of its client components. Without it, the header's
74
+ markup is what it was before the field existed, and a test holds that.
75
+
68
76
  `active` is typed to the config's nav keys. The root layout takes `site.rootMetadata()` and `site.rootViewport()`;
69
77
  `app/robots.ts` returns `site.robots()`, `app/sitemap.ts` returns `site.sitemap()` (with the docs pages added, for a
70
78
  site that has them); and `app/og/[...card]/route.tsx` keeps its two literals and takes the rest:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralreefventures/site",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "The shell a Coral Reef public site is built in: header, footer, sections, the social-card builder and the metadata helpers, as server components, parametrized by one SiteConfig.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/config.ts CHANGED
@@ -44,6 +44,14 @@ export type SiteConfig<Key extends string = string> = {
44
44
  lockup: ReactNode;
45
45
  /** The header's actions, in order. */
46
46
  actions: readonly HeaderAction[];
47
+ /**
48
+ * Something in the header that is not a link, such as a color-scheme control: rendered in the actions group after
49
+ * the actions and before the folded menu's button, vertically centered in the bar, at every width. It is never
50
+ * hidden below a breakpoint and never copied into the folded menu. The header stays a server component, so this is
51
+ * the product's own element (a client component of the product's is fine; the shell imports none). Absent, the
52
+ * header renders exactly as it did without it.
53
+ */
54
+ headerTools?: ReactNode;
47
55
  footer: {
48
56
  /** The footer's first line: who makes the product and where its source is. */
49
57
  maker: ReactNode;
@@ -82,6 +82,13 @@
82
82
  }
83
83
  }
84
84
 
85
+ /* The site's header tools (a color-scheme control, say): in the bar at every width, centered on its line. */
86
+ .tools {
87
+ display: flex;
88
+ flex: none;
89
+ align-items: center;
90
+ }
91
+
85
92
  /* An action that leaves the bar on narrow screens; the folded menu lists it instead. */
86
93
  @media (max-width: 62em) {
87
94
  .actions [data-hide-below="md"] {
@@ -15,7 +15,7 @@ const action = ({ label, href, kind, hideBelow }: HeaderAction) => (
15
15
  );
16
16
 
17
17
  /**
18
- * The header: lockup, the sections, and the actions. A server component with plain links, so a page that ships no
18
+ * The header: lockup, the sections, the actions, and the site's header tools if it has any. A server component with plain links, so a page that ships no
19
19
  * client code can carry it; below the md breakpoint the sections fold into a <details> menu, which needs no script,
20
20
  * and any action hidden at some width is listed there too.
21
21
  */
@@ -36,6 +36,7 @@ export const SiteHeader = <Key extends string>({
36
36
  </nav>
37
37
  <div className={classes.actions}>
38
38
  {site.actions.map(action)}
39
+ {site.headerTools == null ? null : <div className={classes.tools}>{site.headerTools}</div>}
39
40
  <details className={classes.menu}>
40
41
  <summary className={classes.menuButton} aria-label="Menu">
41
42
  <svg width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">