Skip to content

Commit 6dceab1

Browse files
committed
refactor: styles Centralize link styling and remove redundancy
1 parent 1106a7f commit 6dceab1

File tree

4 files changed

+25
-56
lines changed

4 files changed

+25
-56
lines changed

assets/scss/_mixins.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
text-decoration-line: underline !important;
33
text-decoration-thickness: 0.115em !important;
44
text-underline-offset: 2.6px !important;
5-
transition: text-decoration-color 0.3s ease-in-out;
5+
transition: text-decoration-color 0.3s ease-in-out, color 0.3s ease-in-out;
66
text-decoration-color: $base-color !important;
77

88
&:hover {

assets/scss/_typography-custom.scss

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// assets/scss/_typography-custom.scss
22

3+
// Define link colors as variables
4+
$link-underline-color: #d7c7e3;
5+
$link-underline-hover-color: #200435;
6+
$dark-link-underline-color: #288b8c;
7+
$dark-link-underline-hover-color: #bcfbff;
8+
39
// Gradient text class
410
.gradient-text {
511
background: linear-gradient(135deg, var(--color-primary-new) 0%, var(--color-secondary-new) 100%);
@@ -111,15 +117,23 @@ a {
111117
overflow-wrap: break-word;
112118
}
113119

120+
// REFACTORED: Centralized Link Styling
114121
.styled-link,
115122
.content :is(:where(a):not(:where([class~="not-prose"], [class~="not-prose"] *, .btn))),
116-
section a:not(.breadcrumb-link-parent, .social-link-container, .btn, .hardware-card-wide-link, .social-icon) {
123+
section a:not(.breadcrumb-link-parent, .social-link-container, .btn, .hardware-card-wide-link, .social-icon, .no-style),
124+
section a.social-link-container .social-link-text,
125+
.breadcrumb-link-text,
126+
.author-card-compact h4 a,
127+
.hardware-card-wide-link h3 {
117128
font-weight: inherit;
118129
color: inherit !important;
119-
@include styled-link(#d7c7e3, #200435, #288b8c, #bcfbff);
120-
&.social-link-container { text-decoration-line: none !important; }
130+
@include styled-link($link-underline-color, $link-underline-hover-color, $dark-link-underline-color, $dark-link-underline-hover-color);
121131
}
122132

133+
// Container for hardware card link, which contains the h3 we want styled
134+
.hardware-card-wide-link {
135+
text-decoration: none !important;
136+
}
123137

124138
h1 a, h2 a, h3 a, h4 a, h5 a {
125139
text-decoration: none !important;
@@ -135,19 +149,6 @@ h1 a, h2 a, h3 a, h4 a, h5 a {
135149
color: #FFF;
136150
}
137151

138-
.dark .content :is(:where(a):not(:where([class~="not-prose"], [class~="btn"], [class~="not-prose"] *))),
139-
.dark section a:not(.breadcrumb-link-parent, .social-link-container, .btn, .hardware-card-wide-link, .social-icon) {
140-
color: inherit !important;
141-
}
142-
143-
// --- Social Link Text (within a container) ---
144-
section a.social-link-container .social-link-text {
145-
@include styled-link(#d7c7e3, #200435, #288b8c, #bcfbff);
146-
}
147-
.dark section a.social-link-container {
148-
color: #bcfbff !important;
149-
}
150-
151152
h1 a, h2 a, h3 a, h4 a, h5 a {
152153
color: #ffffff !important;
153154
}
@@ -163,14 +164,9 @@ section a.social-link-container .social-link-text {
163164
color: #000 !important;
164165
}
165166

166-
// --- Author Card Compact Links ---
167-
.author-card-compact h4 a {
168-
@include styled-link(#d7c7e3, #200435, #288b8c, #bcfbff);
169-
color: #200435 !important;
170-
.dark & {
171-
color: #bcfbff !important;
167+
.author-card-compact h4 a {
168+
color: #bcfbff !important;
172169
}
173-
}
174170

175171
.role-compact {
176172
@apply text-sm text-text dark:text-darkmode-text mt-1;
@@ -196,9 +192,6 @@ section a.social-link-container .social-link-text {
196192
a.breadcrumb-link-parent {
197193
text-decoration-line: none !important;
198194
}
199-
.breadcrumb-link-text {
200-
@include styled-link(#d7c7e3, #200435, #288b8c, #bcfbff);
201-
}
202195

203196
.image-attribution-caption {
204197
// Positioning for the container div
Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,8 @@
11
// Breadcrumb specific styling
2-
// Remove underline from the <a> tag itself in breadcrumbs
2+
// This file can now be simplified as the core styling is handled by the main stylesheet.
3+
// We just need to ensure the parent <a> doesn't get an underline itself.
34
a.breadcrumb-link-parent {
4-
text-decoration-line: none !important; // Remove general underline from the <a> container
5+
text-decoration-line: none !important;
56
}
67

7-
// Apply underline only to the inner span
8-
.breadcrumb-link-text {
9-
text-decoration-line: underline;
10-
text-decoration-color: #d7c7e3; // Match general link style
11-
text-decoration-thickness: 0.115em; // Match general link style
12-
text-underline-offset: 2.6px; // Match general link style
13-
transition: text-decoration-color 0.3s ease-in-out;
14-
}
15-
16-
// Hover effect for the inner span, triggered by hovering the parent <a>
17-
a.breadcrumb-link-parent:hover .breadcrumb-link-text {
18-
text-decoration-color: #200435; // Match general link hover style
19-
}
20-
21-
// Dark mode for breadcrumb link text span
22-
.dark .breadcrumb-link-text {
23-
text-decoration-color: #288b8c; // Match dark mode general link style
24-
}
25-
26-
.dark a.breadcrumb-link-parent:hover .breadcrumb-link-text {
27-
text-decoration-color: #bcfbff !important; // Match dark mode general link hover style
28-
}
29-
// End of Breadcrumb specific styling
8+
// The .breadcrumb-link-text will be automatically styled by the rules in _typography-custom.scss

assets/scss/components/_hardware-card-wide.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,5 @@
1111
@apply transform shadow-lg;
1212
}
1313

14-
// Target the h3 title specifically and apply the consistent link styling.
15-
h3 {
16-
@include styled-link(#d7c7e3, #200435, #288b8c, #bcfbff);
17-
}
14+
// The h3 title inside will be styled automatically by the rules in _typography-custom.scss
1815
}

0 commit comments

Comments
 (0)