Skip to content

Commit

Permalink
Merge pull request #2755 from SUI-Components/remove-settings-v7-theme
Browse files Browse the repository at this point in the history
 make tag compatible without theme-v7 deprecated sui-theme module
  • Loading branch information
andresin87 authored Aug 21, 2024
2 parents 533e040 + 59b4edf commit a7a43ef
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 48 deletions.
4 changes: 2 additions & 2 deletions components/atom/tag/demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import ArticleDesign from './articles/ArticleDesign.js'
import ArticleIcons from './articles/ArticleIcons.js'
import ArticleIsFitted from './articles/ArticleIsFitted.js'
import ArticleSize from './articles/ArticleSize.js'
import ArticleResponsive from './articles/ArticleResponsive.js'
import ArticleTypes from './articles/ArticleTypes.js'
import ArticleResponsive from './articles/ArticleResponsive.js'
import {CLASS_SECTION, closeIcon, icon} from './settings.js'

import './index.scss'
Expand All @@ -25,7 +25,7 @@ export default () => (
<br />
<ArticleIcons className={CLASS_SECTION} />
<br />
<Article className={CLASS_SECTION}></Article>
<Article className={CLASS_SECTION} />
<br />
<ArticleTypes className={CLASS_SECTION} icon={icon} closeIcon={closeIcon} />
<br />
Expand Down
4 changes: 2 additions & 2 deletions components/atom/tag/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const AtomTag = forwardRef(

const classNames = cx(
'sui-AtomTag',
`sui-AtomTag-${size}`,
design && `sui-AtomTag--${design}`,
`sui-AtomTag--size-${size}`,
design && `sui-AtomTag--design-${design}`,
icon && 'sui-AtomTag-hasIcon',
responsive && 'sui-AtomTag--responsive',
type && `sui-AtomTag--${type}`,
Expand Down
1 change: 0 additions & 1 deletion components/atom/tag/src/index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import '~@s-ui/theme/lib/settings-compat-v7/index';
@import '~@s-ui/theme/lib/index';

@import './styles/settings.scss';
Expand Down
126 changes: 83 additions & 43 deletions components/atom/tag/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ $base-class: '.sui-AtomTag';

#{$base-class} {
$self: &;
border-radius: ceil($h-atom-tag-m * 0.5);
height: $h-atom-tag-m;
padding: $p-atom-tag-m;
border: $bd-atom-tag;
align-items: center;
align-content: center;
background-color: $bgc-atom-tag;
border: $bd-atom-tag;
border-radius: ceil($h-atom-tag-m * 0.5);
box-sizing: border-box;
cursor: default;
display: inline-flex;
font-size: $fz-s;
height: $h-atom-tag-m;
justify-content: center;
margin: 0 $m-atom-tag $m-atom-tag 0;
padding: $p-atom-tag-m;
position: relative;
white-space: nowrap;

Expand Down Expand Up @@ -75,10 +75,12 @@ $base-class: '.sui-AtomTag';

&-icon {
@include icon-atom-tag(icon);
margin-left: 0;
}

&-secondary-icon {
@include icon-atom-tag(icon-secondary);
margin-right: 0;
}
&-actionable {
background-color: $bgc-atom-tag-actionable;
Expand Down Expand Up @@ -111,7 +113,7 @@ $base-class: '.sui-AtomTag';
}
}

&#{$self}--outline {
&#{$self}--design-outline {
border-color: $c-atom-tag-actionable-invert;
color: $c-atom-tag-actionable-invert;
fill: $c-atom-tag-actionable-invert;
Expand All @@ -133,70 +135,108 @@ $base-class: '.sui-AtomTag';
}
}

&-small {
height: $h-atom-tag-s;
padding: $p-atom-tag-s;
&.sui-AtomTag-hasIcon.sui-AtomTag-hasClose {
padding: map-get($p-atom-tag-hasIcon-hasClose, 'small');
}
&--size {
&-small {
border-radius: ceil($h-atom-tag-s * 0.5);
height: $h-atom-tag-s;
padding: $p-atom-tag-s;
&.sui-AtomTag-hasIcon.sui-AtomTag-hasClose {
padding: map-get($p-atom-tag-hasIcon-hasClose, 'small');
}

& .sui-AtomTag-label {
line-height: $h-atom-tag-s;
}
& .sui-AtomTag-label {
line-height: $h-atom-tag-s;
}

.sui-AtomTag-closeable {
@include icon-secondary-clickable-area($h-atom-tag-s);
.sui-AtomTag-closeable {
@include icon-secondary-clickable-area($h-atom-tag-s);
}
}

.sui-AtomTag-icon {
margin-left: 0;
}
&-medium {
height: $h-atom-tag-m;
padding: $p-atom-tag-m;
border-radius: ceil($h-atom-tag-m * 0.5);
&.sui-AtomTag-hasIcon.sui-AtomTag-hasClose {
padding: map-get($p-atom-tag-hasIcon-hasClose, 'medium');
}

& .sui-AtomTag-label {
line-height: $h-atom-tag-m;
}

.sui-AtomTag-secondary-icon {
margin-right: 0;
.sui-AtomTag-closeable {
@include icon-secondary-clickable-area($h-atom-tag-m);
}
}
}

&-medium {
&.sui-AtomTag-hasIcon.sui-AtomTag-hasClose {
padding: map-get($p-atom-tag-hasIcon-hasClose, 'medium');
&-large {
border-radius: ceil($h-atom-tag-l * 0.5);
height: $h-atom-tag-l;
padding: $p-atom-tag-l;
&.sui-AtomTag-hasIcon.sui-AtomTag-hasClose {
padding: map-get($p-atom-tag-hasIcon-hasClose, 'large');
}

& .sui-AtomTag-label {
line-height: $h-atom-tag-l;
}

.sui-AtomTag-closeable {
@include icon-secondary-clickable-area($h-atom-tag-l);
}
}
}

&-large {
&--responsive {
border-radius: ceil($h-atom-tag-l * 0.5);
height: $h-atom-tag-l;
padding: $p-atom-tag-l;
&.sui-AtomTag-hasIcon.sui-AtomTag-hasClose {
padding: map-get($p-atom-tag-hasIcon-hasClose, 'large');
}

& .sui-AtomTag-label {
line-height: $h-atom-tag-l;
}

.sui-AtomTag-closeable {
@include icon-secondary-clickable-area($h-atom-tag-l);
}
}

&--responsive {
@include media-breakpoint-down(s) {
border-radius: ceil($h-atom-tag-l * 0.5);
height: $h-atom-tag-l;
padding: $p-atom-tag-l;
@include media-breakpoint-up(s) {
&#{$self}--size {
&-small {
border-radius: ceil($h-atom-tag-s * 0.5);
height: $h-atom-tag-s;
padding: $p-atom-tag-s;
&.sui-AtomTag-hasIcon.sui-AtomTag-hasClose {
padding: map-get($p-atom-tag-hasIcon-hasClose, 'small');
}

& .sui-AtomTag-label {
line-height: $h-atom-tag-l;
}
& .sui-AtomTag-label {
line-height: $h-atom-tag-s;
}

.sui-AtomTag-closeable {
@include icon-secondary-clickable-area($h-atom-tag-l);
.sui-AtomTag-closeable {
@include icon-secondary-clickable-area($h-atom-tag-s);
}
}
&-medium {
height: $h-atom-tag-m;
padding: $p-atom-tag-m;
&.sui-AtomTag-hasIcon.sui-AtomTag-hasClose {
padding: map-get($p-atom-tag-hasIcon-hasClose, 'medium');
}

& .sui-AtomTag-label {
line-height: $h-atom-tag-m;
}

.sui-AtomTag-closeable {
@include icon-secondary-clickable-area($h-atom-tag-m);
}
}
}
}
}

&--outline {
&--design-outline {
background-color: $bgc-atom-tag-outline;
border: $bdw-atom-tag-outline solid $bc-atom-tag-outline;
}
Expand Down

0 comments on commit a7a43ef

Please sign in to comment.