From c7254cbd6bef0c583f815791ee760b9916f2aab1 Mon Sep 17 00:00:00 2001 From: LeoKu Date: Tue, 19 Oct 2021 21:59:01 +0800 Subject: [PATCH] style: improve and fix --- src/App.vue | 67 +++++++++++++++------------- src/assets/preview/glasses/round.svg | 14 +++--- src/components/CodeModal.vue | 22 ++++++++- src/components/Configurator.vue | 2 +- src/styles/variables.scss | 1 + 5 files changed, 62 insertions(+), 44 deletions(-) diff --git a/src/App.vue b/src/App.vue index 407c490..518e9dd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -279,42 +279,45 @@ function handleAction(actionType: ActionType) { } } -.gradient-bg { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - overflow: hidden; - - @mixin gradient-style($color) { - position: absolute; - width: 100vh; - height: 100vh; - background-image: radial-gradient( - rgba($color, 0.8) 20%, - rgba($color, 0.6) 40%, - rgba($color, 0.4) 60%, - rgba($color, 0.2) 80%, - transparent 100% - ); - border-radius: 50%; - opacity: 0.2; - filter: blur(4rem); - } +@supports (filter: blur(4rem)) or (-webkit-filter: blur(4rem)) or + (-moz-filter: blur(4rem)) { + .gradient-bg { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + overflow: hidden; + + @mixin gradient-style($color) { + position: absolute; + width: 100vh; + height: 100vh; + background-image: radial-gradient( + rgba($color, 0.8) 20%, + rgba($color, 0.6) 40%, + rgba($color, 0.4) 60%, + rgba($color, 0.2) 80%, + transparent 100% + ); + border-radius: 50%; + opacity: 0.2; + filter: blur(4rem); + } - .gradient-top { - @include gradient-style($color-secondary); + .gradient-top { + @include gradient-style($color-secondary); - top: -50%; - right: -20%; - } + top: -50%; + right: -20%; + } - .gradient-bottom { - @include gradient-style($color-accent); + .gradient-bottom { + @include gradient-style($color-accent); - bottom: -50%; - left: -20%; + bottom: -50%; + left: -20%; + } } } diff --git a/src/assets/preview/glasses/round.svg b/src/assets/preview/glasses/round.svg index cecbea3..d7d436d 100644 --- a/src/assets/preview/glasses/round.svg +++ b/src/assets/preview/glasses/round.svg @@ -11,25 +11,21 @@ cx="123.5" cy="28" r="26" - stroke="#aaa" + stroke="hsl(211, 19%, 70%)" stroke-width="4" /> - + - \ No newline at end of file + diff --git a/src/components/CodeModal.vue b/src/components/CodeModal.vue index 32dba35..51dfc47 100644 --- a/src/components/CodeModal.vue +++ b/src/components/CodeModal.vue @@ -96,16 +96,23 @@ onUnmounted(() => { padding: 2rem 0; overflow: hidden; transform: translate(-50%, 0); + + @supports (backdrop-filter: blur(0.1rem)) { + backdrop-filter: blur(0.1rem); + } } .code-box { $code-header-height: 4rem; + $code-box-side-padding-normal: 2rem; + $code-box-side-padding-small: 1rem; position: relative; width: 75%; max-width: 800px; height: 100%; margin: 0 auto; - padding: $code-header-height 2rem 2.5rem 2rem; + padding: $code-header-height $code-box-side-padding-normal 2.5rem + $code-box-side-padding-normal; background-color: lighten($color-dark, 3); border-radius: 1rem; transition: width 0.2s; @@ -120,6 +127,12 @@ onUnmounted(() => { @media screen and (max-width: $screen-sm) { width: 90%; + padding: $code-header-height $code-box-side-padding-small 2.5rem + $code-box-side-padding-small; + + .code-header { + padding: 0 $code-box-side-padding-small; + } } .code-header { @@ -130,7 +143,7 @@ onUnmounted(() => { align-items: center; width: 100%; height: $code-header-height; - padding: 0 2rem; + padding: 0 $code-box-side-padding-normal; .title { font-weight: bold; @@ -219,6 +232,11 @@ onUnmounted(() => { font-family: 'Ubuntu Mono', Fallback; line-height: 1.4; + @media screen and (max-width: $screen-sm) { + padding: 0 1rem; + font-size: 1rem; + } + & > .token { &.key { color: #ffcb6b; diff --git a/src/components/Configurator.vue b/src/components/Configurator.vue index 4e12293..a04a6d4 100644 --- a/src/components/Configurator.vue +++ b/src/components/Configurator.vue @@ -290,7 +290,7 @@ function switchWidget(widgetType: WidgetType, widgetShape: WidgetShape) { } & :deep(path) { - stroke: #aaa !important; + stroke: $color-stroke !important; } } } diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 7199e94..4ba2ea9 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -6,6 +6,7 @@ $color-dark: hsl(216, 14%, 14%); $color-gray: lighten($color-dark, 5); $color-page-bg: darken($color-dark, 5); $color-configurator: $color-dark; +$color-stroke: $color-text; $layout-header-height: 6rem; $layout-sider-width: 20rem; -- GitLab