Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(component/flag): improve long text flag behaviour (#995)
- Loading branch information
Showing
14 changed files
with
121 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
/* mqp:start */ | ||
.mc-flag { | ||
@include set-flag-base(); | ||
@include set-font-face('semi-bold'); | ||
@include set-font-scale('04', 's'); | ||
@include set-flag-theme(get-token(color, flag, 'solid')); | ||
$parent: get-parent-selector(&); | ||
|
||
@include set-flag-base($parent); | ||
@include set-font-face("semi-bold"); | ||
@include set-flag-theme($parent, get-token(color, flag, "solid")); | ||
|
||
@each $name, $props in $flags { | ||
@if ($name != 'solid') { | ||
@if ($name != "solid") { | ||
&--#{$name} { | ||
@include set-flag-theme($props); | ||
@include set-flag-theme($parent, $props); | ||
} | ||
} | ||
} | ||
|
||
&--extend { | ||
flex-shrink: 1; | ||
height: auto; | ||
} | ||
} | ||
|
||
/* mqp:end */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
$flags: get-token(color, flag); | ||
|
||
$flag-border: get-border('s'); | ||
$flag-border: get-border("s"); | ||
|
||
@mixin set-flag-base { | ||
border: $flag-border solid transparent; | ||
display: inline-flex; | ||
align-items: center; | ||
padding: 0 $mu050; | ||
@mixin set-flag-base($parent) { | ||
display: inline-block; | ||
font-size: get-token(size, font, "04"); | ||
margin: 0; | ||
vertical-align: middle; | ||
min-height: 1.375rem; | ||
flex-shrink: 0; | ||
// custom line-height to ensure the multi-line behaviour is done in the right conditions | ||
line-height: 1.786; | ||
|
||
/* ie11 hack to center vertically */ | ||
@at-root #{$parent}__label { | ||
@include set-line-height("04", "s"); | ||
|
||
/* see : https://github.com/philipwalton/flexbugs/issues/231 */ | ||
height: 0; | ||
border: $flag-border solid transparent; | ||
box-decoration-break: clone; | ||
padding: $mu025 $mu050; | ||
} | ||
} | ||
|
||
@mixin set-flag-theme($props) { | ||
color: map-get($props, 'text'); | ||
@mixin set-flag-theme($parent, $props) { | ||
#{$parent} { | ||
&__label { | ||
color: map-get($props, "text"); | ||
|
||
@if map-has-key($props, 'border') { | ||
border-color: map-get($props, 'border'); | ||
} | ||
@if map-has-key($props, "border") { | ||
border-color: map-get($props, "border"); | ||
} | ||
|
||
@if map-has-key($props, 'background') { | ||
background-color: map-get($props, 'background'); | ||
@if map-has-key($props, "background") { | ||
background-color: map-get($props, "background"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 17 additions & 17 deletions
34
...Flags/previews/flag-bordered.preview.html → ...ents/Flags/previews/bordered.preview.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
<div class="example"> | ||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--bordered">Flag bordered</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--bordered-dark">Flag bordered dark</div> | ||
</div> | ||
|
||
<div class="example__item example__item--light"> | ||
<div class="mc-flag mc-flag--bordered-light">Flag bordered light</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--bordered-danger">Flag bordered danger</div> | ||
</div> | ||
</div> | ||
<div class="example"> | ||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--bordered">Flag bordered</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--bordered-dark">Flag bordered dark</div> | ||
</div> | ||
|
||
<div class="example__item example__item--light"> | ||
<div class="mc-flag mc-flag--bordered-light">Flag bordered light</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--bordered-danger">Flag bordered danger</div> | ||
</div> | ||
</div> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="example"> | ||
<div class="example__item"> | ||
<div class="mc-flag"> | ||
<span class="mc-flag__label">Flag label</span> | ||
</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--bordered"> | ||
<span class="mc-flag__label">This is a flag with a very long label</span> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@import "settings-tools/_all-settings"; | ||
|
||
@include import-font-families(); | ||
|
||
@import "components/_c.flag"; | ||
|
||
.example { | ||
margin: $mu100 auto; | ||
padding: 0 $mu150; | ||
|
||
&__item { | ||
margin: $mu100; | ||
max-width: $mu1000; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
<div class="example"> | ||
<div class="example__item"> | ||
<div class="mc-flag">Flag solid</div> | ||
|
||
<div class="mc-flag mc-flag--bordered">Flag bordered</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--solid-dark">Flag solid dark</div> | ||
|
||
<div class="mc-flag mc-flag--bordered-dark">Flag bordered dark</div> | ||
</div> | ||
|
||
<div class="example__item example__item--light"> | ||
<div class="mc-flag mc-flag--solid-light">Flag solid light</div> | ||
|
||
<div class="mc-flag mc-flag--bordered-light">Flag bordered light</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--solid-danger">Flag solid danger</div> | ||
|
||
<div class="mc-flag mc-flag--bordered-danger">Flag bordered danger</div> | ||
</div> | ||
</div> | ||
<div class="example"> | ||
<div class="example__item"> | ||
<div class="mc-flag">Flag solid</div> | ||
|
||
<div class="mc-flag mc-flag--bordered">Flag bordered</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--solid-dark">Flag solid dark</div> | ||
|
||
<div class="mc-flag mc-flag--bordered-dark">Flag bordered dark</div> | ||
</div> | ||
|
||
<div class="example__item example__item--light"> | ||
<div class="mc-flag mc-flag--solid-light">Flag solid light</div> | ||
|
||
<div class="mc-flag mc-flag--bordered-light">Flag bordered light</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--solid-danger">Flag solid danger</div> | ||
|
||
<div class="mc-flag mc-flag--bordered-danger">Flag bordered danger</div> | ||
</div> | ||
</div> |
11 changes: 0 additions & 11 deletions
11
src/docs/Components/Flags/previews/flag-basic.preview.html
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/docs/Components/Flags/previews/flag-basic.preview.scss
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
34 changes: 17 additions & 17 deletions
34
...ts/Flags/previews/flag-solid.preview.html → ...ponents/Flags/previews/solid.preview.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
<div class="example"> | ||
<div class="example__item"> | ||
<div class="mc-flag">Flag solid</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--solid-dark">Flag solid dark</div> | ||
</div> | ||
|
||
<div class="example__item example__item--light"> | ||
<div class="mc-flag mc-flag--solid-light">Flag solid light</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--solid-danger">Flag solid danger</div> | ||
</div> | ||
</div> | ||
<div class="example"> | ||
<div class="example__item"> | ||
<div class="mc-flag">Flag solid</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--solid-dark">Flag solid dark</div> | ||
</div> | ||
|
||
<div class="example__item example__item--light"> | ||
<div class="mc-flag mc-flag--solid-light">Flag solid light</div> | ||
</div> | ||
|
||
<div class="example__item"> | ||
<div class="mc-flag mc-flag--solid-danger">Flag solid danger</div> | ||
</div> | ||
</div> |
File renamed without changes.