Skip to content

Commit d9be40e

Browse files
committed
feat: theme css
#ref acronis#150
1 parent 0e69e31 commit d9be40e

File tree

8 files changed

+93
-59
lines changed

8 files changed

+93
-59
lines changed

packages/ui/.storybook/preview.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import type { Decorator, Preview } from '@storybook/vue3';
22
import { useEffect, useGlobals } from '@storybook/preview-api';
33
import '../src/styles/reset.css';
4-
import '@/styles/themes/acronis/acronis.pcss';
4+
import '../src/styles/themes/acronis/acronis.pcss';
55

66
export function withToggleDarkMode(StoryFn) {
77
const [globals] = useGlobals();
88
const darkMode = [true, 'true'].includes(globals.darkMode);
99

1010
useEffect(() => {
1111
if (darkMode) {
12-
global.document.documentElement.classList.add('acv-theme-dark-acronis');
13-
global.document.documentElement.classList.remove('acv-theme-light-acronis');
12+
global.document.documentElement.classList.add('acv-color-scheme-dark');
13+
global.document.documentElement.classList.remove('acv-color-scheme-light');
1414
}
1515
else {
16-
global.document.documentElement.classList.remove('acv-theme-dark-acronis');
17-
global.document.documentElement.classList.add('acv-theme-light-acronis');
16+
global.document.documentElement.classList.remove('acv-color-scheme-dark');
17+
global.document.documentElement.classList.add('acv-color-scheme-light');
1818
}
1919
}, [darkMode]);
2020

packages/ui/scripts/buildCssPlugin.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ import fs from 'node:fs';
33
import path from 'node:path';
44

55
export function buildCssPlugin(): Plugin {
6-
const stylesPath = path.join('src', 'styles', 'public');
7-
const styles = fs.readdirSync(stylesPath);
8-
const entry = Object.fromEntries(styles.map((style) => {
9-
return [`styles/${style.replace('.css', '')}`, path.join(stylesPath, style)];
10-
}));
6+
const stylesPath = path.join('src', 'styles', 'themes');
7+
const themes = fs.readdirSync(stylesPath).map((theme) => {
8+
return [`styles/themes/${theme}`, path.join(stylesPath, theme, `${theme}.pcss`)];
9+
});
10+
const entry = {
11+
'styles/reset': path.join('src', 'styles', 'reset.css'),
12+
...Object.fromEntries(themes)
13+
};
1114

1215
return {
1316
name: 'build-css-plugin',

packages/ui/src/styles/reset.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
- acv-reset - reset default browser styling for HTML elements (lowest priority)
33
- acv-theme - css for specific theme
44
*/
5-
@layer acv-reset, acv-theme;
5+
@layer acv-reset, acv-theme, acv-utilities;
6+
@import "./tokens/sizes.css";
7+
@import "./tokens/icon.css";
8+
@import "./utilities/icon.css";
69

710
@layer acv-reset {
811
*,

packages/ui/src/styles/themes/acronis/acronis-common.pcss

Lines changed: 0 additions & 47 deletions
This file was deleted.

packages/ui/src/styles/themes/acronis/acronis.pcss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@import "./acronis-common.pcss";
21
@import "./acronis-light.pcss";
32
@import "./acronis-dark.pcss";
43

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@layer acv-reset {
2+
:root {
3+
--acv-icon-color: currentColor;
4+
--acv-icon-size: var(--acv-icon-size-x-small);
5+
--acv-icon-size-xxx-small: 8px;
6+
--acv-icon-size-xx-small: 12px;
7+
--acv-icon-size-x-small: 16px;
8+
--acv-icon-size-small: 20px;
9+
--acv-icon-size-medium: 24px;
10+
--acv-icon-size-large: 32px;
11+
--acv-icon-size-x-large: 48px;
12+
--acv-icon-size-xx-large: 72px;
13+
--acv-icon-size-xxx-large: 96px;
14+
--acv-base-icon-size: var(--acv-icon-size-medium);
15+
--acv-icon-size-height: var(--acv-icon-size);
16+
--acv-icon-size-width: var(--acv-icon-size);
17+
}
18+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
@layer acv-reset {
2+
:root {
3+
--acv-outline-width: 1px;
4+
--acv-border-large: 2px;
5+
--acv-border-regular: 1px;
6+
--acv-border-x-large: 3px;
7+
--acv-font-line-height-large: 40px;
8+
--acv-font-line-height-medium: 32px;
9+
--acv-font-line-height-regular: 24px;
10+
--acv-font-line-height-small: 20px;
11+
--acv-font-line-height-x-large: 48px;
12+
--acv-font-line-height-x-small: 16px;
13+
--acv-font-size-accent: 16px;
14+
--acv-font-size-body: 14px;
15+
--acv-font-size-caption: 12px;
16+
--acv-font-size-display: 32px;
17+
--acv-font-size-fineprint: 10px;
18+
--acv-font-size-lead: 18px;
19+
--acv-font-size-note: 11px;
20+
--acv-font-size-title: 24px;
21+
--acv-font-weight-accent: 500;
22+
--acv-font-weight-regular: 400;
23+
--acv-font-weight-strong: 600;
24+
--acv-font-weight-x-strong: 700;
25+
--acv-height-large: 40px;
26+
--acv-height-regular: 32px;
27+
--acv-height-small: 24px;
28+
--acv-height-x-large: 48px;
29+
--acv-height-x-small: 16px;
30+
--acv-radius-circle: 999px;
31+
--acv-radius-large: 8px;
32+
--acv-radius-medium: 6px;
33+
--acv-radius-regular: 4px;
34+
--acv-radius-small: 2px;
35+
--acv-radius-zero: 0px;
36+
--acv-shadow-blur-regular: 20px;
37+
--acv-shadow-blur-small: 4px;
38+
--acv-shadow-position-y-regular: 8px;
39+
--acv-shadow-position-y-small: 4px;
40+
--acv-spacing-large: 24px;
41+
--acv-spacing-regular: 16px;
42+
--acv-spacing-small: 8px;
43+
--acv-spacing-x-large: 32px;
44+
--acv-spacing-x-regular: 12px;
45+
--acv-spacing-x-small: 4px;
46+
--acv-spacing-xx-small: 2px;
47+
--acv-spacing-zero: 0px;
48+
}
49+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@layer acv-utilities {
2+
.acv-icon {
3+
width: var(--acv-icon-size);
4+
height: var(--acv-icon-size);
5+
accent-color: var(--acv-icon-color);
6+
display: inline-block;
7+
vertical-align: middle;
8+
}
9+
}

0 commit comments

Comments
 (0)