Skip to content

Commit 6b2afa4

Browse files
author
Juan Andrade
committed
[rm-wb-link-secondary] Simplify variables inside styles
1 parent 432f192 commit 6b2afa4

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

packages/wonder-blocks-link/src/components/link-core.tsx

+12-17
Original file line numberDiff line numberDiff line change
@@ -188,23 +188,18 @@ const _generateStyles = (
188188
const fadedBlue = color.fadedBlue;
189189
// Light pink
190190
const activeLightVisited = mix(fade(white, 0.32), pink);
191-
// Dark blue
192-
const activeDefaultPrimary = color.activeBlue;
193191

194-
const primaryDefaultTextColor = light ? white : blue;
195-
const defaultTextColor = primaryDefaultTextColor;
192+
const restTextColor = light ? white : blue;
193+
const pressTextColor = light ? fadedBlue : color.activeBlue;
196194

197-
const primaryActiveColor = light ? fadedBlue : activeDefaultPrimary;
198-
const activeColor = primaryActiveColor;
199-
200-
const defaultVisited = visitable
195+
const restVisited = visitable
201196
? {
202197
":visited": {
203198
color: light ? pink : linkPurple,
204199
},
205200
}
206201
: Object.freeze({});
207-
const activeVisited = visitable
202+
const pressVisited = visitable
208203
? {
209204
":visited": {
210205
color: light
@@ -215,35 +210,35 @@ const _generateStyles = (
215210
: Object.freeze({});
216211

217212
const focusStyling = {
218-
color: defaultTextColor,
213+
color: restTextColor,
219214
outline: `1px solid ${light ? white : blue}`,
220215
borderRadius: 3,
221-
...defaultVisited,
216+
...restVisited,
222217
};
223218

224219
const pressStyling = {
225-
color: activeColor,
220+
color: pressTextColor,
226221
textDecoration: "underline currentcolor solid",
227222
// TODO(WB-1521): Update the underline offset to be 4px after
228223
// the Link audit.
229224
// textUnderlineOffset: 4,
230-
...activeVisited,
225+
...pressVisited,
231226
};
232227

233228
const newStyles: StyleDeclaration = {
234229
rest: {
235-
color: defaultTextColor,
236-
...defaultVisited,
230+
color: restTextColor,
231+
...restVisited,
237232
":hover": {
238233
// TODO(WB-1521): Update text decoration to the 1px dashed
239234
// underline after the Link audit.
240235
// textDecoration: "underline currentcolor dashed 2px",
241236
textDecoration: "underline currentcolor solid",
242-
color: defaultTextColor,
237+
color: restTextColor,
243238
// TODO(WB-1521): Update the underline offset to be 4px after
244239
// the Link audit.
245240
// textUnderlineOffset: 4,
246-
...defaultVisited,
241+
...restVisited,
247242
},
248243
// Focus styles only show up with keyboard navigation.
249244
// Mouse users don't see focus styles.

0 commit comments

Comments
 (0)