docpensieve 0.1.0 → 0.1.2
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 +5 -2
- package/bin/docpensieve.js +1 -0
- package/package.json +8 -6
- package/src/commands/dev.js +1 -1
- package/src/commands/init.js +214 -39
- package/starter/01-guide/01-installation.md +79 -0
- package/starter/01-guide/02-first-site.md +97 -0
- package/starter/01-guide/03-writing-pages.md +138 -0
- package/starter/01-guide/04-versions.md +179 -0
- package/starter/01-guide/05-themes.md +116 -0
- package/starter/01-guide/06-deployment.md +124 -0
- package/starter/01-guide/index.md +38 -0
- package/starter/02-components/01-card.mdx +195 -0
- package/starter/02-components/02-columns.mdx +193 -0
- package/starter/02-components/03-time-timer.mdx +120 -0
- package/starter/02-components/04-tooltip.mdx +100 -0
- package/starter/02-components/05-tree.mdx +163 -0
- package/starter/02-components/06-scroll-to-top.mdx +103 -0
- package/starter/02-components/07-skill.mdx +214 -0
- package/starter/02-components/08-logo-icon.mdx +122 -0
- package/starter/02-components/icons/banner.svg +15 -0
- package/starter/02-components/icons/book.svg +4 -0
- package/starter/02-components/icons/lightning.svg +3 -0
- package/starter/02-components/icons/shield.svg +4 -0
- package/starter/02-components/icons/star.svg +3 -0
- package/starter/02-components/index.md +41 -0
- package/starter/03-reference/01-cli.md +134 -0
- package/starter/03-reference/02-configuration.md +132 -0
- package/starter/03-reference/03-frontmatter.md +110 -0
- package/starter/03-reference/04-theme.md +149 -0
- package/starter/03-reference/index.md +32 -0
- package/starter/04-architecture.md +106 -0
- package/starter/icons/blocks.svg +6 -0
- package/starter/icons/book.svg +4 -0
- package/starter/icons/branch.svg +6 -0
- package/starter/icons/compass.svg +4 -0
- package/starter/icons/lightning.svg +3 -0
- package/starter/icons/list.svg +4 -0
- package/starter/icons/shield.svg +4 -0
- package/starter/icons/star.svg +3 -0
- package/starter/index.mdx +244 -0
- package/types/commands/init.d.ts +7 -4
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Card
|
|
3
|
+
description: Structured card, with header, body, footer and image.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Card
|
|
7
|
+
|
|
8
|
+
## The simplest
|
|
9
|
+
|
|
10
|
+
<Card className="max-w-sm">
|
|
11
|
+
<CardBody>A card reduced to its body.</CardBody>
|
|
12
|
+
</Card>
|
|
13
|
+
|
|
14
|
+
```mdx
|
|
15
|
+
<Card className="max-w-sm">
|
|
16
|
+
<CardBody>A card reduced to its body.</CardBody>
|
|
17
|
+
</Card>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## With its three parts
|
|
21
|
+
|
|
22
|
+
<Card className="max-w-sm">
|
|
23
|
+
<CardHeader>Header</CardHeader>
|
|
24
|
+
<CardBody>
|
|
25
|
+
The body of the card. It takes the remaining space when several cards sit side by side.
|
|
26
|
+
</CardBody>
|
|
27
|
+
<CardFooter>Card footer</CardFooter>
|
|
28
|
+
</Card>
|
|
29
|
+
|
|
30
|
+
## With an image
|
|
31
|
+
|
|
32
|
+
`CardImage` goes wherever you want in the card. At the top or at the bottom, it
|
|
33
|
+
follows the corners; between two blocks, it stays square.
|
|
34
|
+
|
|
35
|
+
<Columns>
|
|
36
|
+
<Column span={6}>
|
|
37
|
+
<Card>
|
|
38
|
+
<CardImage src="./icons/banner.svg" alt="" />
|
|
39
|
+
<CardHeader>Image at the top</CardHeader>
|
|
40
|
+
<CardBody>The top corners follow those of the card.</CardBody>
|
|
41
|
+
</Card>
|
|
42
|
+
</Column>
|
|
43
|
+
<Column span={6}>
|
|
44
|
+
<Card>
|
|
45
|
+
<CardHeader>Image at the bottom</CardHeader>
|
|
46
|
+
<CardBody>The bottom corners follow those of the card.</CardBody>
|
|
47
|
+
<CardImage src="./icons/banner.svg" alt="" />
|
|
48
|
+
</Card>
|
|
49
|
+
</Column>
|
|
50
|
+
</Columns>
|
|
51
|
+
|
|
52
|
+
```mdx
|
|
53
|
+
<Card>
|
|
54
|
+
<CardImage src="./icons/banner.svg" alt="" />
|
|
55
|
+
<CardBody>…</CardBody>
|
|
56
|
+
</Card>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`alt` defaults to the empty string: a decorative image is thus passed over by
|
|
60
|
+
screen readers, rather than announced by its file name. An image that carries
|
|
61
|
+
meaning deserves a written `alt`.
|
|
62
|
+
|
|
63
|
+
## A grid of cards
|
|
64
|
+
|
|
65
|
+
It is the most common use. `h-full` aligns the heights whatever the content.
|
|
66
|
+
|
|
67
|
+
<Columns>
|
|
68
|
+
<Column>
|
|
69
|
+
<Card className="h-full">
|
|
70
|
+
<CardHeader>Stateless</CardHeader>
|
|
71
|
+
<CardBody>
|
|
72
|
+
Components are rendered at build time. None of them keeps state or listens to events.
|
|
73
|
+
</CardBody>
|
|
74
|
+
</Card>
|
|
75
|
+
</Column>
|
|
76
|
+
<Column>
|
|
77
|
+
<Card className="h-full">
|
|
78
|
+
<CardHeader>Dependency-free</CardHeader>
|
|
79
|
+
<CardBody>The delivered HTML loads nothing.</CardBody>
|
|
80
|
+
</Card>
|
|
81
|
+
</Column>
|
|
82
|
+
<Column>
|
|
83
|
+
<Card className="h-full">
|
|
84
|
+
<CardHeader>No surprises</CardHeader>
|
|
85
|
+
<CardBody>
|
|
86
|
+
What cannot be rendered stops the build rather than disappearing silently.
|
|
87
|
+
</CardBody>
|
|
88
|
+
</Card>
|
|
89
|
+
</Column>
|
|
90
|
+
</Columns>
|
|
91
|
+
|
|
92
|
+
```mdx
|
|
93
|
+
<Columns>
|
|
94
|
+
<Column>
|
|
95
|
+
<Card className="h-full">…</Card>
|
|
96
|
+
</Column>
|
|
97
|
+
</Columns>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Elevation
|
|
101
|
+
|
|
102
|
+
<Card className="max-w-sm" elevated>
|
|
103
|
+
<CardBody>This card carries a shadow.</CardBody>
|
|
104
|
+
</Card>
|
|
105
|
+
|
|
106
|
+
```mdx
|
|
107
|
+
<Card elevated>…</Card>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Fully clickable
|
|
111
|
+
|
|
112
|
+
<Card className="max-w-sm" href="./columns/">
|
|
113
|
+
<CardHeader>Go to the columns</CardHeader>
|
|
114
|
+
<CardBody>The whole card is a link, not just the title.</CardBody>
|
|
115
|
+
</Card>
|
|
116
|
+
|
|
117
|
+
```mdx
|
|
118
|
+
<Card href="./columns/">…</Card>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
A relative target starts from the page, an absolute target from the version
|
|
122
|
+
root — the same rules as for a Markdown link.
|
|
123
|
+
|
|
124
|
+
## A highlighted figure
|
|
125
|
+
|
|
126
|
+
Nothing specific to the component: a card, a little typography, and the footer
|
|
127
|
+
carrying the caption.
|
|
128
|
+
|
|
129
|
+
<Columns>
|
|
130
|
+
<Column span={4}>
|
|
131
|
+
<Card className="h-full text-center">
|
|
132
|
+
<CardBody>
|
|
133
|
+
<div className="text-4xl font-semibold text-indigo-600">0</div>
|
|
134
|
+
<div className="text-sm">bytes of JavaScript</div>
|
|
135
|
+
</CardBody>
|
|
136
|
+
<CardFooter>on every delivered page</CardFooter>
|
|
137
|
+
</Card>
|
|
138
|
+
</Column>
|
|
139
|
+
<Column span={4}>
|
|
140
|
+
<Card className="h-full text-center">
|
|
141
|
+
<CardBody>
|
|
142
|
+
<div className="text-4xl font-semibold text-indigo-600">8</div>
|
|
143
|
+
<div className="text-sm">components</div>
|
|
144
|
+
</CardBody>
|
|
145
|
+
<CardFooter>usable without an import</CardFooter>
|
|
146
|
+
</Card>
|
|
147
|
+
</Column>
|
|
148
|
+
<Column span={4}>
|
|
149
|
+
<Card className="h-full text-center">
|
|
150
|
+
<CardBody>
|
|
151
|
+
<div className="text-4xl font-semibold text-indigo-600">1</div>
|
|
152
|
+
<div className="text-sm">stylesheet</div>
|
|
153
|
+
</CardBody>
|
|
154
|
+
<CardFooter>per version</CardFooter>
|
|
155
|
+
</Card>
|
|
156
|
+
</Column>
|
|
157
|
+
</Columns>
|
|
158
|
+
|
|
159
|
+
## A warning card
|
|
160
|
+
|
|
161
|
+
<Card className="border-amber-400 bg-amber-50 dark:bg-amber-950/30">
|
|
162
|
+
<CardHeader className="text-amber-800 dark:text-amber-200">To check before publishing</CardHeader>
|
|
163
|
+
<CardBody className="text-sm">
|
|
164
|
+
A generated site can compile without error and contain dead links.
|
|
165
|
+
<code>docpensieve check</code> reads the output back.
|
|
166
|
+
</CardBody>
|
|
167
|
+
</Card>
|
|
168
|
+
|
|
169
|
+
## The look through className
|
|
170
|
+
|
|
171
|
+
The component offers no typography prop: the theme's utilities take care of
|
|
172
|
+
it, and win over the default style.
|
|
173
|
+
|
|
174
|
+
<Card className="max-w-sm border-indigo-400 bg-indigo-50">
|
|
175
|
+
<CardHeader className="text-center uppercase tracking-wide text-indigo-700">
|
|
176
|
+
Centred, in capitals
|
|
177
|
+
</CardHeader>
|
|
178
|
+
<CardBody className="text-sm italic">Small, italic body.</CardBody>
|
|
179
|
+
</Card>
|
|
180
|
+
|
|
181
|
+
```mdx
|
|
182
|
+
<Card className="border-indigo-400 bg-indigo-50">
|
|
183
|
+
<CardHeader className="text-center uppercase tracking-wide text-indigo-700">
|
|
184
|
+
Centred, in capitals
|
|
185
|
+
</CardHeader>
|
|
186
|
+
<CardBody className="text-sm italic">Small, italic body.</CardBody>
|
|
187
|
+
</Card>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The component rules live in the `components` layer, below the utilities: a
|
|
191
|
+
`className` set at use always wins, even to undo the default style.
|
|
192
|
+
|
|
193
|
+
<Card className="max-w-sm border-0 shadow-none bg-transparent">
|
|
194
|
+
<CardBody className="px-0">No border, no background, no inner padding.</CardBody>
|
|
195
|
+
</Card>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Columns
|
|
3
|
+
description: Column grid, equal or in twelfths.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Columns
|
|
7
|
+
|
|
8
|
+
A **grid**: each block is placed, with its width. Not to be confused with CSS
|
|
9
|
+
multi-column, where content flows from one column to the next — see below, it
|
|
10
|
+
needs no component.
|
|
11
|
+
|
|
12
|
+
## Equal columns
|
|
13
|
+
|
|
14
|
+
Without an imposed width, the columns share the space equally, whatever their
|
|
15
|
+
content.
|
|
16
|
+
|
|
17
|
+
<Columns>
|
|
18
|
+
<Column>
|
|
19
|
+
<Card>
|
|
20
|
+
<CardBody>First</CardBody>
|
|
21
|
+
</Card>
|
|
22
|
+
</Column>
|
|
23
|
+
<Column>
|
|
24
|
+
<Card>
|
|
25
|
+
<CardBody>
|
|
26
|
+
Second, with a noticeably longer text to check that the columns keep the same width.
|
|
27
|
+
</CardBody>
|
|
28
|
+
</Card>
|
|
29
|
+
</Column>
|
|
30
|
+
<Column>
|
|
31
|
+
<Card>
|
|
32
|
+
<CardBody>Third</CardBody>
|
|
33
|
+
</Card>
|
|
34
|
+
</Column>
|
|
35
|
+
</Columns>
|
|
36
|
+
|
|
37
|
+
```mdx
|
|
38
|
+
<Columns>
|
|
39
|
+
<Column>…</Column>
|
|
40
|
+
<Column>…</Column>
|
|
41
|
+
</Columns>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Widths in twelfths
|
|
45
|
+
|
|
46
|
+
`span` is the number of **tracks** a column takes out of twelve: `span={6}` for
|
|
47
|
+
a half, `span={8}` for two thirds, `span={3}` for a quarter. Twelve because
|
|
48
|
+
twelve divides by two, three, four and six — halves, thirds, quarters and
|
|
49
|
+
sixths all fall right.
|
|
50
|
+
|
|
51
|
+
A value outside 1–12 stops the build, as does a row that mixes columns with and
|
|
52
|
+
without a width: the column without a width would take only one track out of
|
|
53
|
+
twelve, a sliver where the author expected a column.
|
|
54
|
+
|
|
55
|
+
<Columns>
|
|
56
|
+
<Column span={8}>
|
|
57
|
+
<Card>
|
|
58
|
+
<CardBody>span={8}</CardBody>
|
|
59
|
+
</Card>
|
|
60
|
+
</Column>
|
|
61
|
+
<Column span={4}>
|
|
62
|
+
<Card>
|
|
63
|
+
<CardBody>span={4}</CardBody>
|
|
64
|
+
</Card>
|
|
65
|
+
</Column>
|
|
66
|
+
</Columns>
|
|
67
|
+
|
|
68
|
+
```mdx
|
|
69
|
+
<Columns>
|
|
70
|
+
<Column span={8}>…</Column>
|
|
71
|
+
<Column span={4}>…</Column>
|
|
72
|
+
</Columns>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
A `Column` written outside a `Columns` is refused: on its own, it would
|
|
76
|
+
produce nothing visible, and the error would take a long time to find.
|
|
77
|
+
|
|
78
|
+
## Spacing the columns
|
|
79
|
+
|
|
80
|
+
`span` sets the **width** of a column, `gap` the **space between** columns: two
|
|
81
|
+
independent settings. The grid subtracts the gaps by itself, so spacing the
|
|
82
|
+
columns distorts no width.
|
|
83
|
+
|
|
84
|
+
<Columns className="gap-10">
|
|
85
|
+
<Column>
|
|
86
|
+
<Card>
|
|
87
|
+
<CardBody>The gap widens</CardBody>
|
|
88
|
+
</Card>
|
|
89
|
+
</Column>
|
|
90
|
+
<Column>
|
|
91
|
+
<Card>
|
|
92
|
+
<CardBody>without touching the widths</CardBody>
|
|
93
|
+
</Card>
|
|
94
|
+
</Column>
|
|
95
|
+
</Columns>
|
|
96
|
+
|
|
97
|
+
```mdx
|
|
98
|
+
<Columns className="gap-10">…</Columns>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## An aside next to the text
|
|
102
|
+
|
|
103
|
+
The most useful layout in documentation: the main point wide, the remark
|
|
104
|
+
narrow.
|
|
105
|
+
|
|
106
|
+
<Columns>
|
|
107
|
+
<Column span={8}>
|
|
108
|
+
|
|
109
|
+
The compiler plugins rewrite the URLs of the tree built from the Markdown. That
|
|
110
|
+
work happens **before** the components are rendered: a target written in a prop
|
|
111
|
+
escapes them, and must resolve itself.
|
|
112
|
+
|
|
113
|
+
That is why every rendered page is announced to the components, just as the
|
|
114
|
+
class table is announced to them.
|
|
115
|
+
|
|
116
|
+
</Column>
|
|
117
|
+
<Column span={4}>
|
|
118
|
+
<Card className="h-full border-indigo-400 bg-indigo-50 dark:bg-indigo-950/30">
|
|
119
|
+
<CardHeader className="text-sm">Remember</CardHeader>
|
|
120
|
+
<CardBody className="text-sm">
|
|
121
|
+
A component that produces a URL resolves it itself, following the same rules as a
|
|
122
|
+
Markdown link.
|
|
123
|
+
</CardBody>
|
|
124
|
+
</Card>
|
|
125
|
+
</Column>
|
|
126
|
+
</Columns>
|
|
127
|
+
|
|
128
|
+
```mdx
|
|
129
|
+
<Columns>
|
|
130
|
+
<Column span={8}>The point</Column>
|
|
131
|
+
<Column span={4}>The remark</Column>
|
|
132
|
+
</Columns>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Two code columns
|
|
136
|
+
|
|
137
|
+
Compare two spellings side by side.
|
|
138
|
+
|
|
139
|
+
<Columns>
|
|
140
|
+
<Column span={6}>
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
versions: [{ slug: 'v1.0', current: true }];
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
</Column>
|
|
147
|
+
<Column span={6}>
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
versions: [
|
|
151
|
+
{ slug: 'v1.1', prerelease: true },
|
|
152
|
+
{ slug: 'v1.0', current: true },
|
|
153
|
+
];
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
</Column>
|
|
157
|
+
</Columns>
|
|
158
|
+
|
|
159
|
+
## Letting content flow
|
|
160
|
+
|
|
161
|
+
For a text or a gallery that _flows_ from one column to the next, the grid is
|
|
162
|
+
not the right tool and no component is needed: the theme's utilities are
|
|
163
|
+
enough, directly in the page.
|
|
164
|
+
|
|
165
|
+
<div className="columns-2 gap-6 sm:columns-3">
|
|
166
|
+
<Card className="mb-6 break-inside-avoid">
|
|
167
|
+
<CardBody>One</CardBody>
|
|
168
|
+
</Card>
|
|
169
|
+
<Card className="mb-6 break-inside-avoid">
|
|
170
|
+
<CardBody>Two, a little longer, so that the heights differ.</CardBody>
|
|
171
|
+
</Card>
|
|
172
|
+
<Card className="mb-6 break-inside-avoid">
|
|
173
|
+
<CardBody>Three</CardBody>
|
|
174
|
+
</Card>
|
|
175
|
+
<Card className="mb-6 break-inside-avoid">
|
|
176
|
+
<CardBody>Four</CardBody>
|
|
177
|
+
</Card>
|
|
178
|
+
<Card className="mb-6 break-inside-avoid">
|
|
179
|
+
<CardBody>Five</CardBody>
|
|
180
|
+
</Card>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
```mdx
|
|
184
|
+
<div className="columns-2 gap-6 sm:columns-3">…</div>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The difference is there: above, the order is vertical and the browser
|
|
188
|
+
distributes as it likes; with `Columns`, each block stays where you put it.
|
|
189
|
+
|
|
190
|
+
## On small screens
|
|
191
|
+
|
|
192
|
+
Below tablet width, the grid columns stack one under the other. Shrink the
|
|
193
|
+
window to check.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: TimeTimer
|
|
3
|
+
description: Show content during a period, with fallbacks before and after.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TimeTimer
|
|
7
|
+
|
|
8
|
+
`TimeTimer` chooses what to show depending on the date. On a static site,
|
|
9
|
+
“right now” means the moment of the **build**, not of reading — a scheduled
|
|
10
|
+
build is enough to keep it right.
|
|
11
|
+
|
|
12
|
+
## A past date
|
|
13
|
+
|
|
14
|
+
<TimeTimer date="01/01/2020">
|
|
15
|
+
During the day of 1 January 2020.
|
|
16
|
+
<FallbackBefore>Before that date.</FallbackBefore>
|
|
17
|
+
<FallbackAfter>That date has passed — the “after” fallback is what shows.</FallbackAfter>
|
|
18
|
+
</TimeTimer>
|
|
19
|
+
|
|
20
|
+
```mdx
|
|
21
|
+
<TimeTimer date="01/01/2020">
|
|
22
|
+
During the day of 1 January 2020.
|
|
23
|
+
<FallbackBefore>Before that date.</FallbackBefore>
|
|
24
|
+
<FallbackAfter>That date has passed.</FallbackAfter>
|
|
25
|
+
</TimeTimer>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
A date alone covers the **whole day**.
|
|
29
|
+
|
|
30
|
+
## A future date
|
|
31
|
+
|
|
32
|
+
<TimeTimer date="01/01/2090">
|
|
33
|
+
During the day of 1 January 2090.
|
|
34
|
+
<FallbackBefore>That date is still to come — the “before” fallback is what shows.</FallbackBefore>
|
|
35
|
+
<FallbackAfter>After that date.</FallbackAfter>
|
|
36
|
+
</TimeTimer>
|
|
37
|
+
|
|
38
|
+
## An ongoing period
|
|
39
|
+
|
|
40
|
+
<TimeTimer start="01/01/2020" duration="36500d">
|
|
41
|
+
This period is ongoing: the main content is what shows.
|
|
42
|
+
<FallbackBefore>Not started yet.</FallbackBefore>
|
|
43
|
+
<FallbackAfter>Already over.</FallbackAfter>
|
|
44
|
+
</TimeTimer>
|
|
45
|
+
|
|
46
|
+
```mdx
|
|
47
|
+
<TimeTimer start="01/01/2020" duration="36500d">
|
|
48
|
+
…
|
|
49
|
+
</TimeTimer>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`duration` is written `30d` (days), `2h` (hours) or `45m` (minutes). A
|
|
53
|
+
misspelt duration **stops the build**: a typo that silently makes a block
|
|
54
|
+
disappear is exactly what must be avoided.
|
|
55
|
+
|
|
56
|
+
## With a time
|
|
57
|
+
|
|
58
|
+
The full format is `DD/MM/YYYY HH:mm`. Without a year, the current year is
|
|
59
|
+
used.
|
|
60
|
+
|
|
61
|
+
<TimeTimer start="01/01/2020 08:30" duration="36500d">
|
|
62
|
+
A period that started at 8:30.
|
|
63
|
+
</TimeTimer>
|
|
64
|
+
|
|
65
|
+
```mdx
|
|
66
|
+
<TimeTimer start="01/01/2020 08:30" duration="2h">
|
|
67
|
+
…
|
|
68
|
+
</TimeTimer>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Without a fallback
|
|
72
|
+
|
|
73
|
+
Outside the period and without a fallback, the component shows **nothing**.
|
|
74
|
+
The next line is empty, and that is on purpose:
|
|
75
|
+
|
|
76
|
+
<TimeTimer date="01/01/2020">This content does not show.</TimeTimer>
|
|
77
|
+
|
|
78
|
+
## Bounding a fallback
|
|
79
|
+
|
|
80
|
+
`FallbackBefore` accepts `start`, `FallbackAfter` accepts `end`: the fallback
|
|
81
|
+
then only shows within that window, and nothing outside it. That is what lets
|
|
82
|
+
you announce an event a few days ahead, without the announcement lingering for
|
|
83
|
+
months.
|
|
84
|
+
|
|
85
|
+
```mdx
|
|
86
|
+
<TimeTimer date="24/12/2090">
|
|
87
|
+
It is today.
|
|
88
|
+
<FallbackBefore start="17/12/2090">In less than a week.</FallbackBefore>
|
|
89
|
+
</TimeTimer>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## A real use
|
|
93
|
+
|
|
94
|
+
An announcement banner that removes itself:
|
|
95
|
+
|
|
96
|
+
<Card className="border-indigo-400 bg-indigo-50 dark:bg-indigo-950/30">
|
|
97
|
+
<CardBody>
|
|
98
|
+
<TimeTimer start="01/01/2020" duration="36500d">
|
|
99
|
+
**Version 1.1 in preparation.** New features are written in this version.
|
|
100
|
+
<FallbackAfter>Version 1.1 is out.</FallbackAfter>
|
|
101
|
+
</TimeTimer>
|
|
102
|
+
</CardBody>
|
|
103
|
+
</Card>
|
|
104
|
+
|
|
105
|
+
## Local time or UTC
|
|
106
|
+
|
|
107
|
+
By default, dates are read in the time zone of the machine that builds.
|
|
108
|
+
`strict` reads them in UTC — useful when the build runs in continuous
|
|
109
|
+
integration, whose time zone is not yours.
|
|
110
|
+
|
|
111
|
+
```mdx
|
|
112
|
+
<TimeTimer date="24/12/2090" strict>
|
|
113
|
+
…
|
|
114
|
+
</TimeTimer>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## What it refuses
|
|
118
|
+
|
|
119
|
+
A misspelt duration stops the build, and so does an invalid date. The message
|
|
120
|
+
names the faulty value and recalls the expected format.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Tooltip
|
|
3
|
+
description: Tooltip on hover and from the keyboard, without JavaScript.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tooltip
|
|
7
|
+
|
|
8
|
+
The bubble is a real element that CSS reveals. It therefore appears on hover
|
|
9
|
+
**and on keyboard focus**, and it is linked to the term through
|
|
10
|
+
`aria-describedby`: a screen reader announces it instead of ignoring it.
|
|
11
|
+
|
|
12
|
+
## On hover, from the keyboard
|
|
13
|
+
|
|
14
|
+
Hover the term with the mouse, or reach it with the Tab key.
|
|
15
|
+
|
|
16
|
+
The <Tooltip text="Turning the sources into HTML pages ready to serve.">build</Tooltip> produces a complete folder, and the <Tooltip text="All the pages of one version of the documentation.">version</Tooltip> is its root.
|
|
17
|
+
|
|
18
|
+
```mdx
|
|
19
|
+
The <Tooltip text="Turning the sources…">build</Tooltip> produces a folder.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## The four sides
|
|
23
|
+
|
|
24
|
+
Hover each one: <Tooltip text="Above" placement="top">top</Tooltip>, <Tooltip text="Below" placement="bottom">bottom</Tooltip>, <Tooltip text="On the left" placement="left">left</Tooltip> and <Tooltip text="On the right" placement="right">right</Tooltip>.
|
|
25
|
+
|
|
26
|
+
```mdx
|
|
27
|
+
<Tooltip text="On the right" placement="right">
|
|
28
|
+
term
|
|
29
|
+
</Tooltip>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The side is chosen according to the available space: `top` by default,
|
|
33
|
+
`bottom` when the term is at the top of the page, `left` or `right` in a narrow
|
|
34
|
+
column.
|
|
35
|
+
|
|
36
|
+
## On a technical term
|
|
37
|
+
|
|
38
|
+
Useful to explain an identifier without weighing down the sentence.
|
|
39
|
+
|
|
40
|
+
The <Tooltip text="Deployment prefix, derived from the sub-path of siteUrl when it is not written."><code>baseUrl</code></Tooltip> field prefixes every internal link, and <Tooltip text="Version served by default. At most one."><code>current</code></Tooltip> designates the one the root serves.
|
|
41
|
+
|
|
42
|
+
```mdx
|
|
43
|
+
The <Tooltip text="Deployment prefix."><code>baseUrl</code></Tooltip> field prefixes the links.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## In a table
|
|
47
|
+
|
|
48
|
+
| Field | Role |
|
|
49
|
+
| ------------ | ---------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `slug` | <Tooltip text="It shows up in /versions/<slug>/ and gives the branch its name.">Identifier</Tooltip> |
|
|
51
|
+
| `current` | <Tooltip text="The site root redirects to it.">Version served by default</Tooltip> |
|
|
52
|
+
| `prerelease` | <Tooltip text="Banner on every page, and noindex in the head.">Version in preparation</Tooltip> |
|
|
53
|
+
|
|
54
|
+
## In a card
|
|
55
|
+
|
|
56
|
+
A card does not clip what sticks out: the bubble comes out of it.
|
|
57
|
+
|
|
58
|
+
<Columns>
|
|
59
|
+
<Column span={6}>
|
|
60
|
+
<Card>
|
|
61
|
+
<CardBody>
|
|
62
|
+
A <Tooltip text="The bubble comes out of the card, it is not cut.">term</Tooltip> in a card.
|
|
63
|
+
</CardBody>
|
|
64
|
+
</Card>
|
|
65
|
+
</Column>
|
|
66
|
+
<Column span={6}>
|
|
67
|
+
<Card>
|
|
68
|
+
<CardBody>
|
|
69
|
+
And{' '}
|
|
70
|
+
<Tooltip text="Opened downwards." placement="bottom">
|
|
71
|
+
another
|
|
72
|
+
</Tooltip>{' '}
|
|
73
|
+
below.
|
|
74
|
+
</CardBody>
|
|
75
|
+
</Card>
|
|
76
|
+
</Column>
|
|
77
|
+
</Columns>
|
|
78
|
+
|
|
79
|
+
## A long text
|
|
80
|
+
|
|
81
|
+
The bubble is capped at about sixteen rem wide, then wraps.
|
|
82
|
+
|
|
83
|
+
See the <Tooltip text="A published version stays in the state in which it was produced. Rebuilding it is never necessary, and nothing would guarantee it gives the same result years later.">reason for version branches</Tooltip> for the details.
|
|
84
|
+
|
|
85
|
+
## What it cannot do
|
|
86
|
+
|
|
87
|
+
The bubble is positioned absolutely: inside a container that **clips its
|
|
88
|
+
overflow** — an `overflow: hidden` — it will be cut. That is the limit of a
|
|
89
|
+
tooltip without JavaScript, and it is accepted: placing the bubble outside the
|
|
90
|
+
flow would take a script on every page.
|
|
91
|
+
|
|
92
|
+
The shipped components avoid that clipping wherever they can — a `Card` rounds
|
|
93
|
+
the corners of its image one by one rather than clipping its content.
|
|
94
|
+
|
|
95
|
+
The bubble does not close with the Escape key: listening for it would take a
|
|
96
|
+
script, and the site loads none. It disappears when the pointer or the focus
|
|
97
|
+
leaves the term.
|
|
98
|
+
|
|
99
|
+
A `Tooltip` without text stops the build: a hover with no effect goes
|
|
100
|
+
unnoticed for a long time. So does an unknown side.
|