@rxova/astro-ui 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxova/astro-ui",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Astro components, Starlight preset and shared chrome for rxova.org",
6
6
  "keywords": [
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@rxova/brand": "^1.1.1",
49
+ "@rxova/brand": "^1.2.0",
50
50
  "lucide-static": "^1.45.0"
51
51
  },
52
52
  "devDependencies": {
@@ -0,0 +1,26 @@
1
+ ---
2
+ /**
3
+ * The umbrella navigation for a docs site: the project switcher, then the rxova.org sections.
4
+ * Starlight shows it in the header bar on wide screens and in the menu on phones.
5
+ */
6
+ import { RXOVA_ORIGIN, SECTIONS, type ProjectId } from '@rxova/brand'
7
+ import ProjectSwitcher from './ProjectSwitcher.astro'
8
+
9
+ interface Props {
10
+ /** The project whose docs these are, marked in the switcher. */
11
+ current?: ProjectId
12
+ /** Prefix for the section links. '' links root-relative, for a build served on rxova.org. */
13
+ origin?: string
14
+ }
15
+
16
+ const { current, origin = RXOVA_ORIGIN } = Astro.props
17
+ ---
18
+
19
+ <nav class="rx-sections" aria-label="rxova.org">
20
+ <ProjectSwitcher current={current} />
21
+ {SECTIONS.map((section) => (
22
+ <a class="rx-sections__link" href={`${origin}${section.path}`}>
23
+ {section.label}
24
+ </a>
25
+ ))}
26
+ </nav>
@@ -3,7 +3,7 @@
3
3
  * The rxova footer on every surface: brand block, link columns, then copyright and legal links.
4
4
  * Styles live in `../styles/footer.css`. Hrefs are absolute unless `origin` is '' (on rxova.org).
5
5
  */
6
- import { PROJECTS, RXOVA_ORIGIN, getProject, type ProjectId } from '@rxova/brand'
6
+ import { PROJECTS, RXOVA_ORIGIN, SECTIONS, getProject, type ProjectId } from '@rxova/brand'
7
7
 
8
8
  /** A standalone surface of rxova.org, for the "Site" column. */
9
9
  export interface SiteLink {
@@ -38,11 +38,8 @@ const year = new Date().getFullYear()
38
38
  const projectLinks: readonly SiteLink[] =
39
39
  projects ?? PROJECTS.map((p) => ({ label: p.label, href: `${origin}${p.mount}` }))
40
40
 
41
- const surfaces: readonly SiteLink[] = site ?? [
42
- { label: 'Blog', href: `${origin}/blog/` },
43
- { label: 'Updates', href: `${origin}/updates/` },
44
- { label: 'About', href: `${origin}/about/` },
45
- ]
41
+ const surfaces: readonly SiteLink[] =
42
+ site ?? SECTIONS.map((section) => ({ label: section.label, href: `${origin}${section.path}` }))
46
43
  ---
47
44
 
48
45
  <footer class="rx-footer">
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  /**
3
- * Starlight `SocialIcons` override: the stock icons plus the project switcher, which lands just
4
- * before search and the theme toggle.
3
+ * Starlight `SocialIcons` override: the umbrella navigation, then the stock icons. Starlight
4
+ * renders this slot in the header on wide screens and in the mobile menu, so one header serves both.
5
5
  */
6
6
  import Default from '@astrojs/starlight/components/SocialIcons.astro'
7
- import ProjectSwitcher from '../components/ProjectSwitcher.astro'
7
+ import SectionNav from '../components/SectionNav.astro'
8
8
  import { projectFromBase } from '@rxova/brand'
9
9
 
10
10
  // Overrides receive no props, so the current project is inferred from the base
@@ -12,7 +12,7 @@ import { projectFromBase } from '@rxova/brand'
12
12
  const current = projectFromBase(import.meta.env.BASE_URL)
13
13
  ---
14
14
 
15
- <ProjectSwitcher current={current} />
15
+ <SectionNav current={current} />
16
16
  <Default>
17
17
  <slot />
18
18
  </Default>
@@ -157,6 +157,34 @@ html[data-rxova-shell] .sl-menu-button {
157
157
  background: var(--rx-gradient);
158
158
  }
159
159
 
160
+ /* Umbrella navigation: the switcher and the rxova.org sections, beside the social icons. */
161
+ .rx-sections {
162
+ display: flex;
163
+ align-items: center;
164
+ gap: 1rem;
165
+ }
166
+
167
+ .rx-sections__link {
168
+ color: var(--sl-color-gray-2);
169
+ font-size: var(--sl-text-sm);
170
+ text-decoration: none;
171
+ white-space: nowrap;
172
+ }
173
+
174
+ .rx-sections__link:hover {
175
+ color: var(--sl-color-white);
176
+ }
177
+
178
+ /* In the mobile menu the icons share a row with the theme picker; the navigation takes a row
179
+ of its own above them. */
180
+ .mobile-preferences .social-icons {
181
+ flex-wrap: wrap;
182
+ }
183
+
184
+ .mobile-preferences .rx-sections {
185
+ flex-basis: 100%;
186
+ }
187
+
160
188
  /* --- Footer -------------------------------------------------------------- */
161
189
 
162
190
  /* Footer styles live in footer.css (imported above) because /blog and /updates need them too. */