Skip to content

Commit cadbd96

Browse files
committed
refactor: migrate to Sass modules and migrate to CSS logical properties and values
1 parent b78e444 commit cadbd96

File tree

7 files changed

+82
-100
lines changed

7 files changed

+82
-100
lines changed

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"start": "vite"
2020
},
2121
"dependencies": {
22-
"@coreui/chartjs": "^4.0.0",
23-
"@coreui/coreui": "^5.2.0",
22+
"@coreui/chartjs": "^4.1.0",
23+
"@coreui/coreui": "^5.3.1",
2424
"@coreui/icons": "^3.0.1",
2525
"@coreui/icons-react": "^2.3.0",
2626
"@coreui/react": "^5.5.0",
@@ -41,15 +41,15 @@
4141
"devDependencies": {
4242
"@vitejs/plugin-react": "^4.3.4",
4343
"autoprefixer": "^10.4.20",
44-
"eslint": "^9.19.0",
44+
"eslint": "^9.20.1",
4545
"eslint-config-prettier": "^10.0.1",
4646
"eslint-plugin-prettier": "^5.2.3",
4747
"eslint-plugin-react": "^7.37.4",
4848
"eslint-plugin-react-hooks": "^5.1.0",
49-
"globals": "^15.14.0",
50-
"postcss": "^8.5.1",
51-
"prettier": "3.4.2",
52-
"sass": "^1.84.0",
49+
"globals": "^15.15.0",
50+
"postcss": "^8.5.2",
51+
"prettier": "3.5.1",
52+
"sass": "^1.85.0",
5353
"vite": "^6.1.0"
5454
}
5555
}

src/scss/_custom.scss

-1
This file was deleted.

src/scss/_theme.scss

-63
This file was deleted.

src/scss/_variables.scss

-5
This file was deleted.

src/scss/examples.scss

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
/* stylelint-disable scss/selector-no-redundant-nesting-selector */
2-
3-
$enable-deprecation-messages: false !default;
4-
5-
@import "@coreui/coreui/scss/functions";
6-
@import "@coreui/coreui/scss/variables";
7-
@import "@coreui/coreui/scss/mixins";
2+
@use "@coreui/coreui/scss/variables" as * with (
3+
$enable-deprecation-messages: false
4+
);
5+
@use "@coreui/coreui/scss/mixins/breakpoints" as *;
6+
@use "@coreui/coreui/scss/mixins/color-mode" as *;
87

98
.example {
109
&:not(:first-child) {
@@ -108,4 +107,10 @@ $enable-deprecation-messages: false !default;
108107
}
109108
}
110109
}
111-
}
110+
}
111+
112+
@include color-mode(dark) {
113+
.example .tab-content {
114+
background-color: var(--#{$prefix}secondary-bg);
115+
}
116+
}

src/scss/style.scss

+63-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,67 @@
1-
// If you want to override variables do it here
2-
@import "variables";
1+
@use "@coreui/coreui/scss/coreui" as * with (
2+
$enable-deprecation-messages: false,
3+
);
4+
@use "@coreui/chartjs/scss/coreui-chartjs";
5+
@use "vendors/simplebar";
36

4-
// Import styles
5-
@import "@coreui/coreui/scss/coreui";
6-
@import "@coreui/chartjs/scss/coreui-chartjs";
7+
body {
8+
background-color: var(--cui-tertiary-bg);
9+
}
710

8-
// Vendors
9-
@import "vendors/simplebar";
11+
.wrapper {
12+
width: 100%;
13+
padding-inline: var(--cui-sidebar-occupy-start, 0) var(--cui-sidebar-occupy-end, 0);
14+
will-change: auto;
15+
@include transition(padding .15s);
16+
}
1017

11-
// Custom styles for this theme
12-
@import "theme";
18+
.header > .container-fluid,
19+
.sidebar-header {
20+
min-height: calc(4rem + 1px); // stylelint-disable-line function-disallowed-list
21+
}
1322

14-
// If you want to add custom CSS you can put it here
15-
@import "custom";
23+
.sidebar-brand-full {
24+
margin-left: 3px;
25+
}
26+
27+
.sidebar-header {
28+
.nav-underline-border {
29+
--cui-nav-underline-border-link-padding-x: 1rem;
30+
--cui-nav-underline-border-gap: 0;
31+
}
32+
33+
.nav-link {
34+
display: flex;
35+
align-items: center;
36+
min-height: calc(4rem + 1px); // stylelint-disable-line function-disallowed-list
37+
}
38+
}
39+
40+
.sidebar-toggler {
41+
margin-inline-start: auto;
42+
}
43+
44+
.sidebar-narrow,
45+
.sidebar-narrow-unfoldable:not(:hover) {
46+
.sidebar-toggler {
47+
margin-inline-end: auto;
48+
}
49+
}
50+
51+
.header > .container-fluid + .container-fluid {
52+
min-height: 3rem;
53+
}
54+
55+
.footer {
56+
min-height: calc(3rem + 1px); // stylelint-disable-line function-disallowed-list
57+
}
58+
59+
@include color-mode(dark) {
60+
body {
61+
background-color: var(--cui-dark-bg-subtle);
62+
}
63+
64+
.footer {
65+
--cui-footer-bg: var(--cui-body-bg);
66+
}
67+
}

vite.config.mjs

-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ export default defineConfig(() => {
1515
autoprefixer({}), // add options if needed
1616
],
1717
},
18-
preprocessorOptions: {
19-
scss: {
20-
quietDeps: true,
21-
silenceDeprecations: ['import', 'legacy-js-api'],
22-
},
23-
},
2418
},
2519
esbuild: {
2620
loader: 'jsx',

0 commit comments

Comments
 (0)