Skip to content

Commit 151e087

Browse files
committed
feat(plugin-nprogress): add z-index variable
- refactor: extract css vars to a separate file
1 parent b9a4f4b commit 151e087

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

docs/reference/plugin/nprogress.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,4 @@ Integrate [nprogress](https://github.com/rstacruz/nprogress) into VuePress, whic
1616

1717
You can customize the style of the progress bar via CSS variables:
1818

19-
```css
20-
:root {
21-
--nprogress-color: #29d;
22-
}
23-
```
19+
@[code css](@vuepress/plugin-nprogress/src/client/styles/vars.css)

docs/zh/reference/plugin/nprogress.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,4 @@ title: nprogress
1616

1717
你可以通过 CSS 变量来自定义进度条的样式:
1818

19-
```css
20-
:root {
21-
--nprogress-color: #29d;
22-
}
23-
```
19+
@[code css](@vuepress/plugin-nprogress/src/client/styles/vars.css)

packages/@vuepress/plugin-nprogress/src/client/composables/useNprogress.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as nprogress from 'nprogress'
22
import { onMounted } from 'vue'
33
import { useRouter } from 'vue-router'
44

5+
import '../styles/vars.css'
56
import '../styles/nprogress.css'
67

78
export const useNprogress = (): void => {

packages/@vuepress/plugin-nprogress/src/client/styles/nprogress.css

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
:root {
2-
--nprogress-color: #29d;
3-
}
4-
51
#nprogress {
62
pointer-events: none;
73
}
84

95
#nprogress .bar {
106
background: var(--nprogress-color);
117
position: fixed;
12-
z-index: 1031;
8+
z-index: var(--nprogress-z-index);
139
top: 0;
1410
left: 0;
1511
width: 100%;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:root {
2+
--nprogress-color: #29d;
3+
--nprogress-z-index: 1031;
4+
}

0 commit comments

Comments
 (0)