1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 21:33:18 +01:00

Updates themes to use vars (#541)

* Adds vars for themeing

* Uses correct color vars

* Adds more vars

* Adds other variables

* Use data attribute only

* Adds animation and unifies color

* Fixes tests

* Fixes search

* Adds docker ignore

* Fixes search text

* Fixes int tests

* Fixes int tests again
This commit is contained in:
Amir Raminfar
2020-06-27 14:32:34 -07:00
committed by GitHub
parent 3d68a8ddb0
commit 8fa672edd1
16 changed files with 153 additions and 160 deletions

View File

@@ -83,7 +83,7 @@ export default {
document.documentElement.classList.add("has-custom-scrollbars"); document.documentElement.classList.add("has-custom-scrollbars");
} }
if (this.hasLightTheme) { if (this.hasLightTheme) {
document.documentElement.classList.add("has-light-theme"); document.documentElement.setAttribute("data-theme", "light");
} }
this.menuWidth = this.settings.menuWidth; this.menuWidth = this.settings.menuWidth;
}, },
@@ -97,11 +97,11 @@ export default {
}, },
hasLightTheme(newValue, oldValue) { hasLightTheme(newValue, oldValue) {
if (newValue) { if (newValue) {
document.documentElement.classList.add("has-light-theme"); document.documentElement.setAttribute("data-theme", "light");
} else { } else {
document.documentElement.classList.remove("has-light-theme"); document.documentElement.removeAttribute("data-theme");
} }
} },
}, },
computed: { computed: {
...mapState(["activeContainers", "isMobile", "settings"]), ...mapState(["activeContainers", "isMobile", "settings"]),
@@ -132,9 +132,9 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .splitpanes--vertical > .splitpanes__splitter { ::v-deep .splitpanes--vertical > .splitpanes__splitter {
min-width: 3px; min-width: 3px;
background: #666; background: var(--border-color);
&:hover { &:hover {
background: rgb(255, 221, 87); background: var(--border-hover-color);
} }
} }
@@ -159,18 +159,6 @@ export default {
&:hover { &:hover {
left: -25px; left: -25px;
} }
html.has-light-theme & {
background-color: #7d7d68;
}
}
}
</style>
<style lang="scss">
html.has-light-theme .splitpanes--vertical > .splitpanes__splitter {
background: #DCDCDC;
&:hover {
background: #d8f0ca;
} }
} }
</style> </style>

View File

@@ -92,8 +92,8 @@ export default {
background-color: #262626; background-color: #262626;
color: #258ccd; color: #258ccd;
html.has-light-theme & { [data-theme="light"] & {
background-color: #F0F0F0; background-color: #f0f0f0;
color: #009900; color: #009900;
padding-left: 5px; padding-left: 5px;
padding-right: 5px; padding-right: 5px;
@@ -110,8 +110,8 @@ li.event {
::v-deep mark { ::v-deep mark {
border-radius: 2px; border-radius: 2px;
background-color: #ffdd57; background-color: var(--secondary-color);
animation: pops 0.2s ease-out; animation: pops 200ms ease-out;
display: inline-block; display: inline-block;
} }

View File

@@ -2,7 +2,7 @@
<aside> <aside>
<a <a
role="button" role="button"
class="navbar-burger burger is-white is-hidden-tablet is-pulled-right" class="navbar-burger burger is-hidden-tablet is-pulled-right"
@click="showNav = !showNav" @click="showNav = !showNav"
:class="{ 'is-active': showNav }" :class="{ 'is-active': showNav }"
> >
@@ -54,7 +54,7 @@ aside {
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
background: #222; background: var(--scheme-main-ter);
z-index: 2; z-index: 2;
max-height: 100vh; max-height: 100vh;
overflow: auto; overflow: auto;
@@ -68,8 +68,12 @@ aside {
overflow: hidden; overflow: hidden;
} }
.burger.is-white { .title {
color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
}
.burger {
color: var(--body-color);
} }
.is-hidden-mobile.is-active { .is-hidden-mobile.is-active {

View File

@@ -3,7 +3,7 @@
<svg width="100" height="100" viewBox="0 0 100 100"> <svg width="100" height="100" viewBox="0 0 100 100">
<circle r="44" cx="50" cy="50" :style="{ '--progress': scrollProgress }" /> <circle r="44" cx="50" cy="50" :style="{ '--progress': scrollProgress }" />
</svg> </svg>
<div class="percent columns is-vcentered is-centered"> <div class="percent columns is-vcentered is-centered has-text-weight-light">
<span class="column is-narrow is-paddingless is-size-2"> <span class="column is-narrow is-paddingless is-size-2">
{{ Math.ceil(scrollProgress * 100) }} {{ Math.ceil(scrollProgress * 100) }}
</span> </span>
@@ -73,19 +73,16 @@ export default {
display: inline-block; display: inline-block;
position: relative; position: relative;
circle { circle {
fill: #000; fill: var(--scheme-main-ter);
fill-opacity: 0.6; fill-opacity: 0.8;
transition: stroke-dashoffset 0.35s ease-out; transition: stroke-dashoffset 250ms ease-out;
transform: rotate(-90deg); transform: rotate(-90deg);
transform-origin: 50% 50%; transform-origin: 50% 50%;
stroke: #00d1b2; stroke: var(--primary-color);
stroke-dashoffset: calc(276.32px - var(--progress) * 276.32px); stroke-dashoffset: calc(276.32px - var(--progress) * 276.32px);
stroke-dasharray: 276.32px 276.32px; stroke-dasharray: 276.32px 276.32px;
stroke-width: 3; stroke-width: 3;
will-change: stroke-dashoffset; will-change: stroke-dashoffset;
html.has-light-theme & {
fill-opacity: 0.1;
}
} }
.percent { .percent {
@@ -94,10 +91,6 @@ export default {
top: 0; top: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
html.has-light-theme & {
color: #333;
}
} }
} }
</style> </style>

View File

@@ -13,12 +13,7 @@
<div class="scrollbar-notification"> <div class="scrollbar-notification">
<transition name="fade"> <transition name="fade">
<button <button class="button" :class="hasMore ? 'has-more' : ''" @click="scrollToBottom('instant')" v-show="paused">
class="button"
:class="hasMore ? 'is-warning' : 'is-primary'"
@click="scrollToBottom('instant')"
v-show="paused"
>
<icon name="download"></icon> <icon name="download"></icon>
</button> </button>
</transition> </transition>
@@ -93,10 +88,10 @@ section {
.scrollbar-progress { .scrollbar-progress {
text-align: right; text-align: right;
margin-right: 125px; margin-right: 110px;
.scroll-progress { .scroll-progress {
position: fixed; position: fixed;
top: 30px; top: 60px;
z-index: 2; z-index: 2;
} }
} }
@@ -107,6 +102,34 @@ section {
button { button {
position: fixed; position: fixed;
bottom: 30px; bottom: 30px;
background-color: var(--secondary-color);
transition: background-color 1s ease-out;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
border: none !important;
&.has-more {
background-color: var(--primary-color);
animation-name: bounce;
animation-duration: 1000ms;
animation-fill-mode: both;
color: #fff;
}
}
}
@keyframes bounce {
0%,
20%,
50%,
80%,
100% {
transform: translateY(0);
}
40% {
transform: translateY(-30px);
}
60% {
transform: translateY(-15px);
} }
} }

View File

@@ -75,17 +75,26 @@ export default {
width: 350px; width: 350px;
position: fixed; position: fixed;
padding: 10px; padding: 10px;
background: rgba(50, 50, 50, 0.9); background: var(--scheme-main-ter);
top: 0; top: 0;
right: 0; right: 0;
border-radius: 0 0 0 5px; border-radius: 0 0 0 5px;
z-index: 10; z-index: 10;
} box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
.delete {
margin-left: 1em;
}
.icon { .delete {
padding: 10px 3px; margin-left: 1em;
}
.icon {
padding: 10px 3px;
}
.input {
color: var(--body-color);
&::placeholder {
color: var(--border-color);
}
}
} }
</style> </style>

View File

@@ -79,10 +79,6 @@ aside {
overflow: hidden; overflow: hidden;
} }
.burger.is-white {
color: #fff;
}
.is-hidden-mobile.is-active { .is-hidden-mobile.is-active {
display: block !important; display: block !important;
} }
@@ -90,39 +86,7 @@ aside {
h1.title { h1.title {
font-family: "Gafata", sans-serif; font-family: "Gafata", sans-serif;
text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
html.has-light-theme & {
text-shadow: 1px 0px #ffdd57;
&.has-text-warning {
color: #ffcc00;
}
}
}
html.has-light-theme {
.menu-label {
color: #595959;
}
.menu-list a {
color: #444;
&:hover {
background-color: #eee8e7;
}
&.is-active {
background-color: #d8f0ca;
border-color: #d8f0ca;
}
}
.button {
&:active,
&.is-active {
color: #ffdd57;
}
}
} }
li.exited a { li.exited a {
@@ -133,7 +97,7 @@ li.exited a {
transition: transform 0.2s ease-out; transition: transform 0.2s ease-out;
&.is-active { &.is-active {
pointer-events: none; pointer-events: none;
color: #00d1b2; color: var(--primary-color);
} }
.router-link-exact-active & { .router-link-exact-active & {
visibility: hidden; visibility: hidden;

View File

@@ -4,7 +4,10 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Dozzle</title> <title>Dozzle</title>
<link href="https://fonts.googleapis.com/css?family=Roboto|Roboto+Mono|Gafata&display=swap" rel="stylesheet" /> <link
href="https://fonts.googleapis.com/css2?family=Gafata&family=Roboto:wght@300;400&family=Roboto+Mono&display=swap"
rel="stylesheet"
/>
<script type="application/json" id="config__json"> <script type="application/json" id="config__json">
{ {
"base": "{{ .Base }}", "base": "{{ .Base }}",

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="hero is-fullheight is-dark"> <div class="hero is-fullheight">
<div class="hero-body"> <div class="hero-body">
<div class="container has-text-centered"> <div class="container has-text-centered">
<h1 class="title">Please choose a container from the list to view the logs</h1> <h1 class="title">Please choose a container from the list to view the logs</h1>
@@ -14,17 +14,3 @@ export default {
name: "Default", name: "Default",
}; };
</script> </script>
<style scoped>
.hero.is-dark {
color: #ddd;
background-color: #111;
html.has-light-theme & {
background-color: #F8F8F8;
.title {
color: #555;
}
}
}
</style>

View File

@@ -118,23 +118,26 @@ export default {
}, },
computed: { computed: {
...mapState(["settings"]), ...mapState(["settings"]),
...["search", "size", "smallerScrollbars", "showTimestamp", "showAllContainers", "lightTheme"].reduce((map, name) => { ...["search", "size", "smallerScrollbars", "showTimestamp", "showAllContainers", "lightTheme"].reduce(
map[name] = { (map, name) => {
get() { map[name] = {
return this.settings[name]; get() {
}, return this.settings[name];
set(value) { },
this.updateSetting({ [name]: value }); set(value) {
}, this.updateSetting({ [name]: value });
}; },
return map; };
}, {}), return map;
},
{}
),
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.title { .title {
color: #eee; color: var(--title-color);
} }
a.next-release { a.next-release {
@@ -151,20 +154,9 @@ a.next-release {
} }
.has-underline { .has-underline {
border-bottom: 1px solid #fff; border-bottom: 1px solid var(--title-color);
padding: 1em 0px; padding: 1em 0px;
margin-bottom: 1em; margin-bottom: 1em;
html.has-light-theme & {
border-bottom: 1px solid #DCDCDC;
}
}
html.has-light-theme .title {
&.is-4,
&.is-6 {
color: #555;
}
} }
.item { .item {
@@ -174,10 +166,5 @@ html.has-light-theme .title {
code { code {
border-radius: 4px; border-radius: 4px;
background-color: #444; background-color: #444;
html.has-light-theme & {
background-color: #999;
color: #FFF;
}
} }
</style> </style>

View File

@@ -2,7 +2,7 @@
exports[`<Index /> renders correctly 1`] = ` exports[`<Index /> renders correctly 1`] = `
<div <div
class="hero is-fullheight is-dark" class="hero is-fullheight"
> >
<div <div
class="hero-body" class="hero-body"

View File

@@ -1,7 +1,22 @@
@charset "utf-8"; @charset "utf-8";
@import "~bulma/sass/utilities/initial-variables.sass";
$menu-item-active-background-color: hsl(171, 100%, 41%); $body-family: "Roboto", sans-serif;
$menu-item-color: hsl(0, 6%, 87%); $body-background-color: var(--body-background-color);
$body-color: var(--body-color);
$scheme-main: var(--scheme-main);
$scheme-main-bis: var(--scheme-main-bis);
$scheme-main-ter: var(--scheme-main-ter);
$border: var(--border-color);
$border-hover: var(--border-hover-color);
$menu-item-active-background-color: var(--menu-item-active-background-color);
$menu-item-color: var(--menu-item-color);
$menu-item-hover-background-color: var(--menu-item-hover-background-color);
$title-color: var(--title-color);
@import "~bulma"; @import "~bulma";
@import "../node_modules/splitpanes/dist/splitpanes.css"; @import "../node_modules/splitpanes/dist/splitpanes.css";
@@ -9,24 +24,51 @@ $menu-item-color: hsl(0, 6%, 87%);
@import "~buefy/src/scss/components/_dropdown"; @import "~buefy/src/scss/components/_dropdown";
@import "~buefy/src/scss/components/_switch"; @import "~buefy/src/scss/components/_switch";
html {
--scheme-main: #{$black};
--scheme-main-bis: #{$black-bis};
--scheme-main-ter: #{$black-ter};
--border-color: #{$grey-darker};
--border-hover-color: var(--secondary-color);
--primary-color: #{$turquoise};
--secondary-color: #{$yellow};
--body-background-color: #{$black-bis};
--body-color: #{$grey-lighter};
--menu-item-active-background-color: var(--primary-color);
--menu-item-color: hsl(0, 6%, 87%);
--menu-item-hover-background-color: #{$white-ter};
--title-color: #{$grey-lightest};
}
[data-theme="light"] {
--scheme-main: #{$white};
--scheme-main-bis: #{$white-bis};
--scheme-main-ter: #{$white-ter};
--border-color: #{$grey-lighter};
--border-hover-color: var(--secondary-color);
--primary-color: #{$turquoise};
--secondary-color: #d8f0ca;
--body-background-color: #{$white-bis};
--body-color: #{$grey-darker};
--menu-item-color: #{$grey-dark};
--menu-item-hover-background-color: #eee8e7;
--title-color: #{$grey-dark};
}
html { html {
overflow-x: unset; overflow-x: unset;
overflow-y: unset; overflow-y: unset;
scroll-snap-type: y proximity; scroll-snap-type: y proximity;
background-color: #111;
&.has-light-theme {
background-color: #F8F8F8;
}
}
body {
font-family: "Roboto", sans-serif;
color: #ddd;
html.has-light-theme & {
color: #333;
}
} }
html.has-custom-scrollbars { html.has-custom-scrollbars {
@@ -74,11 +116,4 @@ html.has-custom-scrollbars {
color: unset; color: unset;
border-color: transparent; border-color: transparent;
} }
html.has-light-theme & {
&:hover {
background: #7d7d68 !important;
border-color: #7d7d68 !important;
}
}
} }

View File

@@ -0,0 +1 @@
node_modules

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 61 KiB