提交 d507f3ef 编写于 作者: L LeoKu

refactor: remove global import scss variables

上级 b4251e1e
...@@ -207,12 +207,14 @@ function handleAction(actionType: ActionType) { ...@@ -207,12 +207,14 @@ function handleAction(actionType: ActionType) {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use 'src/styles/var';
.main { .main {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
color: $color-text; color: var.$color-text;
background-color: $color-page-bg; background-color: var.$color-page-bg;
.content-warpper { .content-warpper {
height: 100%; height: 100%;
...@@ -242,7 +244,7 @@ function handleAction(actionType: ActionType) { ...@@ -242,7 +244,7 @@ function handleAction(actionType: ActionType) {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@media screen and (max-width: $screen-sm) { @media screen and (max-width: var.$screen-sm) {
transform: scale(0.85); transform: scale(0.85);
} }
} }
...@@ -259,21 +261,21 @@ function handleAction(actionType: ActionType) { ...@@ -259,21 +261,21 @@ function handleAction(actionType: ActionType) {
height: 2.5rem; height: 2.5rem;
margin: 0 1rem; margin: 0 1rem;
padding: 0 1rem; padding: 0 1rem;
color: $color-text; color: var.$color-text;
font-weight: bold; font-weight: bold;
background: $color-gray; background: var.$color-gray;
border-radius: 0.6rem; border-radius: 0.6rem;
cursor: pointer; cursor: pointer;
transition: color 0.2s; transition: color 0.2s;
user-select: none; user-select: none;
&:hover { &:hover {
color: lighten($color-text, 10); color: lighten(var.$color-text, 10);
} }
&:disabled, &:disabled,
&[disabled] { &[disabled] {
color: rgba($color-text, 0.5); color: rgba(var.$color-text, 0.5);
cursor: default; cursor: default;
} }
} }
...@@ -307,14 +309,14 @@ function handleAction(actionType: ActionType) { ...@@ -307,14 +309,14 @@ function handleAction(actionType: ActionType) {
} }
.gradient-top { .gradient-top {
@include gradient-style($color-secondary); @include gradient-style(var.$color-secondary);
top: -50%; top: -50%;
right: -20%; right: -20%;
} }
.gradient-bottom { .gradient-bottom {
@include gradient-style($color-accent); @include gradient-style(var.$color-accent);
bottom: -50%; bottom: -50%;
left: -20%; left: -20%;
......
...@@ -62,12 +62,14 @@ const actions = computed(() => [ ...@@ -62,12 +62,14 @@ const actions = computed(() => [
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use 'src/styles/var';
.action-menu { .action-menu {
display: flex; display: flex;
align-items: center; align-items: center;
margin-top: 5rem; margin-top: 5rem;
padding: 0.5rem; padding: 0.5rem;
background-color: $color-gray; background-color: var.$color-gray;
border-radius: 2rem; border-radius: 2rem;
.menu-item { .menu-item {
...@@ -77,7 +79,7 @@ const actions = computed(() => [ ...@@ -77,7 +79,7 @@ const actions = computed(() => [
width: 2.5rem; width: 2.5rem;
height: 2.5rem; height: 2.5rem;
margin: 0 0.5rem; margin: 0 0.5rem;
background-color: lighten($color-gray, 10); background-color: lighten(var.$color-gray, 10);
border-radius: 50%; border-radius: 50%;
cursor: pointer; cursor: pointer;
transition: opacity 0.2s; transition: opacity 0.2s;
......
...@@ -86,6 +86,8 @@ onUnmounted(() => { ...@@ -86,6 +86,8 @@ onUnmounted(() => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use 'src/styles/var';
.code-modal { .code-modal {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
...@@ -110,7 +112,7 @@ onUnmounted(() => { ...@@ -110,7 +112,7 @@ onUnmounted(() => {
margin: 0 auto; margin: 0 auto;
padding: $code-header-height $code-box-side-padding-normal 2.5rem padding: $code-header-height $code-box-side-padding-normal 2.5rem
$code-box-side-padding-normal; $code-box-side-padding-normal;
background-color: lighten($color-dark, 3); background-color: lighten(var.$color-dark, 3);
border-radius: 1rem; border-radius: 1rem;
transition: width 0.2s; transition: width 0.2s;
...@@ -118,11 +120,11 @@ onUnmounted(() => { ...@@ -118,11 +120,11 @@ onUnmounted(() => {
width: 75%; width: 75%;
} }
@media screen and (max-width: $screen-md) { @media screen and (max-width: var.$screen-md) {
width: 80%; width: 80%;
} }
@media screen and (max-width: $screen-sm) { @media screen and (max-width: var.$screen-sm) {
width: 90%; width: 90%;
padding: $code-header-height $code-box-side-padding-small 2.5rem padding: $code-header-height $code-box-side-padding-small 2.5rem
$code-box-side-padding-small; $code-box-side-padding-small;
...@@ -153,7 +155,7 @@ onUnmounted(() => { ...@@ -153,7 +155,7 @@ onUnmounted(() => {
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;
margin-left: auto; margin-left: auto;
background-color: lighten($color-dark, 8); background-color: lighten(var.$color-dark, 8);
border-radius: 50%; border-radius: 50%;
cursor: pointer; cursor: pointer;
...@@ -176,7 +178,7 @@ onUnmounted(() => { ...@@ -176,7 +178,7 @@ onUnmounted(() => {
height: 20rem; height: 20rem;
height: 100%; height: 100%;
padding: 1rem 0; padding: 1rem 0;
background: darken($color-dark, 1); background: darken(var.$color-dark, 1);
border-radius: 0.8rem; border-radius: 0.8rem;
.code-scroll-wrapper { .code-scroll-wrapper {
...@@ -193,15 +195,15 @@ onUnmounted(() => { ...@@ -193,15 +195,15 @@ onUnmounted(() => {
width: 5rem; width: 5rem;
height: 2rem; height: 2rem;
color: #fff; color: #fff;
background-color: $color-accent; background-color: var.$color-accent;
border-radius: 0.4rem; border-radius: 0.4rem;
transform: translate(-50%, -45%); transform: translate(-50%, -45%);
cursor: pointer; cursor: pointer;
transition: color 0.15s, background-color 0.15s; transition: color 0.15s, background-color 0.15s;
&.copied { &.copied {
color: $color-dark; color: var.$color-dark;
background-color: $color-secondary; background-color: var.$color-secondary;
} }
} }
} }
...@@ -220,6 +222,8 @@ onUnmounted(() => { ...@@ -220,6 +222,8 @@ onUnmounted(() => {
</style> </style>
<style lang="scss"> <style lang="scss">
@use 'src/styles/var';
.code-content { .code-content {
display: block; display: block;
padding: 0 1.5rem; padding: 0 1.5rem;
...@@ -229,7 +233,7 @@ onUnmounted(() => { ...@@ -229,7 +233,7 @@ onUnmounted(() => {
font-family: 'Ubuntu Mono', Fallback; font-family: 'Ubuntu Mono', Fallback;
line-height: 1.4; line-height: 1.4;
@media screen and (max-width: $screen-sm) { @media screen and (max-width: var.$screen-sm) {
padding: 0 1rem; padding: 0 1rem;
font-size: 1rem; font-size: 1rem;
} }
......
...@@ -165,15 +165,17 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) { ...@@ -165,15 +165,17 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use 'src/styles/var';
.configurator-scroll { .configurator-scroll {
width: $layout-sider-width; width: var.$layout-sider-width;
height: 100%; height: 100%;
background-color: $color-configurator; background-color: var.$color-configurator;
} }
.configurator { .configurator {
width: 100%; width: 100%;
color: $color-text; color: var.$color-text;
.wrapper-shape { .wrapper-shape {
display: flex; display: flex;
...@@ -187,7 +189,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) { ...@@ -187,7 +189,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) {
display: inline-block; display: inline-block;
width: 1.5rem; width: 1.5rem;
height: 1.5rem; height: 1.5rem;
background-color: $color-text; background-color: var.$color-text;
transition: background-color 0.2s; transition: background-color 0.2s;
&.circle { &.circle {
...@@ -199,7 +201,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) { ...@@ -199,7 +201,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) {
} }
&.active { &.active {
background-color: $color-accent; background-color: var.$color-accent;
} }
} }
} }
...@@ -226,7 +228,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) { ...@@ -226,7 +228,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) {
margin: 0 auto; margin: 0 auto;
font-size: 16px; font-size: 16px;
border-radius: 50%; border-radius: 50%;
box-shadow: 0 0 0.05em 0.2em $color-configurator; box-shadow: 0 0 0.05em 0.2em var.$color-configurator;
&.transparent { &.transparent {
background: #fff !important; background: #fff !important;
...@@ -265,7 +267,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) { ...@@ -265,7 +267,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) {
top: 50%; top: 50%;
left: 50%; left: 50%;
z-index: 1; z-index: 1;
color: $color-configurator; color: var.$color-configurator;
font-size: 1.5rem; font-size: 1.5rem;
transform: translate(-50%, -50%) scale(0.5); transform: translate(-50%, -50%) scale(0.5);
opacity: 0; opacity: 0;
...@@ -301,11 +303,11 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) { ...@@ -301,11 +303,11 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) {
transition: background-color 0.2s; transition: background-color 0.2s;
&.selected.selected { &.selected.selected {
background-color: lighten($color-configurator, 6); background-color: lighten(var.$color-configurator, 6);
} }
&:hover { &:hover {
background-color: darken($color-configurator, 3); background-color: darken(var.$color-configurator, 3);
} }
& > :deep(svg) { & > :deep(svg) {
...@@ -314,7 +316,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) { ...@@ -314,7 +316,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) {
} }
& :deep(path) { & :deep(path) {
stroke: $color-stroke !important; stroke: var.$color-stroke !important;
} }
} }
} }
......
...@@ -37,6 +37,8 @@ const { t } = useI18n() ...@@ -37,6 +37,8 @@ const { t } = useI18n()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use 'src/styles/var';
.download-modal-wrapper { .download-modal-wrapper {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
...@@ -53,7 +55,7 @@ const { t } = useI18n() ...@@ -53,7 +55,7 @@ const { t } = useI18n()
backdrop-filter: blur(0.3rem); backdrop-filter: blur(0.3rem);
@supports not (backdrop-filter: blur(0.3rem)) { @supports not (backdrop-filter: blur(0.3rem)) {
background-color: rgba($color-dark, 0.8); background-color: rgba(var.$color-dark, 0.8);
} }
} }
...@@ -62,8 +64,8 @@ const { t } = useI18n() ...@@ -62,8 +64,8 @@ const { t } = useI18n()
width: 50%; width: 50%;
min-width: 310px; min-width: 310px;
max-width: 500px; max-width: 500px;
background-color: darken($color-dark, 1); background-color: darken(var.$color-dark, 1);
border: 0.15rem solid rgba($color-accent, 0.8); border: 0.15rem solid rgba(var.$color-accent, 0.8);
border-radius: 1rem; border-radius: 1rem;
.modal-body { .modal-body {
...@@ -78,11 +80,11 @@ const { t } = useI18n() ...@@ -78,11 +80,11 @@ const { t } = useI18n()
width: 60%; width: 60%;
margin: 0 auto; margin: 0 auto;
@media screen and (max-width: $screen-md) { @media screen and (max-width: var.$screen-md) {
width: 80%; width: 80%;
} }
@media screen and (max-width: $screen-sm) { @media screen and (max-width: var.$screen-sm) {
width: 90%; width: 90%;
} }
...@@ -97,7 +99,7 @@ const { t } = useI18n() ...@@ -97,7 +99,7 @@ const { t } = useI18n()
max-width: 70%; max-width: 70%;
margin: 0 auto; margin: 0 auto;
padding: 1.5rem 0; padding: 1.5rem 0;
color: $color-text; color: var.$color-text;
font-size: 0.85rem; font-size: 0.85rem;
text-align: center; text-align: center;
cursor: default; cursor: default;
...@@ -113,9 +115,9 @@ const { t } = useI18n() ...@@ -113,9 +115,9 @@ const { t } = useI18n()
margin: 0 1rem; margin: 0 1rem;
margin-left: auto; margin-left: auto;
padding: 0 1rem; padding: 0 1rem;
color: $color-text; color: var.$color-text;
font-weight: bold; font-weight: bold;
background: $color-gray; background: var.$color-gray;
border-radius: 0.2rem; border-radius: 0.2rem;
border-radius: 0.6rem; border-radius: 0.6rem;
cursor: pointer; cursor: pointer;
...@@ -123,7 +125,7 @@ const { t } = useI18n() ...@@ -123,7 +125,7 @@ const { t } = useI18n()
user-select: none; user-select: none;
&:hover { &:hover {
color: lighten($color-text, 10); color: lighten(var.$color-text, 10);
transform: translateY(-0.3rem); transform: translateY(-0.3rem);
} }
} }
......
...@@ -53,16 +53,18 @@ onUnmounted(() => { ...@@ -53,16 +53,18 @@ onUnmounted(() => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use 'src/styles/var';
.container { .container {
height: 100%; height: 100%;
padding-right: $layout-sider-width; padding-right: var.$layout-sider-width;
transition: padding-right 0.2s; transition: padding-right 0.2s;
&.full { &.full {
padding-right: 0; padding-right: 0;
} }
@media screen and (max-width: $screen-lg) { @media screen and (max-width: var.$screen-lg) {
padding-right: 0; padding-right: 0;
} }
} }
......
...@@ -33,13 +33,15 @@ function switchLocale() { ...@@ -33,13 +33,15 @@ function switchLocale() {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use 'src/styles/var';
.footer { .footer {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: $layout-footer-height; height: var.$layout-footer-height;
padding: 0.8rem 0; padding: 0.8rem 0;
color: rgba($color-text, 0.4); color: rgba(var.$color-text, 0.4);
font-weight: bold; font-weight: bold;
font-size: 0.8rem; font-size: 0.8rem;
...@@ -56,7 +58,7 @@ function switchLocale() { ...@@ -56,7 +58,7 @@ function switchLocale() {
transition: color 0.2s; transition: color 0.2s;
&:hover { &:hover {
color: $color-text; color: var.$color-text;
} }
} }
} }
......
...@@ -33,10 +33,12 @@ import { recordEvent } from '@/utils/ga' ...@@ -33,10 +33,12 @@ import { recordEvent } from '@/utils/ga'
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use 'src/styles/var';
.header { .header {
display: flex; display: flex;
align-items: center; align-items: center;
height: $layout-header-height; height: var.$layout-header-height;
padding: 1rem 2rem; padding: 1rem 2rem;
.site-title { .site-title {
...@@ -45,7 +47,7 @@ import { recordEvent } from '@/utils/ga' ...@@ -45,7 +47,7 @@ import { recordEvent } from '@/utils/ga'
font-size: 1.9rem; font-size: 1.9rem;
cursor: default; cursor: default;
@media screen and (max-width: $screen-sm) { @media screen and (max-width: var.$screen-sm) {
display: none; display: none;
} }
} }
...@@ -59,18 +61,18 @@ import { recordEvent } from '@/utils/ga' ...@@ -59,18 +61,18 @@ import { recordEvent } from '@/utils/ga'
justify-content: center; justify-content: center;
width: 8rem; width: 8rem;
height: 2.5rem; height: 2.5rem;
color: $color-text; color: var.$color-text;
font-weight: bold; font-weight: bold;
font-size: 1.05rem; font-size: 1.05rem;
background-color: $color-dark; background-color: var.$color-dark;
border-radius: 0.6rem; border-radius: 0.6rem;
cursor: pointer; cursor: pointer;
transition: box-shadow 0.2s, background-color 0.2s; transition: box-shadow 0.2s, background-color 0.2s;
user-select: none; user-select: none;
&:hover { &:hover {
background-color: lighten($color-dark, 2); background-color: lighten(var.$color-dark, 2);
box-shadow: 0 0.2rem 1.5rem 0.2rem lighten($color-dark, 5); box-shadow: 0 0.2rem 1.5rem 0.2rem lighten(var.$color-dark, 5);
} }
.text { .text {
......
...@@ -16,6 +16,8 @@ const { isCollapsed, openSider, closeSider } = useSider() ...@@ -16,6 +16,8 @@ const { isCollapsed, openSider, closeSider } = useSider()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use 'src/styles/var';
.sider { .sider {
position: fixed; position: fixed;
top: 0; top: 0;
...@@ -45,7 +47,7 @@ const { isCollapsed, openSider, closeSider } = useSider() ...@@ -45,7 +47,7 @@ const { isCollapsed, openSider, closeSider } = useSider()
justify-content: center; justify-content: center;
width: 1.2rem; width: 1.2rem;
height: 4rem; height: 4rem;
background-color: lighten($color-configurator, 2); background-color: lighten(var.$color-configurator, 2);
border-radius: 0.4rem 0 0 0.4rem; border-radius: 0.4rem 0 0 0.4rem;
transform: translate(-100%, -50%); transform: translate(-100%, -50%);
cursor: pointer; cursor: pointer;
...@@ -53,7 +55,7 @@ const { isCollapsed, openSider, closeSider } = useSider() ...@@ -53,7 +55,7 @@ const { isCollapsed, openSider, closeSider } = useSider()
&:hover { &:hover {
width: 1.5rem; width: 1.5rem;
background-color: lighten($color-configurator, 5); background-color: lighten(var.$color-configurator, 5);
} }
} }
} }
......
@use 'src/styles/var';
/* stylelint-disable-next-line no-invalid-position-at-import-rule */
@import url('https://fonts.googleapis.com/css2?family=Rubik&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Rubik&display=swap');
/* stylelint-disable-next-line no-invalid-position-at-import-rule */
@import url('https://fonts.googleapis.com/css2?family=Ubuntu+Mono&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Ubuntu+Mono&display=swap');
@font-face { @font-face {
...@@ -25,7 +28,7 @@ img { ...@@ -25,7 +28,7 @@ img {
} }
::selection { ::selection {
background: rgba($color-text, 0.15); background: rgba(var.$color-text, 0.15);
} }
#app { #app {
......
...@@ -34,12 +34,4 @@ export default defineConfig(({ mode }) => ({ ...@@ -34,12 +34,4 @@ export default defineConfig(({ mode }) => ({
__VUE_I18N_LEGACY_API__: false, __VUE_I18N_LEGACY_API__: false,
__INTLIFY_PROD_DEVTOOLS__: false, __INTLIFY_PROD_DEVTOOLS__: false,
}, },
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "./src/styles/variables.scss";`,
},
},
},
})) }))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册