astro-better-steps 0.1.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/README.md +57 -0
- package/Steps.astro +9 -0
- package/index.js +1 -0
- package/package.json +18 -0
- package/style.css +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# astro-better-steps
|
|
2
|
+
|
|
3
|
+
Numbered step-by-step component for Astro. Wraps an ordered list with auto-numbered circular badges and a vertical connector line between steps. No Tailwind required.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install astro-better-steps
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Import the stylesheet once in your root layout:
|
|
12
|
+
|
|
13
|
+
```astro
|
|
14
|
+
---
|
|
15
|
+
import 'astro-better-steps/style.css';
|
|
16
|
+
---
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Wrap any `<ol>` with `<Steps>`. The component uses CSS counters to number each `<li>` automatically.
|
|
22
|
+
|
|
23
|
+
```astro
|
|
24
|
+
---
|
|
25
|
+
import { Steps } from 'astro-better-steps';
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<Steps>
|
|
29
|
+
<ol>
|
|
30
|
+
<li>Install the dependencies.</li>
|
|
31
|
+
<li>Configure your environment variables.</li>
|
|
32
|
+
<li>Start the development server.</li>
|
|
33
|
+
</ol>
|
|
34
|
+
</Steps>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Each `<li>` can contain any content including headings, code blocks, and nested lists.
|
|
38
|
+
|
|
39
|
+
## Props
|
|
40
|
+
|
|
41
|
+
| Prop | Type | Default | Description |
|
|
42
|
+
|------|------|---------|-------------|
|
|
43
|
+
| `class` | `string` | `''` | Extra CSS classes on the wrapper element |
|
|
44
|
+
|
|
45
|
+
## Dark mode
|
|
46
|
+
|
|
47
|
+
The stylesheet uses a `.dark` ancestor class (compatible with Tailwind's `darkMode: 'class'`). When `.dark` is present on `<html>` or any ancestor, the step badges switch to indigo dark mode colors.
|
|
48
|
+
|
|
49
|
+
No `@media (prefers-color-scheme: dark)` rules are included. If your project needs OS-based dark mode without a class toggle, add this to your project CSS:
|
|
50
|
+
|
|
51
|
+
```css
|
|
52
|
+
@media (prefers-color-scheme: dark) {
|
|
53
|
+
html:not([data-theme="light"]) {
|
|
54
|
+
/* .dark rules are applied by JS in most Tailwind setups */
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
package/Steps.astro
ADDED
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Steps } from './Steps.astro';
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "astro-better-steps",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Numbered step-by-step component for Astro",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.js",
|
|
8
|
+
"./style.css": "./style.css",
|
|
9
|
+
"./Steps.astro": "./Steps.astro"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"*.js",
|
|
13
|
+
"*.astro",
|
|
14
|
+
"*.css"
|
|
15
|
+
],
|
|
16
|
+
"keywords": ["astro", "steps", "numbered", "tutorial"],
|
|
17
|
+
"license": "MIT"
|
|
18
|
+
}
|
package/style.css
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
astro-better-steps/style.css
|
|
3
|
+
Dark mode: .dark ancestor class (Tailwind darkMode: 'class' compatible).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.steps-container ol {
|
|
7
|
+
list-style: none;
|
|
8
|
+
padding-left: 0;
|
|
9
|
+
margin: 0;
|
|
10
|
+
counter-reset: step;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.steps-container ol > li {
|
|
14
|
+
position: relative;
|
|
15
|
+
padding-left: 3rem;
|
|
16
|
+
padding-bottom: 2rem;
|
|
17
|
+
min-height: 2rem;
|
|
18
|
+
counter-increment: step;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* numbered circle */
|
|
22
|
+
.steps-container ol > li::before {
|
|
23
|
+
content: counter(step);
|
|
24
|
+
position: absolute;
|
|
25
|
+
left: 0;
|
|
26
|
+
top: 0;
|
|
27
|
+
display: flex;
|
|
28
|
+
height: 2rem;
|
|
29
|
+
width: 2rem;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
border-radius: 9999px;
|
|
33
|
+
border: 1px solid #c7d2fe;
|
|
34
|
+
background-color: #eef2ff;
|
|
35
|
+
color: #1e1b4b;
|
|
36
|
+
font-size: 0.75rem;
|
|
37
|
+
font-weight: 700;
|
|
38
|
+
line-height: 1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* vertical connector line */
|
|
42
|
+
.steps-container ol > li::after {
|
|
43
|
+
content: '';
|
|
44
|
+
position: absolute;
|
|
45
|
+
bottom: 0.5rem;
|
|
46
|
+
left: 0.9375rem;
|
|
47
|
+
top: 2.5rem;
|
|
48
|
+
width: 1px;
|
|
49
|
+
background-color: #c7d2fe;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.steps-container ol > li:last-child::after {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* dark mode */
|
|
57
|
+
.dark .steps-container ol > li::before {
|
|
58
|
+
border-color: #3730a3;
|
|
59
|
+
background-color: #312e81;
|
|
60
|
+
color: #e0e7ff;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.dark .steps-container ol > li::after {
|
|
64
|
+
background-color: #3730a3;
|
|
65
|
+
}
|