Skip to content

Commit

Permalink
Merge pull request #427 from BeAPI/feat/external-link
Browse files Browse the repository at this point in the history
Add link external to target _blank
  • Loading branch information
cedric07 authored Oct 7, 2024
2 parents 3f087d2 + a0f82ab commit 1dd64e1
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 @@ -38,3 +38,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 1dd64e1

Please sign in to comment.