Skip to content

Commit

Permalink
feat(badges): added is-icon class to badges and new mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
guastallaigor committed Dec 22, 2018
1 parent aaa7107 commit 20abd54
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions scss/elements/badges.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
@mixin span-style-is-icon($color, $background-color, $display, $width, $font-size) {
display: $display;
width: $width;
font-size: $font-size;
color: $color;
background-color: $background-color;
}

@mixin span-style($color, $background, $option, $width: 50%) {
position: absolute;
top: 0;
Expand All @@ -12,10 +20,10 @@
}
}

@mixin badge-style($color, $background, $is-splited: true) {
@mixin badge-style($color, $background, $option: is-default) {
$box-shadow-first-two: 0 0.5em $background, 0 -0.5em $background;

@if $is-splited == true {
@if $option == is-splited {
&:first-child {
@include span-style($color, $background, left);

Expand All @@ -26,6 +34,21 @@

box-shadow: $box-shadow-first-two, 0.5em 0 $background, 0 0 $background;
}
} @else if $option == is-icon {
&:first-child {
@include span-style-is-icon($color, $background, flex, 2.7em, 0.5em);

position: absolute;
top: -1.7em;
left: 2.5em;
align-items: center;
height: 2.7em;
}
&:last-child {
@include span-style-is-icon($color, $background, inline-block, 6em, 0.88em);

box-shadow: $box-shadow-first-two, 0.5em 0 $background, -0.5em 0 $background;
}
} @else {
&:first-child {
@include span-style($color, $background, 0, 100%);
Expand Down Expand Up @@ -63,12 +86,18 @@
@each $type in $types {
&.is-splited {
& span.is-#{nth($type, 1)} {
@include badge-style(nth($type, 2), nth($type, 3));
@include badge-style(nth($type, 2), nth($type, 3), is-splited);
}
}

&.is-icon {
& span.is-#{nth($type, 1)} {
@include badge-style(nth($type, 2), nth($type, 3), is-icon);
}
}

& span.is-#{nth($type, 1)} {
@include badge-style(nth($type, 2), nth($type, 3), false);
@include badge-style(nth($type, 2), nth($type, 3));
}
}
}

0 comments on commit 20abd54

Please sign in to comment.