Skip to content

Commit bd9fb86

Browse files
authored
tweak: add prefix of css vars (#546)
* tweak: add prefix of css vars * tweak: rename vars * chore: rename var
1 parent 0c78688 commit bd9fb86

File tree

7 files changed

+54
-47
lines changed

7 files changed

+54
-47
lines changed

gatsby-config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const docs = require("./docs/docs.json");
44

55
module.exports = {
66
siteMetadata: {
7-
title: "TiDB Docs",
7+
title:
8+
process.env.WEBSITE_BUILD_TYPE === "archive"
9+
? "TiDB Archived Docs"
10+
: "TiDB Docs",
811
description:
912
"Explore the how-to guides and references you need to use TiDB Cloud and TiDB, migrate data, and build your applications on the database.",
1013
author: "@PingCAP",

src/components/MDXComponents/DocHome.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ export function DocHomeContainer(
112112
<Box
113113
sx={{
114114
"& > a.button": {
115-
background: "var(--primary-color)",
115+
background: "var(--tiui-palette-primary)",
116116
textDecoration: "none",
117117
color: "white",
118118
"&:hover": {
119-
backgroundColor: "var(--primary-color-dark)",
119+
backgroundColor: "var(--tiui-palette-primary-dark)",
120120
},
121121
},
122122
}}
@@ -403,7 +403,7 @@ export function DocHomeCard(props: React.PropsWithChildren<DocHomeCardProps>) {
403403
"&:hover": {
404404
background:
405405
"radial-gradient(46.96% 65.78% at 100% 96.96%, #F5F8FA 0%, #FBFDFD 56.35%, #FFFFFF 100%)",
406-
borderColor: "var(--peacock-800)",
406+
borderColor: "var(--tiui-palette-peacock-800)",
407407
boxShadow: "0px 1px 0px 0px rgba(200, 206, 208, 0.1)",
408408
},
409409

src/components/MDXComponents/simple-tab.module.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ ul.tabs {
99
display: block;
1010
padding: 0.5em 1em;
1111
background-color: white;
12-
border-radius: var(--shape-border-radius) var(--shape-border-radius) 0 0;
12+
border-radius: var(--tiui-shape-border-radius)
13+
var(--tiui-shape-border-radius) 0 0;
1314
transition: background-color 0.2s ease-in-out;
1415
cursor: pointer;
1516
margin-right: 8px;
@@ -19,8 +20,8 @@ ul.tabs {
1920
}
2021

2122
&.active {
22-
background-color: var(--carbon-800);
23-
color: var(--carbon-100);
23+
background-color: var(--tiui-palette-carbon-800);
24+
color: var(--tiui-palette-carbon-100);
2425
}
2526
& + li {
2627
margin-top: 0;

src/components/MDXComponents/syntax-diagram.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.root {
2-
background: var(--carbon-200);
2+
background: var(--tiui-palette-carbon-200);
33
}
44

55
.toolbar {

src/styles/docTemplate.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@
4545
}
4646

4747
code {
48-
background-color: var(--carbon-200);
49-
border-radius: var(--shape-border-radius);
48+
background-color: var(--tiui-palette-carbon-200);
49+
border-radius: var(--tiui-shape-border-radius);
5050
}
5151

5252
pre {
5353
position: relative;
5454
overflow-x: hidden;
55-
background-color: var(--carbon-200);
56-
border-radius: var(--shape-border-radius);
55+
background-color: var(--tiui-palette-carbon-200);
56+
border-radius: var(--tiui-shape-border-radius);
5757

5858
code {
5959
.number {
@@ -106,12 +106,12 @@
106106
.markdown-body {
107107
font-family: moderat, -apple-system, "Poppins", "Helvetica Neue",
108108
"Noto Sans", "Fira Code", "IBM Plex Sans", "sans-serif";
109-
color: var(--carbon-900);
109+
color: var(--tiui-palette-carbon-900);
110110
font-size: 16px;
111111
line-height: 1.5;
112112

113113
a:not(.button) {
114-
color: var(--secondary-color);
114+
color: var(--tiui-palette-secondary);
115115
}
116116

117117
pre {

src/theme/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,56 +113,56 @@ let theme = createTheme({
113113
fontWeight: "400",
114114
fontStyle: "normal",
115115
lineHeight: "3.75rem",
116-
color: "var(--carbon-900)",
116+
color: "var(--tiui-palette-carbon-900)",
117117
},
118118
h2: {
119119
fontSize: "2rem",
120120
fontWeight: "500",
121121
fontStyle: "normal",
122122
lineHeight: "3rem",
123-
color: "var(--carbon-900)",
123+
color: "var(--tiui-palette-carbon-900)",
124124
},
125125
h3: {
126126
fontSize: "1.75rem",
127127
fontWeight: "500",
128128
fontStyle: "normal",
129129
lineHeight: "2.625rem",
130-
color: "var(--carbon-900)",
130+
color: "var(--tiui-palette-carbon-900)",
131131
},
132132
h4: {
133133
fontSize: "1.25rem",
134134
fontWeight: "500",
135135
fontStyle: "normal",
136136
lineHeight: "1.875rem",
137-
color: "var(--carbon-900)",
137+
color: "var(--tiui-palette-carbon-900)",
138138
},
139139
h5: {
140140
fontSize: "1.125rem",
141141
fontWeight: "500",
142142
fontStyle: "normal",
143143
lineHeight: "1.6875rem",
144-
color: "var(--carbon-900)",
144+
color: "var(--tiui-palette-carbon-900)",
145145
},
146146
h6: {
147147
fontSize: "0.875rem",
148148
fontWeight: "500",
149149
fontStyle: "normal",
150150
lineHeight: "1.5rem",
151-
color: "var(--carbon-900)",
151+
color: "var(--tiui-palette-carbon-900)",
152152
},
153153
body1: {
154154
fontSize: "1rem",
155155
lineHeight: "1.5rem",
156156
fontWeight: "400",
157157
fontStyle: "normal",
158-
color: "var(--carbon-900)",
158+
color: "var(--tiui-palette-carbon-900)",
159159
},
160160
body2: {
161161
fontSize: "0.875rem",
162162
lineHeight: "1.25rem",
163163
fontWeight: "400",
164164
fontStyle: "normal",
165-
color: "var(--carbon-900)",
165+
color: "var(--tiui-palette-carbon-900)",
166166
},
167167
},
168168
});

src/theme/variables.css

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
:root {
22
/* --shape-- */
3-
--shape-border-radius: 0px;
3+
--tiui-shape-border-radius: 0px;
44

5-
/* --color-- */
6-
--primary-color: #dc150b;
7-
--primary-color-dark: #d0140b;
8-
--secondary-color: var(--peacock-800);
5+
/* --palette-- */
6+
--tiui-palette-primary: #dc150b;
7+
--tiui-palette-primary-light: #dc150b;
8+
--tiui-palette-primary-dark: #d0140b;
9+
--tiui-palette-secondary: var(--tiui-palette-peacock-800);
10+
--tiui-palette-secondary-light: var(--tiui-palette-peacock-700);
11+
--tiui-palette-secondary-dark: var(--tiui-palette-peacock-900);
912

1013
/* Carbon */
11-
--carbon-50: #ffffff;
12-
--carbon-100: #fbfdfd;
13-
--carbon-200: #f5f8fa;
14-
--carbon-300: #edf0f1;
15-
--carbon-400: #e3e8ea;
16-
--carbon-500: #c8ced0;
17-
--carbon-600: #9faaad;
18-
--carbon-700: #6c7679;
19-
--carbon-800: #3d4143;
20-
--carbon-900: #262a2c;
14+
--tiui-palette-carbon-50: #ffffff;
15+
--tiui-palette-carbon-100: #fbfdfd;
16+
--tiui-palette-carbon-200: #f5f8fa;
17+
--tiui-palette-carbon-300: #edf0f1;
18+
--tiui-palette-carbon-400: #e3e8ea;
19+
--tiui-palette-carbon-500: #c8ced0;
20+
--tiui-palette-carbon-600: #9faaad;
21+
--tiui-palette-carbon-700: #6c7679;
22+
--tiui-palette-carbon-800: #3d4143;
23+
--tiui-palette-carbon-900: #262a2c;
2124

2225
/* Peacock */
23-
--peacock-50: #fbfdfe;
24-
--peacock-100: #f4fafd;
25-
--peacock-200: #eaf5fa;
26-
--peacock-300: #e0f0f8;
27-
--peacock-400: #c0e1f1;
28-
--peacock-500: #96cde9;
29-
--peacock-600: #6cbae0;
30-
--peacock-700: #2d9cd2;
31-
--peacock-800: #1480b8;
32-
--peacock-900: #0b628d;
26+
--tiui-palette-peacock-50: #fbfdfe;
27+
--tiui-palette-peacock-100: #f4fafd;
28+
--tiui-palette-peacock-200: #eaf5fa;
29+
--tiui-palette-peacock-300: #e0f0f8;
30+
--tiui-palette-peacock-400: #c0e1f1;
31+
--tiui-palette-peacock-500: #96cde9;
32+
--tiui-palette-peacock-600: #6cbae0;
33+
--tiui-palette-peacock-700: #2d9cd2;
34+
--tiui-palette-peacock-800: #1480b8;
35+
--tiui-palette-peacock-900: #0b628d;
3336
}

0 commit comments

Comments
 (0)