Skip to content

Commit

Permalink
Add link external to target _blank
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric07 committed Oct 7, 2024
1 parent 1f0637e commit a0f82ab
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/scss/02-tools/_m-text-icon.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Add icon before text with mask to have the same color of the text
*
* @author Cédric Andrietti
*
* @param $icon
*
* Examples :
*
* .my-element {
* @include text-icon('search');
* }
*
*/

@mixin text-icon($icon: "arrow", $position: after, $color: currentColor, $size: 12px) {
position: relative;
display: inline-flex;
gap: 8px;
align-items: center;

&::#{$position} {
display: block;
width: $size;
height: $size;
content: "";
background-color: $color;
mask-image: get-svg-url($icon);
mask-position: center;
mask-repeat: no-repeat;
transition: background-color .5s $ease-out-expo;
}
}
1 change: 1 addition & 0 deletions src/scss/02-tools/tools.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
@import "./m-not-acf";
@import "./m-rtl";
@import "./m-text";
@import "./m-text-icon";
8 changes: 8 additions & 0 deletions src/scss/03-base/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ a {
text-decoration: underline;
cursor: pointer;

&[target="_blank"] {
@include text-icon("external");
}

@include hover {
text-decoration: none;
}
}

.link-external {
@include text-icon("external");
}

0 comments on commit a0f82ab

Please sign in to comment.