Skip to content

Commit

Permalink
Merge pull request #40 from pdsuwwz/feature/refactor-scss
Browse files Browse the repository at this point in the history
🛶 refactor(scss): use @use rule instead of @import
  • Loading branch information
pdsuwwz authored Mar 13, 2022
2 parents 2a3143d + 452d166 commit a64c8c7
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 79 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@fortawesome/vue-fontawesome": "~3.0.0-5",
"axios": "0.26.1",
"echarts": "^5.3.1",
"element-plus": "2.0.5",
"element-plus": "2.1.0",
"js-cookie": "^3.0.1",
"lodash": "^4.17.21",
"nprogress": "^0.2.0",
Expand Down
19 changes: 12 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ export default {
}
</script>

<style lang="sass">
@import '@/styles/index.scss'
<style lang="scss">
@use '@/styles/index';
</style>
2 changes: 1 addition & 1 deletion src/components/Navigation/Avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default defineComponent({
user-select: none;
img {
width: 24px;
border: 1px solid $--color-primary;
border: 1px solid $color-primary;
border-radius: 50%;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchSelect/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,6 @@ export default defineComponent({
}
}
.search-select-highlight {
color: $--color-primary;
color: $color-primary;
}
</style>
4 changes: 2 additions & 2 deletions src/locales/Translations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export default defineComponent({
.icon-outer {
display: flex;
align-items: center;
&:hover {
color: $--color-primary;
&:hover > * {
color: $color-success;
}
}
.custom-dropdown-item {
Expand Down
10 changes: 5 additions & 5 deletions src/modules/Project/components/ProjectItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default defineComponent({
margin-right: 16px;
& > svg {
font-size: 20px;
color: $--color-primary
color: $color-primary
}
}
.project-item__name-desc {
Expand All @@ -187,13 +187,13 @@ export default defineComponent({
}
.corpname-notes {
font-size: 15px;
color: $--color-info;
color: $color-info;
cursor: pointer;
}
}
.project-item__name-desc__fullname {
font-size: 12px;
color: $--color-info;
color: $color-info;
}
}
}
Expand All @@ -219,10 +219,10 @@ export default defineComponent({
}
&.active {
color: $--color-primary;
color: $color-primary;
}
&.loading {
color: $--color-primary;
color: $color-primary;
}
&:hover {
color: #6b9eff;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Result/pages/overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default defineComponent({
grid-column-start: span 2;
}
.fitting-operate {
color: $--color-primary;
color: $color-primary;
cursor: pointer;
}
}
Expand Down
19 changes: 0 additions & 19 deletions src/modules/UserAccount/pages/setting.vue

This file was deleted.

10 changes: 6 additions & 4 deletions src/styles/element-status.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '@/styles/element-variables.scss' as *;

.el-form-item__label {
color: #606266;
}
Expand All @@ -24,16 +26,16 @@
}

.el-message .el-message-icon--success {
color: $--color-success;
color: $color-success;
}
.el-message .el-message-icon--warning {
color: $--color-warning;
color: $color-warning;
}
.el-message .el-message-icon--info {
color: $--color-primary;
color: $color-primary;
}
.el-message .el-message-icon--error {
color: $--color-danger;
color: $color-danger;
}

.el-button {
Expand Down
48 changes: 24 additions & 24 deletions src/styles/element-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@
// otherwise it will affect the packaging speed.

/* theme color */
$--color-primary: #4686FF;
$--color-success: #52C41A;
$--color-warning: #FAAD14;
$--color-danger: #FA5555;
$--color-info: #909399;
$color-primary: #4686FF;
$color-success: #52C41A;
$color-warning: #FAAD14;
$color-danger: #FA5555;
$color-info: #909399;

$--colors: (
"primary": (
"base": $color-primary,
),
"success": (
"base": $color-success,
),
"warning": (
"base": $color-warning,
),
"danger": (
"base": $color-danger,
),
"info": (
"base": $color-info,
)
);

// 按需导入,重写覆盖自己所需样式
@forward "element-plus/theme-chalk/src/common/var.scss" with (
$colors: (
"primary": (
"base": $--color-primary,
),
"success": (
"base": $--color-success,
),
"warning": (
"base": $--color-warning,
),
"danger": (
"base": $--color-danger,
),
"info": (
"base": $--color-info,
),

),
$colors: $--colors,
$text-color: (
'regular': #606266,
'secondary': #909399,
Expand All @@ -46,5 +46,5 @@ $--color-info: #909399;


// :export {
// colorPrimary: $--color-primary;
// colorPrimary: $color-primary;
// }
7 changes: 3 additions & 4 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

@import '@/styles/global-class.scss';
@import '@/styles/element-variables.scss';
@import '@/styles/theme.scss';
@import '@/styles/element-status.scss';
@use '@/styles/global-class.scss';
@use '@/styles/theme.scss';
@use '@/styles/element-status.scss';

body {
width: 100vw;
Expand Down
14 changes: 7 additions & 7 deletions src/styles/theme.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

@import "element-plus/theme-chalk/src/index";
@use '@/styles/element-variables.scss' as *;
@use "element-plus/theme-chalk/src/index" as *;



#nprogress .bar {
background: $--color-primary !important;
background: $color-success !important;
}

#nprogress .peg {
box-shadow: 0 0 10px $--color-primary, 0 0 5px $--color-primary !important;
box-shadow: 0 0 10px $color-primary, 0 0 5px $color-primary !important;
}

#nprogress .spinner-icon {
border-top-color: $--color-primary;
border-left-color: $--color-primary;
}
border-top-color: $color-primary;
border-left-color: $color-primary;
}
2 changes: 1 addition & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: "@import './src/styles/element-variables.scss';"
additionalData: `@use '@/styles/element-variables.scss' as *;`
}
}
}
Expand Down

0 comments on commit a64c8c7

Please sign in to comment.