@sp-days-framework/docusaurus-frontpage-collection 1.0.4 → 1.1.0-beta1
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/docs/call-to-action.mdx +226 -0
- package/docs/changelog.mdx +105 -0
- package/docs/columns.mdx +198 -0
- package/docs/content-block.mdx +133 -0
- package/docs/course-feature.mdx +154 -0
- package/docs/fancy-header.mdx +83 -0
- package/docs/hero-banner.mdx +207 -0
- package/docs/icon-containers.mdx +254 -0
- package/docs/index.mdx +88 -0
- package/docs/install.mdx +187 -0
- package/docs/logo-docusaurus.svg +17 -0
- package/docs/simple-icon.mdx +235 -0
- package/docs/terminal.mdx +332 -0
- package/package.json +6 -3
- package/publish-package-docs.js +12 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_label: "Terminal"
|
|
3
|
+
sidebar_position: 2.9
|
|
4
|
+
sidebar_custom_props:
|
|
5
|
+
section: "Components"
|
|
6
|
+
section_position: 2
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
import { Terminal, TerminalCommand } from "@sp-days-framework/docusaurus-frontpage-collection";
|
|
10
|
+
|
|
11
|
+
# Terminal
|
|
12
|
+
|
|
13
|
+
A Terminal UI component that provides a styled terminal window to display CLI output. Visually differentiates expected command outputs from copyable code snippets, making documentation clearer for users following CLI tutorials and instructions.
|
|
14
|
+
|
|
15
|
+
<div style={{ position: 'relative', marginTop: '2rem', display: 'flex', justifyContent: 'center' }}>
|
|
16
|
+
<div style={{ position: 'absolute', left: '50%', marginTop: '4px', transform: 'translateX(-50%)', fontWeight: 500, color: 'var(--ifm-color-emphasis-600)' }}>
|
|
17
|
+
Preview
|
|
18
|
+
</div>
|
|
19
|
+
<div style={{ borderRadius: '12px', padding: '1rem 2rem', background: 'var(--ifm-color-emphasis-200)' }}>
|
|
20
|
+
<Terminal user="ubuntu" directory="~/" command="echo 'Hello, World!'">
|
|
21
|
+
Hello, World!
|
|
22
|
+
</Terminal>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **Terminal Window Style** - Resembles a bash terminal with decorative header
|
|
29
|
+
- **Flexible Prompt** - Customize user, host, directory in the prompt
|
|
30
|
+
- **Theme Support** - Automatic light/dark mode with customizable colors
|
|
31
|
+
- **Command Display** - Show single-line or multi-line commands
|
|
32
|
+
- **Color Support** - Inline color tags for terminal output (red, green, cyan, etc.)
|
|
33
|
+
- **Collapsible** - Collapse/expand terminal content with smooth animation
|
|
34
|
+
|
|
35
|
+
### When to Use
|
|
36
|
+
|
|
37
|
+
- Showing expected CLI output in tutorials
|
|
38
|
+
- Demonstrating command results
|
|
39
|
+
- Differentiating output from copyable code blocks
|
|
40
|
+
- Creating realistic terminal examples
|
|
41
|
+
|
|
42
|
+
## Import
|
|
43
|
+
|
|
44
|
+
```mdx
|
|
45
|
+
import { Terminal, TerminalCommand } from "@sp-days-framework/docusaurus-frontpage-collection";
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Basic Usage
|
|
49
|
+
|
|
50
|
+
```mdx
|
|
51
|
+
<Terminal>
|
|
52
|
+
Hello, World!
|
|
53
|
+
</Terminal>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
<Terminal>
|
|
57
|
+
Hello, World!
|
|
58
|
+
</Terminal>
|
|
59
|
+
|
|
60
|
+
## Props
|
|
61
|
+
|
|
62
|
+
### Terminal
|
|
63
|
+
|
|
64
|
+
| Prop | Type | Default | Description |
|
|
65
|
+
| ------------ | ----------------- | ---------- | ---------------------------------------------- |
|
|
66
|
+
| `user` | `string` | - | Username to display in the prompt |
|
|
67
|
+
| `host` | `string` | - | Hostname to display in the prompt |
|
|
68
|
+
| `directory` | `string` | - | Directory/path to display in the prompt |
|
|
69
|
+
| `command` | `string` | - | Command to display (ignored if TerminalCommand is used) |
|
|
70
|
+
| `hideHeader` | `boolean` | `false` | Hide the terminal header (dots and controls) |
|
|
71
|
+
| `maxHeight` | `string` | `"500px"` | Maximum height before scrolling |
|
|
72
|
+
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
### Simple Output
|
|
76
|
+
|
|
77
|
+
Display basic terminal output without a prompt:
|
|
78
|
+
|
|
79
|
+
```mdx
|
|
80
|
+
<Terminal>
|
|
81
|
+
npm install @sp-days-framework/docusaurus-frontpage-collection
|
|
82
|
+
</Terminal>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
<Terminal>
|
|
86
|
+
npm install @sp-days-framework/docusaurus-frontpage-collection
|
|
87
|
+
</Terminal>
|
|
88
|
+
|
|
89
|
+
### With User and Directory
|
|
90
|
+
|
|
91
|
+
Show a prompt with username and directory:
|
|
92
|
+
|
|
93
|
+
```mdx
|
|
94
|
+
<Terminal user="ubuntu" directory="~/">
|
|
95
|
+
Welcome to Ubuntu 24.04 LTS
|
|
96
|
+
</Terminal>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
<Terminal user="ubuntu" directory="~/">
|
|
100
|
+
Welcome to Ubuntu 24.04 LTS
|
|
101
|
+
</Terminal>
|
|
102
|
+
|
|
103
|
+
### With User, Host, and Directory
|
|
104
|
+
|
|
105
|
+
Full prompt with user, host, and directory:
|
|
106
|
+
|
|
107
|
+
```mdx
|
|
108
|
+
<Terminal user="developer" host="localhost" directory="~/projects">
|
|
109
|
+
Project initialized successfully!
|
|
110
|
+
</Terminal>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
<Terminal user="developer" host="localhost" directory="~/projects">
|
|
114
|
+
Project initialized successfully!
|
|
115
|
+
</Terminal>
|
|
116
|
+
|
|
117
|
+
### With Single-Line Command
|
|
118
|
+
|
|
119
|
+
Display a single-line command in the prompt:
|
|
120
|
+
|
|
121
|
+
```mdx
|
|
122
|
+
<Terminal user="ubuntu" directory="~/" command="ls -la">
|
|
123
|
+
total 128
|
|
124
|
+
drwxr-xr-x 12 user group 4096 Nov 28 10:30 .
|
|
125
|
+
drwxr-xr-x 8 user group 4096 Nov 27 15:20 ..
|
|
126
|
+
-rw-r--r-- 1 user group 220 Nov 20 09:15 .bashrc
|
|
127
|
+
</Terminal>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
<Terminal user="ubuntu" directory="~/" command="ls -la">
|
|
131
|
+
total 128
|
|
132
|
+
drwxr-xr-x 12 user group 4096 Nov 28 10:30 .
|
|
133
|
+
drwxr-xr-x 8 user group 4096 Nov 27 15:20 ..
|
|
134
|
+
-rw-r--r-- 1 user group 220 Nov 20 09:15 .bashrc
|
|
135
|
+
</Terminal>
|
|
136
|
+
|
|
137
|
+
### With Multi-Line Command
|
|
138
|
+
|
|
139
|
+
Use `TerminalCommand` for multi-line commands:
|
|
140
|
+
|
|
141
|
+
```mdx
|
|
142
|
+
<Terminal user="ubuntu" directory="~/app">
|
|
143
|
+
<TerminalCommand>
|
|
144
|
+
docker run \
|
|
145
|
+
-v /data:/data \
|
|
146
|
+
-p 8080:80 \
|
|
147
|
+
nginx
|
|
148
|
+
</TerminalCommand>
|
|
149
|
+
Unable to find image 'nginx:latest' locally
|
|
150
|
+
latest: Pulling from library/nginx
|
|
151
|
+
Status: Downloaded newer image for nginx:latest
|
|
152
|
+
</Terminal>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
<Terminal user="ubuntu" directory="~/app">
|
|
156
|
+
<TerminalCommand>
|
|
157
|
+
docker run \
|
|
158
|
+
-v /data:/data \
|
|
159
|
+
-p 8080:80 \
|
|
160
|
+
nginx
|
|
161
|
+
</TerminalCommand>
|
|
162
|
+
Unable to find image 'nginx:latest' locally
|
|
163
|
+
latest: Pulling from library/nginx
|
|
164
|
+
Status: Downloaded newer image for nginx:latest
|
|
165
|
+
</Terminal>
|
|
166
|
+
|
|
167
|
+
:::tip Escaping Backslashes
|
|
168
|
+
When displaying multi-line commands with line continuation (`\`), you need to escape the backslash in MDX using the HTML entity `\` to ensure it renders correctly. MDX may otherwise interpret `\` as an escape character.
|
|
169
|
+
|
|
170
|
+
**Example:**
|
|
171
|
+
```mdx
|
|
172
|
+
<TerminalCommand>
|
|
173
|
+
docker run \
|
|
174
|
+
--name mycontainer \
|
|
175
|
+
nginx
|
|
176
|
+
</TerminalCommand>
|
|
177
|
+
```
|
|
178
|
+
:::
|
|
179
|
+
|
|
180
|
+
### With Colored Output
|
|
181
|
+
|
|
182
|
+
Terminal output supports the following inline color tags:
|
|
183
|
+
|
|
184
|
+
```mdx
|
|
185
|
+
<Terminal>
|
|
186
|
+
<red>Red text</red>
|
|
187
|
+
<green>Green text</green>
|
|
188
|
+
<yellow>Yellow text</yellow>
|
|
189
|
+
<blue>Blue text</blue>
|
|
190
|
+
<magenta>Magenta text</magenta>
|
|
191
|
+
<cyan>Cyan text</cyan>
|
|
192
|
+
<white>White text</white>
|
|
193
|
+
<gray>Gray text</gray>
|
|
194
|
+
<bold>Bold text</bold>
|
|
195
|
+
</Terminal>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
<Terminal>
|
|
199
|
+
<red>Red text</red>
|
|
200
|
+
<green>Green text</green>
|
|
201
|
+
<yellow>Yellow text</yellow>
|
|
202
|
+
<blue>Blue text</blue>
|
|
203
|
+
<magenta>Magenta text</magenta>
|
|
204
|
+
<cyan>Cyan text</cyan>
|
|
205
|
+
<white>White text</white>
|
|
206
|
+
<gray>Gray text</gray>
|
|
207
|
+
<bold>Bold text</bold>
|
|
208
|
+
</Terminal>
|
|
209
|
+
|
|
210
|
+
#### Status Output
|
|
211
|
+
|
|
212
|
+
Add visual interest using inline color tags:
|
|
213
|
+
|
|
214
|
+
```mdx
|
|
215
|
+
<Terminal user="developer" directory="~/" command="docker ps">
|
|
216
|
+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
|
217
|
+
<cyan>a1b2c3d4e5f6</cyan> <green>nginx</green> "nginx" <yellow>2 hours</yellow> <green>Up 2hr</green> 80/tcp webserver
|
|
218
|
+
<cyan>f6e5d4c3b2a1</cyan> <green>redis</green> "redis" <yellow>3 hours</yellow> <green>Up 3hr</green> 6379/tcp cache
|
|
219
|
+
</Terminal>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
<Terminal user="developer" directory="~/" command="docker ps">
|
|
223
|
+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
|
224
|
+
<cyan>a1b2c3d4e5f6</cyan> <green>nginx</green> "nginx" <yellow>2 hours</yellow> <green>Up 2hr</green> 80/tcp webserver
|
|
225
|
+
<cyan>f6e5d4c3b2a1</cyan> <green>redis</green> "redis" <yellow>3 hours</yellow> <green>Up 3hr</green> 6379/tcp cache
|
|
226
|
+
</Terminal>
|
|
227
|
+
|
|
228
|
+
#### Error Output
|
|
229
|
+
|
|
230
|
+
Show error messages with red color:
|
|
231
|
+
|
|
232
|
+
```mdx
|
|
233
|
+
<Terminal user="ubuntu" directory="~/" command="npm start">
|
|
234
|
+
<red>Error: Cannot find module 'express'</red>
|
|
235
|
+
<gray>at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)</gray>
|
|
236
|
+
<gray>at Function.Module._load (internal/modules/cjs/loader.js:725:27)</gray>
|
|
237
|
+
</Terminal>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
<Terminal user="ubuntu" directory="~/" command="npm start">
|
|
241
|
+
<red>Error: Cannot find module 'express'</red>
|
|
242
|
+
<gray>at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)</gray>
|
|
243
|
+
<gray>at Function.Module._load (internal/modules/cjs/loader.js:725:27)</gray>
|
|
244
|
+
</Terminal>
|
|
245
|
+
|
|
246
|
+
#### Success Output
|
|
247
|
+
|
|
248
|
+
Show success messages with green color:
|
|
249
|
+
|
|
250
|
+
```mdx
|
|
251
|
+
<Terminal user="root" directory="/opt/app" command="systemctl status nginx">
|
|
252
|
+
● nginx.service - A high performance web server
|
|
253
|
+
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
|
|
254
|
+
Active: <green><bold>active (running)</bold></green> since Thu 2024-11-28 10:00:00 UTC; 2h 30min ago
|
|
255
|
+
</Terminal>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
<Terminal user="root" directory="/opt/app" command="systemctl status nginx">
|
|
259
|
+
● nginx.service - A high performance web server
|
|
260
|
+
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
|
|
261
|
+
Active: <green><bold>active (running)</bold></green> since Thu 2024-11-28 10:00:00 UTC; 2h 30min ago
|
|
262
|
+
</Terminal>
|
|
263
|
+
|
|
264
|
+
### Long Output with Scrolling
|
|
265
|
+
|
|
266
|
+
Control maximum height for long outputs:
|
|
267
|
+
|
|
268
|
+
```mdx
|
|
269
|
+
<Terminal user="root" directory="/var/log/" command="cat syslog" maxHeight="200px">
|
|
270
|
+
Nov 28 10:00:01 server systemd[1]: Started Session 123
|
|
271
|
+
Nov 28 10:00:05 server sshd[4567]: Accepted publickey for admin
|
|
272
|
+
Nov 28 10:01:00 server CRON[5678]: (root) CMD (run-parts /etc/cron.hourly)
|
|
273
|
+
Nov 28 10:02:15 server systemd[1]: Starting Daily apt download activities...
|
|
274
|
+
Nov 28 10:02:16 server systemd[1]: Started Daily apt download activities.
|
|
275
|
+
{/* Many more lines... */}
|
|
276
|
+
</Terminal>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
<Terminal user="root" directory="/var/log/" command="cat syslog" maxHeight="200px">
|
|
280
|
+
Nov 28 10:00:01 server systemd[1]: Started Session 123
|
|
281
|
+
Nov 28 10:00:05 server sshd[4567]: Accepted publickey for admin
|
|
282
|
+
Nov 28 10:01:00 server CRON[5678]: (root) CMD (run-parts /etc/cron.hourly)
|
|
283
|
+
Nov 28 10:02:15 server systemd[1]: Starting Daily apt download activities...
|
|
284
|
+
Nov 28 10:02:16 server systemd[1]: Started Daily apt download activities.
|
|
285
|
+
Nov 28 10:03:00 server CRON[5679]: (root) CMD (run-parts /etc/cron.hourly)
|
|
286
|
+
Nov 28 10:04:00 server CRON[5680]: (root) CMD (run-parts /etc/cron.hourly)
|
|
287
|
+
Nov 28 10:05:00 server CRON[5681]: (root) CMD (run-parts /etc/cron.hourly)
|
|
288
|
+
Nov 28 10:06:00 server CRON[5682]: (root) CMD (run-parts /etc/cron.hourly)
|
|
289
|
+
Nov 28 10:07:00 server CRON[5683]: (root) CMD (run-parts /etc/cron.hourly)
|
|
290
|
+
</Terminal>
|
|
291
|
+
|
|
292
|
+
### Hide Header
|
|
293
|
+
|
|
294
|
+
If you don't need the interactive controls, hide the entire header:
|
|
295
|
+
|
|
296
|
+
```mdx
|
|
297
|
+
<Terminal hideHeader>
|
|
298
|
+
Output without header controls
|
|
299
|
+
</Terminal>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
<Terminal hideHeader>
|
|
303
|
+
Output without header controls
|
|
304
|
+
</Terminal>
|
|
305
|
+
|
|
306
|
+
## Customization
|
|
307
|
+
|
|
308
|
+
### Override Terminal Colors
|
|
309
|
+
|
|
310
|
+
Customize terminal colors in your Docusaurus `custom.css`:
|
|
311
|
+
|
|
312
|
+
```css
|
|
313
|
+
:root {
|
|
314
|
+
--terminal-bg: #fafafa;
|
|
315
|
+
--terminal-text: #222;
|
|
316
|
+
--terminal-green: #00aa00;
|
|
317
|
+
--terminal-red: #cc0000;
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Custom Styling
|
|
322
|
+
|
|
323
|
+
Apply custom styles via props:
|
|
324
|
+
|
|
325
|
+
```mdx
|
|
326
|
+
<Terminal
|
|
327
|
+
className="my-custom-terminal"
|
|
328
|
+
style={{ maxWidth: '800px', margin: '2rem auto' }}
|
|
329
|
+
>
|
|
330
|
+
Custom styled terminal
|
|
331
|
+
</Terminal>
|
|
332
|
+
```
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sp-days-framework/docusaurus-frontpage-collection",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0-beta1",
|
|
4
4
|
"description": "A collection of Docusaurus frontpage UI components.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/helse-sorost/sp-days-framework",
|
|
7
|
+
"url": "git+https://github.com/helse-sorost/sp-days-framework.git",
|
|
8
8
|
"directory": "docusaurus-frontpage-collection"
|
|
9
9
|
},
|
|
10
10
|
"author": "SP-Days Framework",
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"types": "lib/index.d.ts",
|
|
22
22
|
"files": [
|
|
23
23
|
"lib/**/*",
|
|
24
|
+
"docs/**/*",
|
|
25
|
+
"publish-package-docs.js",
|
|
24
26
|
"README.md",
|
|
25
27
|
"LICENSE"
|
|
26
28
|
],
|
|
@@ -31,7 +33,8 @@
|
|
|
31
33
|
"types": "./lib/index.d.ts"
|
|
32
34
|
},
|
|
33
35
|
"./lib/components*": "./lib/components/*",
|
|
34
|
-
"./lib/plugin/*": "./lib/plugin/*"
|
|
36
|
+
"./lib/plugin/*": "./lib/plugin/*",
|
|
37
|
+
"./publish-package-docs": "./publish-package-docs.js"
|
|
35
38
|
},
|
|
36
39
|
"publishConfig": {
|
|
37
40
|
"access": "public"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Sykehuspartner HF
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
id: 'frontpage-collection-docs',
|
|
10
|
+
path: require('path').join(__dirname, 'docs'),
|
|
11
|
+
routeBasePath: 'package-docs/frontpage-collection',
|
|
12
|
+
};
|