Skip to content

Commit

Permalink
Merge branch 'master' into 5785-tooltip-z-index-helper-import
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan authored Apr 2, 2020
2 parents e7f8e0b + 33bc00b commit 706e8fa
Show file tree
Hide file tree
Showing 11 changed files with 2,676 additions and 444 deletions.
808 changes: 650 additions & 158 deletions packages/components/docs/sass.md

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion packages/components/src/components/tag/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@

/// @access private
/// @group tag
@mixin tag-theme($bg-color, $text-color) {
@mixin tag-theme($bg-color, $text-color, $filter-hover-color: $bg-color) {
background-color: $bg-color;
color: $text-color;

.#{$prefix}--tag__close-icon {
&:hover {
background-color: $filter-hover-color;
}

svg {
fill: $text-color;
}
}
}
82 changes: 60 additions & 22 deletions packages/components/src/components/tag/_tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
@import '../../globals/scss/vars';
@import '../../globals/scss/helper-mixins';
@import '../../globals/scss/typography';
@import '../../globals/scss/component-tokens';
@import '../../globals/scss/vendor/@carbon/elements/scss/import-once/import-once';
@import 'mixins';
@import 'tokens';

/// Tag styles
/// @access private
Expand All @@ -18,7 +20,11 @@
.#{$prefix}--tag {
@include button-reset($width: false);
@include type-style('label-01');
@include tag-theme($ibm-color__gray-20, $ibm-color__gray-100);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-gray'),
get-token-value($tag-colors, 'tag-color-gray'),
get-token-value($tag-colors, 'tag-hover-gray'),
);

display: inline-flex;
align-items: center;
Expand All @@ -41,48 +47,88 @@
}

.#{$prefix}--tag--red {
@include tag-theme($ibm-color__red-20, $ibm-color__red-70);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-red'),
get-token-value($tag-colors, 'tag-color-red'),
get-token-value($tag-colors, 'tag-hover-red'),
);
}

.#{$prefix}--tag--magenta {
@include tag-theme($ibm-color__magenta-20, $ibm-color__magenta-70);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-magenta'),
get-token-value($tag-colors, 'tag-color-magenta'),
get-token-value($tag-colors, 'tag-hover-magenta'),
);
}

.#{$prefix}--tag--purple {
@include tag-theme($ibm-color__purple-20, $ibm-color__purple-70);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-purple'),
get-token-value($tag-colors, 'tag-color-purple'),
get-token-value($tag-colors, 'tag-hover-purple'),
);
}

.#{$prefix}--tag--blue {
@include tag-theme($ibm-color__blue-20, $ibm-color__blue-70);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-blue'),
get-token-value($tag-colors, 'tag-color-blue'),
get-token-value($tag-colors, 'tag-hover-blue'),
);
}

.#{$prefix}--tag--cyan {
@include tag-theme($ibm-color__cyan-20, $ibm-color__cyan-70);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-cyan'),
get-token-value($tag-colors, 'tag-color-cyan'),
get-token-value($tag-colors, 'tag-hover-cyan'),
);
}

.#{$prefix}--tag--teal {
@include tag-theme($ibm-color__teal-20, $ibm-color__teal-70);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-teal'),
get-token-value($tag-colors, 'tag-color-teal'),
get-token-value($tag-colors, 'tag-hover-teal'),
);
}

.#{$prefix}--tag--green {
@include tag-theme($ibm-color__green-20, $ibm-color__green-70);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-green'),
get-token-value($tag-colors, 'tag-color-green'),
get-token-value($tag-colors, 'tag-hover-green'),
);
}

.#{$prefix}--tag--gray {
@include tag-theme($ibm-color__gray-20, $ibm-color__gray-100);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-gray'),
get-token-value($tag-colors, 'tag-color-gray'),
get-token-value($tag-colors, 'tag-hover-gray'),
);
}

.#{$prefix}--tag--cool-gray {
@include tag-theme($ibm-color__cool-gray-20, $ibm-color__cool-gray-100);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-cool-gray'),
get-token-value($tag-colors, 'tag-color-cool-gray'),
get-token-value($tag-colors, 'tag-hover-cool-gray'),
);
}

.#{$prefix}--tag--warm-gray {
@include tag-theme($ibm-color__warm-gray-20, $ibm-color__warm-gray-100);
@include tag-theme(
get-token-value($tag-colors, 'tag-background-warm-gray'),
get-token-value($tag-colors, 'tag-color-warm-gray'),
get-token-value($tag-colors, 'tag-hover-warm-gray'),
);
}

.#{$prefix}--tag--disabled,
.#{$prefix}--tag--filter.#{$prefix}--tag--disabled {
@include tag-theme($ibm-color__gray-10, $ibm-color__gray-30);
@include tag-theme($disabled-01, $disabled-02);

&:hover {
cursor: not-allowed;
Expand All @@ -98,7 +144,7 @@

// tags used for filtering
.#{$prefix}--tag--filter {
@include tag-theme($inverse-02, $inverse-01);
cursor: pointer;
padding-right: rem(2px);

&:focus,
Expand All @@ -117,19 +163,11 @@
background-color: transparent;
border-radius: 50%;
cursor: pointer;

&:hover {
background-color: $inverse-hover-ui;
}
}

.#{$prefix}--tag__close-icon svg {
fill: $inverse-01;
}

.#{$prefix}--tag__close-icon:focus {
outline: none;
box-shadow: inset 0 0 0 2px $inverse-focus-ui;
box-shadow: inset 0 0 0 2px $focus;
border-radius: 50%;
}

Expand Down
Loading

0 comments on commit 706e8fa

Please sign in to comment.