Skip to content

Commit

Permalink
feat(tag): add outline variant (#9792)
Browse files Browse the repository at this point in the history
* feat(tag): add outline variant

* chore: run prettier
  • Loading branch information
janhassel authored Oct 4, 2021
1 parent 90b2b8c commit d02a8e5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/carbon-react/src/components/Tag/Tag.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,30 @@ export const Default = () => {
<Tag className="some-class" type="gray" size="sm" title="Clear Filter">
{'Tag content'}
</Tag>
<Tag
className="some-class"
type="cool-gray"
size="sm"
title="Clear Filter">
{'Tag content'}
</Tag>
<Tag
className="some-class"
type="warm-gray"
size="sm"
title="Clear Filter">
{'Tag content'}
</Tag>
<Tag
className="some-class"
type="high-contrast"
size="sm"
title="Clear Filter">
{'Tag content'}
</Tag>
<Tag className="some-class" type="outline" size="sm" title="Clear Filter">
{'Tag content'}
</Tag>
</>
);
};
6 changes: 6 additions & 0 deletions packages/components/src/components/tag/_tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
@include tag-theme($inverse-02, $inverse-01, $inverse-hover-ui);
}

.#{$prefix}--tag--outline {
@include tag-theme($background, $text-01, $hover-ui);

box-shadow: inset 0 0 0 1px $inverse-02;
}

.#{$prefix}--tag--disabled,
.#{$prefix}--tag--filter.#{$prefix}--tag--disabled,
.#{$prefix}--tag--interactive.#{$prefix}--tag--disabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6040,6 +6040,7 @@ Map {
"cool-gray",
"warm-gray",
"high-contrast",
"outline",
],
],
"type": "oneOf",
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Tag/Tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const TYPES = {
'cool-gray': 'Cool-Gray',
'warm-gray': 'Warm-Gray',
'high-contrast': 'High-Contrast',
outline: 'Outline',
};

const Tag = ({
Expand Down
6 changes: 6 additions & 0 deletions packages/styles/scss/components/tag/_tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@
);
}

.#{$prefix}--tag--outline {
@include tag-theme($background, $text-primary, $layer-hover);

box-shadow: inset 0 0 0 1px $background-inverse;
}

.#{$prefix}--tag--disabled,
.#{$prefix}--tag--filter.#{$prefix}--tag--disabled,
.#{$prefix}--tag--interactive.#{$prefix}--tag--disabled {
Expand Down

0 comments on commit d02a8e5

Please sign in to comment.