docpensieve 0.1.2 → 0.1.4
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 +34 -3
- package/package.json +5 -5
- package/src/commands/dev.js +27 -3
- package/src/commands/init.js +72 -6
- package/src/templates/custom.css +20 -0
- package/src/theme.js +30 -7
- package/starter/01-guide/01-installation.md +36 -6
- package/starter/01-guide/03-writing-pages.md +2 -2
- package/starter/01-guide/05-themes.md +5 -3
- package/starter/02-components/01-card.mdx +155 -7
- package/starter/02-components/02-columns.mdx +98 -5
- package/starter/02-components/03-time-timer.mdx +1 -1
- package/starter/02-components/05-tree.mdx +32 -2
- package/starter/02-components/06-scroll-to-top.mdx +40 -0
- package/starter/02-components/07-skill.mdx +44 -12
- package/starter/02-components/08-logo-icon.mdx +44 -16
- package/starter/02-components/09-for-theme.mdx +45 -0
- package/starter/02-components/{index.md → index.mdx} +44 -1
- package/starter/03-reference/01-cli.md +10 -0
- package/starter/03-reference/02-configuration.md +5 -0
- package/starter/03-reference/04-theme.md +4 -3
- package/starter/examples.css +156 -0
- package/types/theme.d.ts +12 -2
|
@@ -7,19 +7,22 @@ description: Structured card, with header, body, footer and image.
|
|
|
7
7
|
|
|
8
8
|
## The simplest
|
|
9
9
|
|
|
10
|
-
<Card
|
|
10
|
+
<Card style={{ maxWidth: '24rem' }}>
|
|
11
11
|
<CardBody>A card reduced to its body.</CardBody>
|
|
12
12
|
</Card>
|
|
13
13
|
|
|
14
14
|
```mdx
|
|
15
|
-
<Card
|
|
15
|
+
<Card>
|
|
16
16
|
<CardBody>A card reduced to its body.</CardBody>
|
|
17
17
|
</Card>
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
The examples of this page narrow some cards through `style`, which every theme
|
|
21
|
+
understands; the look proper comes further down.
|
|
22
|
+
|
|
20
23
|
## With its three parts
|
|
21
24
|
|
|
22
|
-
<Card
|
|
25
|
+
<Card style={{ maxWidth: '24rem' }}>
|
|
23
26
|
<CardHeader>Header</CardHeader>
|
|
24
27
|
<CardBody>
|
|
25
28
|
The body of the card. It takes the remaining space when several cards sit side by side.
|
|
@@ -62,7 +65,12 @@ meaning deserves a written `alt`.
|
|
|
62
65
|
|
|
63
66
|
## A grid of cards
|
|
64
67
|
|
|
65
|
-
It is the most common use.
|
|
68
|
+
It is the most common use. Stretching each card to the height of its column
|
|
69
|
+
aligns them whatever the content.
|
|
70
|
+
|
|
71
|
+
<ForTheme framework="tailwind">
|
|
72
|
+
|
|
73
|
+
With the Tailwind theme, the `h-full` utility does it:
|
|
66
74
|
|
|
67
75
|
<Columns>
|
|
68
76
|
<Column>
|
|
@@ -97,9 +105,56 @@ It is the most common use. `h-full` aligns the heights whatever the content.
|
|
|
97
105
|
</Columns>
|
|
98
106
|
```
|
|
99
107
|
|
|
108
|
+
</ForTheme>
|
|
109
|
+
<ForTheme framework="custom">
|
|
110
|
+
|
|
111
|
+
With the custom theme, a class of your own does it — here `full-height`, from
|
|
112
|
+
`theme/99-docpensieve.css`:
|
|
113
|
+
|
|
114
|
+
<Columns>
|
|
115
|
+
<Column>
|
|
116
|
+
<Card className="full-height">
|
|
117
|
+
<CardHeader>Stateless</CardHeader>
|
|
118
|
+
<CardBody>
|
|
119
|
+
Components are rendered at build time. None of them keeps state or listens to events.
|
|
120
|
+
</CardBody>
|
|
121
|
+
</Card>
|
|
122
|
+
</Column>
|
|
123
|
+
<Column>
|
|
124
|
+
<Card className="full-height">
|
|
125
|
+
<CardHeader>Dependency-free</CardHeader>
|
|
126
|
+
<CardBody>The delivered HTML loads nothing.</CardBody>
|
|
127
|
+
</Card>
|
|
128
|
+
</Column>
|
|
129
|
+
<Column>
|
|
130
|
+
<Card className="full-height">
|
|
131
|
+
<CardHeader>No surprises</CardHeader>
|
|
132
|
+
<CardBody>
|
|
133
|
+
What cannot be rendered stops the build rather than disappearing silently.
|
|
134
|
+
</CardBody>
|
|
135
|
+
</Card>
|
|
136
|
+
</Column>
|
|
137
|
+
</Columns>
|
|
138
|
+
|
|
139
|
+
```mdx
|
|
140
|
+
<Columns>
|
|
141
|
+
<Column>
|
|
142
|
+
<Card className="full-height">…</Card>
|
|
143
|
+
</Column>
|
|
144
|
+
</Columns>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
```css
|
|
148
|
+
.full-height {
|
|
149
|
+
block-size: 100%;
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
</ForTheme>
|
|
154
|
+
|
|
100
155
|
## Elevation
|
|
101
156
|
|
|
102
|
-
<Card
|
|
157
|
+
<Card style={{ maxWidth: '24rem' }} elevated>
|
|
103
158
|
<CardBody>This card carries a shadow.</CardBody>
|
|
104
159
|
</Card>
|
|
105
160
|
|
|
@@ -109,7 +164,7 @@ It is the most common use. `h-full` aligns the heights whatever the content.
|
|
|
109
164
|
|
|
110
165
|
## Fully clickable
|
|
111
166
|
|
|
112
|
-
<Card
|
|
167
|
+
<Card style={{ maxWidth: '24rem' }} href="./columns/">
|
|
113
168
|
<CardHeader>Go to the columns</CardHeader>
|
|
114
169
|
<CardBody>The whole card is a link, not just the title.</CardBody>
|
|
115
170
|
</Card>
|
|
@@ -126,6 +181,8 @@ root — the same rules as for a Markdown link.
|
|
|
126
181
|
Nothing specific to the component: a card, a little typography, and the footer
|
|
127
182
|
carrying the caption.
|
|
128
183
|
|
|
184
|
+
<ForTheme framework="tailwind">
|
|
185
|
+
|
|
129
186
|
<Columns>
|
|
130
187
|
<Column span={4}>
|
|
131
188
|
<Card className="h-full text-center">
|
|
@@ -139,7 +196,7 @@ carrying the caption.
|
|
|
139
196
|
<Column span={4}>
|
|
140
197
|
<Card className="h-full text-center">
|
|
141
198
|
<CardBody>
|
|
142
|
-
<div className="text-4xl font-semibold text-indigo-600">
|
|
199
|
+
<div className="text-4xl font-semibold text-indigo-600">9</div>
|
|
143
200
|
<div className="text-sm">components</div>
|
|
144
201
|
</CardBody>
|
|
145
202
|
<CardFooter>usable without an import</CardFooter>
|
|
@@ -156,8 +213,45 @@ carrying the caption.
|
|
|
156
213
|
</Column>
|
|
157
214
|
</Columns>
|
|
158
215
|
|
|
216
|
+
</ForTheme>
|
|
217
|
+
<ForTheme framework="custom">
|
|
218
|
+
|
|
219
|
+
<Columns>
|
|
220
|
+
<Column span={4}>
|
|
221
|
+
<Card className="full-height centered">
|
|
222
|
+
<CardBody>
|
|
223
|
+
<div className="figure">0</div>
|
|
224
|
+
<div className="small">bytes of JavaScript</div>
|
|
225
|
+
</CardBody>
|
|
226
|
+
<CardFooter>on every delivered page</CardFooter>
|
|
227
|
+
</Card>
|
|
228
|
+
</Column>
|
|
229
|
+
<Column span={4}>
|
|
230
|
+
<Card className="full-height centered">
|
|
231
|
+
<CardBody>
|
|
232
|
+
<div className="figure">9</div>
|
|
233
|
+
<div className="small">components</div>
|
|
234
|
+
</CardBody>
|
|
235
|
+
<CardFooter>usable without an import</CardFooter>
|
|
236
|
+
</Card>
|
|
237
|
+
</Column>
|
|
238
|
+
<Column span={4}>
|
|
239
|
+
<Card className="full-height centered">
|
|
240
|
+
<CardBody>
|
|
241
|
+
<div className="figure">1</div>
|
|
242
|
+
<div className="small">stylesheet</div>
|
|
243
|
+
</CardBody>
|
|
244
|
+
<CardFooter>per version</CardFooter>
|
|
245
|
+
</Card>
|
|
246
|
+
</Column>
|
|
247
|
+
</Columns>
|
|
248
|
+
|
|
249
|
+
</ForTheme>
|
|
250
|
+
|
|
159
251
|
## A warning card
|
|
160
252
|
|
|
253
|
+
<ForTheme framework="tailwind">
|
|
254
|
+
|
|
161
255
|
<Card className="border-amber-400 bg-amber-50 dark:bg-amber-950/30">
|
|
162
256
|
<CardHeader className="text-amber-800 dark:text-amber-200">To check before publishing</CardHeader>
|
|
163
257
|
<CardBody className="text-sm">
|
|
@@ -166,8 +260,23 @@ carrying the caption.
|
|
|
166
260
|
</CardBody>
|
|
167
261
|
</Card>
|
|
168
262
|
|
|
263
|
+
</ForTheme>
|
|
264
|
+
<ForTheme framework="custom">
|
|
265
|
+
|
|
266
|
+
<Card className="warning">
|
|
267
|
+
<CardHeader className="warning-title">To check before publishing</CardHeader>
|
|
268
|
+
<CardBody className="small">
|
|
269
|
+
A generated site can compile without error and contain dead links.
|
|
270
|
+
<code>docpensieve check</code> reads the output back.
|
|
271
|
+
</CardBody>
|
|
272
|
+
</Card>
|
|
273
|
+
|
|
274
|
+
</ForTheme>
|
|
275
|
+
|
|
169
276
|
## The look through className
|
|
170
277
|
|
|
278
|
+
<ForTheme framework="tailwind">
|
|
279
|
+
|
|
171
280
|
The component offers no typography prop: the theme's utilities take care of
|
|
172
281
|
it, and win over the default style.
|
|
173
282
|
|
|
@@ -193,3 +302,42 @@ The component rules live in the `components` layer, below the utilities: a
|
|
|
193
302
|
<Card className="max-w-sm border-0 shadow-none bg-transparent">
|
|
194
303
|
<CardBody className="px-0">No border, no background, no inner padding.</CardBody>
|
|
195
304
|
</Card>
|
|
305
|
+
|
|
306
|
+
</ForTheme>
|
|
307
|
+
<ForTheme framework="custom">
|
|
308
|
+
|
|
309
|
+
The component offers no typography prop: the look comes from classes of your
|
|
310
|
+
own, written in the `theme/` folder — here those of `theme/99-docpensieve.css`.
|
|
311
|
+
|
|
312
|
+
<Card className="narrow highlight">
|
|
313
|
+
<CardHeader className="centered caps accent-text">Centred, in capitals</CardHeader>
|
|
314
|
+
<CardBody className="small italic">Small, italic body.</CardBody>
|
|
315
|
+
</Card>
|
|
316
|
+
|
|
317
|
+
```mdx
|
|
318
|
+
<Card className="highlight">
|
|
319
|
+
<CardHeader className="centered caps accent-text">Centred, in capitals</CardHeader>
|
|
320
|
+
<CardBody className="small italic">Small, italic body.</CardBody>
|
|
321
|
+
</Card>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```css
|
|
325
|
+
.highlight {
|
|
326
|
+
border-color: var(--dp-accent);
|
|
327
|
+
background: var(--dp-accent-soft);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.caps {
|
|
331
|
+
text-transform: uppercase;
|
|
332
|
+
letter-spacing: 0.05em;
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
The component rules live in the `components` layer, those of the theme folder
|
|
337
|
+
in none: a class of yours always wins, even to undo the default style.
|
|
338
|
+
|
|
339
|
+
<Card className="narrow plain">
|
|
340
|
+
<CardBody className="flush">No border, no background, no inner padding.</CardBody>
|
|
341
|
+
</Card>
|
|
342
|
+
|
|
343
|
+
</ForTheme>
|
|
@@ -81,6 +81,10 @@ produce nothing visible, and the error would take a long time to find.
|
|
|
81
81
|
independent settings. The grid subtracts the gaps by itself, so spacing the
|
|
82
82
|
columns distorts no width.
|
|
83
83
|
|
|
84
|
+
<ForTheme framework="tailwind">
|
|
85
|
+
|
|
86
|
+
With the Tailwind theme, a `gap-*` utility sets it:
|
|
87
|
+
|
|
84
88
|
<Columns className="gap-10">
|
|
85
89
|
<Column>
|
|
86
90
|
<Card>
|
|
@@ -98,6 +102,37 @@ columns distorts no width.
|
|
|
98
102
|
<Columns className="gap-10">…</Columns>
|
|
99
103
|
```
|
|
100
104
|
|
|
105
|
+
</ForTheme>
|
|
106
|
+
<ForTheme framework="custom">
|
|
107
|
+
|
|
108
|
+
With the custom theme, a class of your own sets it — here `wide-gap`, from
|
|
109
|
+
`theme/99-docpensieve.css`:
|
|
110
|
+
|
|
111
|
+
<Columns className="wide-gap">
|
|
112
|
+
<Column>
|
|
113
|
+
<Card>
|
|
114
|
+
<CardBody>The gap widens</CardBody>
|
|
115
|
+
</Card>
|
|
116
|
+
</Column>
|
|
117
|
+
<Column>
|
|
118
|
+
<Card>
|
|
119
|
+
<CardBody>without touching the widths</CardBody>
|
|
120
|
+
</Card>
|
|
121
|
+
</Column>
|
|
122
|
+
</Columns>
|
|
123
|
+
|
|
124
|
+
```mdx
|
|
125
|
+
<Columns className="wide-gap">…</Columns>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```css
|
|
129
|
+
.wide-gap {
|
|
130
|
+
gap: 2.5rem;
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
</ForTheme>
|
|
135
|
+
|
|
101
136
|
## An aside next to the text
|
|
102
137
|
|
|
103
138
|
The most useful layout in documentation: the main point wide, the remark
|
|
@@ -115,9 +150,15 @@ class table is announced to them.
|
|
|
115
150
|
|
|
116
151
|
</Column>
|
|
117
152
|
<Column span={4}>
|
|
118
|
-
<Card
|
|
119
|
-
|
|
120
|
-
|
|
153
|
+
<Card
|
|
154
|
+
style={{
|
|
155
|
+
height: '100%',
|
|
156
|
+
borderColor: 'var(--dp-accent)',
|
|
157
|
+
background: 'var(--dp-accent-soft)',
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<CardHeader style={{ fontSize: '0.875rem' }}>Remember</CardHeader>
|
|
161
|
+
<CardBody style={{ fontSize: '0.875rem' }}>
|
|
121
162
|
A component that produces a URL resolves it itself, following the same rules as a
|
|
122
163
|
Markdown link.
|
|
123
164
|
</CardBody>
|
|
@@ -159,8 +200,12 @@ versions: [
|
|
|
159
200
|
## Letting content flow
|
|
160
201
|
|
|
161
202
|
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:
|
|
163
|
-
|
|
203
|
+
not the right tool and no component is needed: CSS multi-column is enough,
|
|
204
|
+
directly in the page.
|
|
205
|
+
|
|
206
|
+
<ForTheme framework="tailwind">
|
|
207
|
+
|
|
208
|
+
With the Tailwind theme, its utilities write it:
|
|
164
209
|
|
|
165
210
|
<div className="columns-2 gap-6 sm:columns-3">
|
|
166
211
|
<Card className="mb-6 break-inside-avoid">
|
|
@@ -184,6 +229,54 @@ enough, directly in the page.
|
|
|
184
229
|
<div className="columns-2 gap-6 sm:columns-3">…</div>
|
|
185
230
|
```
|
|
186
231
|
|
|
232
|
+
</ForTheme>
|
|
233
|
+
<ForTheme framework="custom">
|
|
234
|
+
|
|
235
|
+
With the custom theme, a class of your own — here `flow`, from
|
|
236
|
+
`theme/99-docpensieve.css`:
|
|
237
|
+
|
|
238
|
+
<div className="flow">
|
|
239
|
+
<Card>
|
|
240
|
+
<CardBody>One</CardBody>
|
|
241
|
+
</Card>
|
|
242
|
+
<Card>
|
|
243
|
+
<CardBody>Two, a little longer, so that the heights differ.</CardBody>
|
|
244
|
+
</Card>
|
|
245
|
+
<Card>
|
|
246
|
+
<CardBody>Three</CardBody>
|
|
247
|
+
</Card>
|
|
248
|
+
<Card>
|
|
249
|
+
<CardBody>Four</CardBody>
|
|
250
|
+
</Card>
|
|
251
|
+
<Card>
|
|
252
|
+
<CardBody>Five</CardBody>
|
|
253
|
+
</Card>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
```mdx
|
|
257
|
+
<div className="flow">…</div>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
```css
|
|
261
|
+
.flow {
|
|
262
|
+
columns: 2;
|
|
263
|
+
column-gap: 1.5rem;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
@media (min-width: 40rem) {
|
|
267
|
+
.flow {
|
|
268
|
+
columns: 3;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.flow > * {
|
|
273
|
+
break-inside: avoid;
|
|
274
|
+
margin-block-end: 1.5rem;
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
</ForTheme>
|
|
279
|
+
|
|
187
280
|
The difference is there: above, the order is vertical and the browser
|
|
188
281
|
distributes as it likes; with `Columns`, each block stays where you put it.
|
|
189
282
|
|
|
@@ -93,7 +93,7 @@ months.
|
|
|
93
93
|
|
|
94
94
|
An announcement banner that removes itself:
|
|
95
95
|
|
|
96
|
-
<Card
|
|
96
|
+
<Card style={{ borderColor: 'var(--dp-accent)', background: 'var(--dp-accent-soft)' }}>
|
|
97
97
|
<CardBody>
|
|
98
98
|
<TimeTimer start="01/01/2020" duration="36500d">
|
|
99
99
|
**Version 1.1 in preparation.** New features are written in this version.
|
|
@@ -46,7 +46,7 @@ children** is a collapsible branch, an entry **without children** is a leaf.
|
|
|
46
46
|
|
|
47
47
|
<Columns>
|
|
48
48
|
<Column span={6}>
|
|
49
|
-
<Card
|
|
49
|
+
<Card style={{ height: '100%' }}>
|
|
50
50
|
<CardHeader>Closed by default</CardHeader>
|
|
51
51
|
<CardBody>
|
|
52
52
|
<Tree>
|
|
@@ -58,7 +58,7 @@ children** is a collapsible branch, an entry **without children** is a leaf.
|
|
|
58
58
|
</Card>
|
|
59
59
|
</Column>
|
|
60
60
|
<Column span={6}>
|
|
61
|
-
<Card
|
|
61
|
+
<Card style={{ height: '100%' }}>
|
|
62
62
|
<CardHeader>Opened by `open`</CardHeader>
|
|
63
63
|
<CardBody>
|
|
64
64
|
<Tree>
|
|
@@ -146,12 +146,42 @@ well.
|
|
|
146
146
|
|
|
147
147
|
## Styling the tree
|
|
148
148
|
|
|
149
|
+
<ForTheme framework="tailwind">
|
|
150
|
+
|
|
149
151
|
<Tree className="text-indigo-700 dark:text-indigo-300">
|
|
150
152
|
<TreeItem label="in colour" open>
|
|
151
153
|
<TreeItem label="the children inherit" />
|
|
152
154
|
</TreeItem>
|
|
153
155
|
</Tree>
|
|
154
156
|
|
|
157
|
+
```mdx
|
|
158
|
+
<Tree className="text-indigo-700 dark:text-indigo-300">…</Tree>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
</ForTheme>
|
|
162
|
+
<ForTheme framework="custom">
|
|
163
|
+
|
|
164
|
+
A class of your own colours it — here `accent-text`, from
|
|
165
|
+
`theme/99-docpensieve.css`, which follows the palette in dark mode too:
|
|
166
|
+
|
|
167
|
+
<Tree className="accent-text">
|
|
168
|
+
<TreeItem label="in colour" open>
|
|
169
|
+
<TreeItem label="the children inherit" />
|
|
170
|
+
</TreeItem>
|
|
171
|
+
</Tree>
|
|
172
|
+
|
|
173
|
+
```mdx
|
|
174
|
+
<Tree className="accent-text">…</Tree>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
```css
|
|
178
|
+
.accent-text {
|
|
179
|
+
color: var(--dp-accent);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
</ForTheme>
|
|
184
|
+
|
|
155
185
|
## What it does not announce
|
|
156
186
|
|
|
157
187
|
The structure is a nested list, not a `role="tree"`. That role promises a
|
|
@@ -31,6 +31,8 @@ scrollToTop: false,
|
|
|
31
31
|
text**, with its own content — a pointer at the end of a chapter, for
|
|
32
32
|
instance.
|
|
33
33
|
|
|
34
|
+
<ForTheme framework="tailwind">
|
|
35
|
+
|
|
34
36
|
<div className="flex flex-wrap items-center gap-3">
|
|
35
37
|
<ScrollToTop className="!static !inline-flex !w-auto !shadow-none px-4" label="Top of page">
|
|
36
38
|
Top
|
|
@@ -59,6 +61,44 @@ All three carry `!static`: that is what takes them out of the corner of the
|
|
|
59
61
|
screen to set them in the text. **Without this class, they would stack** on
|
|
60
62
|
top of the shell's button, all in the same place.
|
|
61
63
|
|
|
64
|
+
</ForTheme>
|
|
65
|
+
<ForTheme framework="custom">
|
|
66
|
+
|
|
67
|
+
<div className="row">
|
|
68
|
+
<ScrollToTop className="inline-button" label="Top of page">
|
|
69
|
+
Top
|
|
70
|
+
</ScrollToTop>
|
|
71
|
+
<ScrollToTop className="inline-button" label="Back to the summit">
|
|
72
|
+
↑ Summit
|
|
73
|
+
</ScrollToTop>
|
|
74
|
+
<ScrollToTop className="inline-button accent-text" label="Start reading again">
|
|
75
|
+
Start again
|
|
76
|
+
</ScrollToTop>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
```mdx
|
|
80
|
+
<ScrollToTop className="inline-button" label="Top of page">
|
|
81
|
+
Top
|
|
82
|
+
</ScrollToTop>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
.inline-button {
|
|
87
|
+
position: static;
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
inline-size: auto;
|
|
90
|
+
box-shadow: none;
|
|
91
|
+
padding-inline: 1rem;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
All three carry `inline-button`, from `theme/99-docpensieve.css`: its
|
|
96
|
+
`position: static` takes them out of the corner of the screen to set them in
|
|
97
|
+
the text. **Without this class, they would stack** on top of the shell's
|
|
98
|
+
button, all in the same place.
|
|
99
|
+
|
|
100
|
+
</ForTheme>
|
|
101
|
+
|
|
62
102
|
The accessible name stays set by `label`: without it, the link would announce
|
|
63
103
|
itself by its appearance alone.
|
|
64
104
|
|
|
@@ -31,7 +31,7 @@ Content passed as a child becomes a comment under the bar.
|
|
|
31
31
|
`shape="circle"` draws a dial rather than a bar. Useful when the gauges are
|
|
32
32
|
few and you want them to stand out.
|
|
33
33
|
|
|
34
|
-
<div
|
|
34
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
35
35
|
<Skill name="Accessibility" level={85} shape="circle" />
|
|
36
36
|
<Skill name="Performance" level={92} shape="circle" />
|
|
37
37
|
<Skill name="Coverage" level={64} shape="circle" />
|
|
@@ -53,7 +53,9 @@ the entry animation only has to start from zero.
|
|
|
53
53
|
|
|
54
54
|
It is set through `--dp-skill-size`, on the gauge or on what surrounds it.
|
|
55
55
|
|
|
56
|
-
<div
|
|
56
|
+
<div
|
|
57
|
+
style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'flex-end', '--dp-skill-size': '4rem' }}
|
|
58
|
+
>
|
|
57
59
|
<Skill name="Smaller" level={70} shape="circle" />
|
|
58
60
|
<Skill name="Also smaller" level={45} shape="circle" />
|
|
59
61
|
</div>
|
|
@@ -72,7 +74,7 @@ It is set through `--dp-skill-size`, on the gauge or on what surrounds it.
|
|
|
72
74
|
|
|
73
75
|
### Without the figure
|
|
74
76
|
|
|
75
|
-
<div
|
|
77
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
76
78
|
<Skill name="Silent" level={55} shape="circle" showValue={false} />
|
|
77
79
|
</div>
|
|
78
80
|
|
|
@@ -96,7 +98,7 @@ seeing them match helps read a column of gauges at a glance.
|
|
|
96
98
|
|
|
97
99
|
### As a circle too
|
|
98
100
|
|
|
99
|
-
<div
|
|
101
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
100
102
|
<Skill
|
|
101
103
|
name="Speed"
|
|
102
104
|
level={92}
|
|
@@ -161,7 +163,7 @@ Several gauges in columns, each in its card.
|
|
|
161
163
|
|
|
162
164
|
<Columns>
|
|
163
165
|
<Column span={6}>
|
|
164
|
-
<Card
|
|
166
|
+
<Card style={{ height: '100%' }}>
|
|
165
167
|
<CardHeader>Quality</CardHeader>
|
|
166
168
|
<CardBody>
|
|
167
169
|
<Skill name="Tests" level={88} />
|
|
@@ -171,7 +173,7 @@ Several gauges in columns, each in its card.
|
|
|
171
173
|
</Card>
|
|
172
174
|
</Column>
|
|
173
175
|
<Column span={6}>
|
|
174
|
-
<Card
|
|
176
|
+
<Card style={{ height: '100%' }}>
|
|
175
177
|
<CardHeader>Delivery</CardHeader>
|
|
176
178
|
<CardBody>
|
|
177
179
|
<Skill name="Continuous integration" level={100} />
|
|
@@ -186,20 +188,50 @@ Several gauges in columns, each in its card.
|
|
|
186
188
|
|
|
187
189
|
## Styling the gauge
|
|
188
190
|
|
|
191
|
+
<ForTheme framework="tailwind">
|
|
192
|
+
|
|
189
193
|
The component classes live below the utilities: a `className` set at use wins.
|
|
190
194
|
|
|
191
195
|
<Skill className="max-w-sm" name="Reduced width" level={55} />
|
|
192
196
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
197
|
+
The gauge takes its colour from `--dp-skill-color`, which an arbitrary
|
|
198
|
+
property sets:
|
|
199
|
+
|
|
200
|
+
<Skill className="[--dp-skill-color:#10b981]" name="Green fill" level={78} />
|
|
196
201
|
|
|
197
202
|
```mdx
|
|
198
|
-
<
|
|
199
|
-
<Skill name="Green fill" level={78} />
|
|
200
|
-
</div>
|
|
203
|
+
<Skill className="[--dp-skill-color:#10b981]" name="Green fill" level={78} />
|
|
201
204
|
```
|
|
202
205
|
|
|
206
|
+
A selector written in a class, such as `[&_.dp-skill-fill]:…`, would not do:
|
|
207
|
+
its `&` reaches the HTML as `&`, and the stylesheet — compiled from the
|
|
208
|
+
rendered pages — never receives the rule.
|
|
209
|
+
|
|
210
|
+
</ForTheme>
|
|
211
|
+
<ForTheme framework="custom">
|
|
212
|
+
|
|
213
|
+
The component classes live in the `components` layer, those of the theme
|
|
214
|
+
folder in none: a class of yours set at use wins. The gauge takes its colour
|
|
215
|
+
from `--dp-skill-color`, which a class can set — here `narrow` and `green`,
|
|
216
|
+
from `theme/99-docpensieve.css`:
|
|
217
|
+
|
|
218
|
+
<Skill className="narrow" name="Reduced width" level={55} />
|
|
219
|
+
|
|
220
|
+
<Skill className="green" name="Green fill" level={78} />
|
|
221
|
+
|
|
222
|
+
```mdx
|
|
223
|
+
<Skill className="green" name="Green fill" level={78} />
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
```css
|
|
227
|
+
.green {
|
|
228
|
+
--dp-skill-color: #10b981;
|
|
229
|
+
color: #10b981;
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
</ForTheme>
|
|
234
|
+
|
|
203
235
|
## The fill
|
|
204
236
|
|
|
205
237
|
It animates as it enters the viewport, through `animation-timeline: view()`,
|