From 457bb213b273a9b206cc5654eb085cede4e916ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 16 Jan 2019 16:05:40 +0100 Subject: Refactor how we use icons Inject them in an angular component so we can easily change their color --- client/src/sass/application.scss | 9 +++--- client/src/sass/include/_mixins.scss | 49 +++++++++++++++++++++++---------- client/src/sass/include/_variables.scss | 9 ++++-- 3 files changed, 45 insertions(+), 22 deletions(-) (limited to 'client/src/sass') diff --git a/client/src/sass/application.scss b/client/src/sass/application.scss index 2356f9837..37837bfc0 100644 --- a/client/src/sass/application.scss +++ b/client/src/sass/application.scss @@ -23,7 +23,7 @@ body { // now beware node-sass requires interpolation // for css custom properties #{$var} --mainColor: #{$orange-color}; - --mainHoverColor: #{$orange-hoover-color}; + --mainHoverColor: #{$orange-hover-color}; --mainBackgroundColor: #{$bg-color}; --mainForegroundColor: #{$fg-color}; --menuBackgroundColor: #{$menu-background}; @@ -229,13 +229,12 @@ label { font-weight: $font-semibold; } - .close { + my-global-icon { @include icon(24px); position: relative; top: 3px; float: right; - background-image: url('../assets/images/global/cross.svg'); margin: 0; padding: 0; @@ -324,7 +323,7 @@ ngb-tabset.bootstrap { table { .action-button-edit, .action-button-delete { &:hover, &:active, &:focus, &[disabled], &.disabled { - background-color: $grey-color !important; + background-color: $grey-background-color !important; } } } @@ -389,4 +388,4 @@ table { } } } -} \ No newline at end of file +} diff --git a/client/src/sass/include/_mixins.scss b/client/src/sass/include/_mixins.scss index d6f391a45..1da240db8 100644 --- a/client/src/sass/include/_mixins.scss +++ b/client/src/sass/include/_mixins.scss @@ -55,6 +55,18 @@ hyphens: auto; } +@mixin apply-svg-color ($color) { + /deep/ svg { + path[fill="#000000"], g[fill="#000000"], rect[fill="#000000"] { + fill: $color; + } + + path[stroke="#000000"], g[stroke="#000000"], rect[stroke="#000000"] { + stroke: $color; + } + } +} + @mixin peertube-input-text($width) { display: inline-block; height: $button-height; @@ -110,22 +122,30 @@ color: #fff; background-color: #C6C6C6; } + + my-global-icon { + @include apply-svg-color(#fff) + } } @mixin grey-button { &, &:active, &:focus { - background-color: $grey-color; - color: #585858; + background-color: $grey-background-color; + color: $grey-foreground-color; } &:hover, &:active, &:focus, &[disabled], &.disabled { - color: #585858; - background-color: $grey-hoover-color; + color: $grey-foreground-color; + background-color: $grey-background-hover-color; } &[disabled], &.disabled { cursor: default; } + + my-global-icon { + @include apply-svg-color($grey-foreground-color) + } } @mixin peertube-button { @@ -148,6 +168,15 @@ @include peertube-button; } +@mixin button-with-icon($width: 20px, $margin-right: 3px, $top: -1px) { + my-global-icon { + position: relative; + width: $width; + margin-right: $margin-right; + top: $top; + } +} + @mixin peertube-button-file ($width) { position: relative; overflow: hidden; @@ -455,18 +484,10 @@ } } -@mixin create-button ($imageUrl) { +@mixin create-button { @include peertube-button-link; @include orange-button; - - .icon.icon-add { - @include icon(20px); - - position: relative; - top: -1px; - margin-right: 5px; - background-image: url($imageUrl); - } + @include button-with-icon(20px, 5px, -1px); } @mixin row-blocks { diff --git a/client/src/sass/include/_variables.scss b/client/src/sass/include/_variables.scss index fdf33b12a..3780b7501 100644 --- a/client/src/sass/include/_variables.scss +++ b/client/src/sass/include/_variables.scss @@ -6,10 +6,13 @@ $font-regular: 400; $font-semibold: 600; $font-bold: 700; -$grey-color: #E5E5E5; -$grey-hoover-color: #EFEFEF;; +$grey-background-color: #E5E5E5; +$grey-background-hover-color: #EFEFEF; +$grey-foreground-color: #585858; +$grey-foreground-hover-color: #303030; + $orange-color: #F1680D; -$orange-hoover-color: #F97D46; +$orange-hover-color: #F97D46; $bg-color: #fff; $fg-color: #000; -- cgit v1.2.3