Skip to content

Commit a0f82ab

Browse files
committed
Add link external to target _blank
1 parent 1f0637e commit a0f82ab

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

src/scss/02-tools/_m-text-icon.scss

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Add icon before text with mask to have the same color of the text
3+
*
4+
* @author Cédric Andrietti
5+
*
6+
* @param $icon
7+
*
8+
* Examples :
9+
*
10+
* .my-element {
11+
* @include text-icon('search');
12+
* }
13+
*
14+
*/
15+
16+
@mixin text-icon($icon: "arrow", $position: after, $color: currentColor, $size: 12px) {
17+
position: relative;
18+
display: inline-flex;
19+
gap: 8px;
20+
align-items: center;
21+
22+
&::#{$position} {
23+
display: block;
24+
width: $size;
25+
height: $size;
26+
content: "";
27+
background-color: $color;
28+
mask-image: get-svg-url($icon);
29+
mask-position: center;
30+
mask-repeat: no-repeat;
31+
transition: background-color .5s $ease-out-expo;
32+
}
33+
}

src/scss/02-tools/tools.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@
3737
@import "./m-not-acf";
3838
@import "./m-rtl";
3939
@import "./m-text";
40+
@import "./m-text-icon";

src/scss/03-base/_links.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ a {
33
text-decoration: underline;
44
cursor: pointer;
55

6+
&[target="_blank"] {
7+
@include text-icon("external");
8+
}
9+
610
@include hover {
711
text-decoration: none;
812
}
913
}
14+
15+
.link-external {
16+
@include text-icon("external");
17+
}

0 commit comments

Comments
 (0)