提交 d507f3ef 编写于 作者: L LeoKu

refactor: remove global import scss variables

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