SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

SeriesNav

A post's place in a series, built from parts.

View code
tsx
import { SeriesNav } from "@sdxc/ui/blog";

<SeriesNav current={3} total={4}>
	<SeriesNav.Header>
		<SeriesNav.Label>
			Series · <SeriesNav.Progress />
		</SeriesNav.Label>
		<SeriesNav.Title href="/series/job-queue">Building a job queue</SeriesNav.Title>
	</SeriesNav.Header>
	<SeriesNav.Parts>
		<SeriesNav.Part href="/job-queue-1">Why a queue at all</SeriesNav.Part>
		<SeriesNav.Part href="/job-queue-2">One table, three states</SeriesNav.Part>
		<SeriesNav.Part href="/job-queue-3" current>Retries without a thundering herd</SeriesNav.Part>
		<SeriesNav.Part href="/job-queue-4">Watching it in production</SeriesNav.Part>
	</SeriesNav.Parts>
	<SeriesNav.Next href="/job-queue-4">
		Next: Watching it in production <span aria-hidden="true">→</span>
	</SeriesNav.Next>
</SeriesNav>

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { SeriesNav } from "@sdxc/ui/blog";

Renders the box as a <nav> stacking whichever parts it holds, named by its SeriesNav.Title through a generated id, and sharing current and total with SeriesNav.Progress. Restyle it through SeriesNav.CustomProperties.

Composition

The parts the component publishes, each a static property of the host.

  • SeriesNav
  • SeriesNav.HeaderStacks the eyebrow over the series name, tight enough to read as one heading.
  • SeriesNav.LabelThe eyebrow: a small upper-case line in the brand colour, such as "Series · Part 2 of 3".
  • SeriesNav.ProgressThe reader's position, "Part n of m", from the box's current and total; it draws nothing until both are known.
  • SeriesNav.TitleThe series' name, a link to the series' page when given an href; it carries the id that names the box's landmark.
  • SeriesNav.PartsThe parts in reading order as a numbered list; the numbers are the list's own markers, so a screen reader hears each part's position.
  • SeriesNav.PartOne part: a link that reads as text until hovered, or, for the part being read, its title marked aria-current="page" and unlinked, with its number in the brand colour.
  • SeriesNav.CurrentLabelA quieter note after the current part's title, such as "(you are here)".
  • SeriesNav.NextThe link to the part after the current one, in the brand colour: the one link a reader most likely wants.
  • SeriesNav.LastA closing line for the last part, where there is no next one, such as "The end".
  • SeriesNav.DisclosureFolds what follows its SeriesNav.Summary into a native <details> that starts open, so a long series can be closed with script off.
  • SeriesNav.SummaryThe disclosure's always-visible line, usually holding the header, with a muted marker.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeDefaultRequiredDescription
currentnumber—NoThe part being read, counted from one, which SeriesNav.Progress states.
totalnumber—NoHow many parts the series has.

Also accepts everything in TagProps<"nav">.

SeriesNav.Header

Also accepts everything in TagProps<"span">.

SeriesNav.Label

Also accepts everything in TagProps<"span">.

SeriesNav.Progress

PropTypeDefaultRequiredDescription
children(part: number, total: number) => RemixNode—NoWrites the position from the current part and the total.

Also accepts everything in Omit<TagProps<"span">, "children">.

SeriesNav.Title

PropTypeDefaultRequiredDescription
hrefstring—NoThe series' page, which turns the name into a link.

Also accepts everything in TagProps<"span">.

SeriesNav.Parts

Also accepts everything in TagProps<"ol">.

SeriesNav.Part

PropTypeDefaultRequiredDescription
hrefstring—Yes
currentboolean—NoThe part being read, which the list marks with aria-current and leaves unlinked.

Also accepts everything in TagProps<"li">.

SeriesNav.CurrentLabel

Also accepts everything in TagProps<"span">.

SeriesNav.Next

SeriesNav.Last

Also accepts everything in TagProps<"p">.

SeriesNav.Disclosure

Also accepts everything in TagProps<"details">.

SeriesNav.Summary

Also accepts everything in TagProps<"summary">.

@sdxc/ui

Can’t find it? Contact us