UNPKG

4.13 kBSCSSView Raw
1@use '../internal' as *;
2
3$generate-utility: should-generate-classes($LINKS-EXT);
4
5@if $generate-utility {
6 /* EXTENDED LINKS */
7 /* Animated links */
8 .u,
9 .utb {
10 display: inline;
11 position: relative; /* So the psuedo-elements are positioned correctly */
12 }
13
14 /* Underline */
15 .u {
16 &::after {
17 content: '';
18 transition: all 0.3s;
19 backface-visibility: hidden;
20 position: absolute;
21 height: 2px;
22 width: 0;
23 background: $cirrus-link-dark;
24 bottom: -0.25em;
25 }
26
27 &:hover::after {
28 width: 100%;
29 }
30
31 &.u-LR::after {
32 /* Left to Right */
33 left: 0;
34 }
35
36 &.u-LR::after {
37 /* Left to Right */
38 left: 0;
39 }
40
41 &.u-RL::after {
42 /* Right to Left */
43 right: 0;
44 }
45
46 &.u-RL:hover::after {
47 width: 100%;
48 }
49
50 &.u-C::after {
51 /* Center Outwards */
52 left: 50%;
53 transform: translateX(-50%);
54 }
55 }
56
57 /* Underline top and bottom */
58 .utb {
59 &::before,
60 &::after {
61 content: '';
62 transition: all 0.3s;
63 backface-visibility: hidden;
64 position: absolute;
65 height: 2px;
66 width: 0;
67 background: $cirrus-link-dark;
68 }
69
70 &::before {
71 top: -0.25em;
72 }
73
74 &::after {
75 bottom: -0.25em;
76 }
77
78 &:hover::before,
79 &:hover::after {
80 width: 100%;
81 }
82
83 &.utb-LR::before,
84 &.utb-LR::after {
85 left: 0;
86 }
87
88 &.utb-RL::before,
89 &.utb-RL::after {
90 right: 0;
91 }
92
93 &.utb-C::before,
94 &.utb-C::after {
95 left: 50%;
96 transform: translateX(-50%);
97 }
98
99 /* Opposite start */
100 &.utb-OLR::before {
101 /* Suffix denotes border transition direction for the top border (left to right). Bottom border will be the opposite direction */
102 left: 0;
103 }
104
105 &.utb-OLR::after {
106 right: 0;
107 }
108
109 &.utb-ORL::before {
110 right: 0;
111 }
112
113 &.utb-ORL::after {
114 left: 0;
115 }
116 }
117
118 /* Links with square borders */
119
120 /* Please note that usquare is the parent span (not div) which would create the left and right borders. The link (.utb-OLR) gets nested within this */
121
122 .usquare {
123 margin-left: 0.4rem;
124 position: relative;
125 overflow: hidden;
126
127 &::before,
128 &::after {
129 content: '';
130 transition: 0.25s all ease;
131 backface-visibility: hidden;
132 position: absolute;
133 width: 2px;
134 width: 0.1 rem;
135 height: 0;
136 background: $cirrus-link-dark;
137 }
138
139 &::before {
140 left: 0;
141 bottom: -0.2rem;
142 }
143
144 &::after {
145 right: 0;
146 top: -0.2rem;
147 }
148
149 &:hover {
150 &::before,
151 &::after {
152 height: calc(100% + 0.4rem); /* Makes the left and right borders */
153 }
154
155 a::before,
156 a::after {
157 width: 100%;
158 }
159 }
160
161 &.delay {
162 &::before {
163 transition-delay: 0.6s;
164 }
165
166 &::after {
167 transition-delay: var(--animation-duration);
168 }
169
170 a::after {
171 transition: 0.25s all ease 0.4s;
172 }
173 }
174
175 a {
176 position: static;
177 padding: 0.2rem 0.4rem;
178 transition: 0.25s all ease;
179
180 &::before {
181 left: 0;
182 }
183
184 &::after {
185 right: 0;
186 }
187 }
188 }
189}