Skip to content

Commit

Permalink
chore: link light mode
Browse files Browse the repository at this point in the history
Adds light mode support to Link component, using color defined in design for
containers#7149.

Fixes containers#7215.

Signed-off-by: Tim deBoer <git@tdeboer.ca>
  • Loading branch information
deboer-tim committed May 14, 2024
1 parent ffe8c28 commit 644a4d4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
15 changes: 15 additions & 0 deletions packages/main/src/plugin/color-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export class ColorRegistry {
this.initInvertContent();
this.initCardContent();
this.initInputBox();
this.initLink();
}

protected initGlobalNav(): void {
Expand Down Expand Up @@ -543,4 +544,18 @@ export class ColorRegistry {
light: colorPalette.gray[500],
});
}

// links
protected initLink(): void {
const sNav = 'link';

this.registerColor(`${sNav}`, {
dark: colorPalette.purple[400],
light: colorPalette.purple[700],
});
this.registerColor(`${sNav}-bg`, {
dark: colorPalette.white,
light: colorPalette.black,
});
}
}
6 changes: 3 additions & 3 deletions packages/renderer/src/lib/ui/Link.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (C) 2023 Red Hat, Inc.
* Copyright (C) 2023, 2024 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,8 +42,8 @@ test('Check link styling', async () => {
// check for one element of the styling
const link = screen.getByRole('link');
expect(link).toBeInTheDocument();
expect(link).toHaveClass('text-purple-400');
expect(link).toHaveClass('hover:bg-white');
expect(link).toHaveClass('text-[var(--pd-link)]');
expect(link).toHaveClass('hover:bg-[var(--pd-link-bg)]');
expect(link).toHaveClass('hover:bg-opacity-10');
expect(link).toHaveClass('cursor-pointer');
});
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer/src/lib/ui/Link.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function click(): void {
<!-- svelte-ignore a11y-no-redundant-roles -->
<!-- svelte-ignore a11y-interactive-supports-focus -->
<a
class="text-purple-400 hover:bg-white hover:bg-opacity-10 transition-all rounded-[4px] p-0.5 no-underline cursor-pointer {$$props.class ||
class="text-[var(--pd-link)] hover:bg-[var(--pd-link-bg)] hover:bg-opacity-10 transition-all rounded-[4px] p-0.5 no-underline cursor-pointer {$$props.class ||
''}"
on:click="{() => click()}"
role="link"
Expand Down

0 comments on commit 644a4d4

Please sign in to comment.