Skip to content

Commit b9a4f4b

Browse files
committed
refactor(plugin-search): extract css vars to a separate file
1 parent b796eac commit b9a4f4b

File tree

7 files changed

+17
-40
lines changed

7 files changed

+17
-40
lines changed

docs/reference/plugin/search.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,7 @@ module.exports = {
140140
141141
You can customize the style of the search box via CSS variables:
142142
143-
```css
144-
:root {
145-
--search-accent-color: #3eaf7c;
146-
--search-text-color: #2c3e50;
147-
--search-border-color: #eaecef;
148-
149-
--search-item-text-color: #5d81a5;
150-
--search-item-focus-bg-color: #f3f4f5;
151-
152-
--search-input-width: 8rem;
153-
--search-result-width: 20rem;
154-
}
155-
```
143+
@[code css](@vuepress/plugin-search/src/client/styles/vars.css)
156144
157145
## Components
158146

docs/zh/reference/plugin/search.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,7 @@ module.exports = {
140140
141141
你可以通过 CSS 变量来自定义搜索框的样式:
142142
143-
```css
144-
:root {
145-
--search-accent-color: #3eaf7c;
146-
--search-text-color: #2c3e50;
147-
--search-border-color: #eaecef;
148-
149-
--search-item-text-color: #5d81a5;
150-
--search-item-focus-bg-color: #f3f4f5;
151-
152-
--search-input-width: 8rem;
153-
--search-result-width: 20rem;
154-
}
155-
```
143+
@[code css](@vuepress/plugin-search/src/client/styles/vars.css)
156144
157145
## 组件
158146

packages/@vuepress/plugin-search/src/client/clientAppEnhance.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { defineClientAppEnhance } from '@vuepress/client'
33
import { SearchBox } from './components/SearchBox'
44
import type { SearchBoxLocales } from './components/SearchBox'
55

6+
import './styles/vars.css'
7+
import './styles/search.css'
8+
69
declare const __SEARCH_LOCALES__: SearchBoxLocales
710
declare const __SEARCH_HOT_KEYS__: string[]
811
declare const __SEARCH_MAX_SUGGESTIONS__: number

packages/@vuepress/plugin-search/src/client/components/SearchBox.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
useSearchSuggestions,
1010
useSuggestionsFocus,
1111
} from '../composables'
12-
import './SearchBox.css'
1312

1413
export type SearchBoxLocales = LocaleConfig<{
1514
placeholder: string

packages/@vuepress/plugin-search/src/client/components/SearchBox.css renamed to packages/@vuepress/plugin-search/src/client/styles/search.css

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
:root {
2-
--search-bg-color: #ffffff;
3-
--search-accent-color: #3eaf7c;
4-
--search-text-color: #2c3e50;
5-
--search-border-color: #eaecef;
6-
7-
--search-item-text-color: #5d81a5;
8-
--search-item-focus-bg-color: #f3f4f5;
9-
10-
--search-input-width: 8rem;
11-
--search-result-width: 20rem;
12-
}
13-
141
.search-box {
152
display: inline-block;
163
position: relative;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:root {
2+
--search-bg-color: #ffffff;
3+
--search-accent-color: #3eaf7c;
4+
--search-text-color: #2c3e50;
5+
--search-border-color: #eaecef;
6+
7+
--search-item-text-color: #5d81a5;
8+
--search-item-focus-bg-color: #f3f4f5;
9+
10+
--search-input-width: 8rem;
11+
--search-result-width: 20rem;
12+
}

0 commit comments

Comments
 (0)