-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy path_m-text-icon.scss
More file actions
46 lines (41 loc) · 1.06 KB
/
_m-text-icon.scss
File metadata and controls
46 lines (41 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
@use "../01-abstract/constants" as *;
@use "f-get-svg-url" as *;
/**
* 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, $gap: 8px) {
position: relative;
display: inline-flex;
gap: $gap;
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;
}
}
@mixin text-external-icon($icon: "external", $position: after, $color: currentColor, $size: 12px, $gap: 8px) {
@include text-icon($icon, $position, $color, $size);
display: inline-block;
&::#{$position} {
display: inline-block;
margin-inline-start: $gap;
}
}