1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 23:03:32 +00:00

[Component Library] Text/Button Links (#3126)

* Initial commit

* Updated stories / Fixed issues with dark theme constrast color

* Force colors so bootstrap doesn't override

* Fixed text colors / Added initial tests

* Added jest debugging ability to components package

* Removed spec file

* Fixed anchor layout

* revert base font-size

* [CL-28] fixed indentation, used focus-visible, adjusted disabled colors

* [CL-28] Reduced ring thickness to better match figma

* [CL-28] Updated story link

* [CL-44] [CL-28] Updated tabs disabled color / Converted to rgb format with helper
This commit is contained in:
Vincent Salucci
2022-08-08 11:21:46 -05:00
committed by GitHub
parent af371af6e1
commit 07c7357825
11 changed files with 280 additions and 80 deletions

View File

@@ -0,0 +1,54 @@
import { Input, HostBinding, Directive } from "@angular/core";
export type LinkType = "primary" | "secondary" | "contrast";
const linkStyles: Record<LinkType, string[]> = {
primary: [
"!tw-text-primary-500",
"hover:!tw-text-primary-500",
"focus-visible:tw-ring-primary-700",
"disabled:!tw-text-primary-500/60",
],
secondary: [
"!tw-text-main",
"hover:!tw-text-main",
"focus-visible:tw-ring-primary-700",
"disabled:!tw-text-muted/60",
],
contrast: [
"!tw-text-contrast",
"hover:!tw-text-contrast",
"focus-visible:tw-ring-text-contrast",
"disabled:!tw-text-contrast/60",
],
};
@Directive({
selector: "button[bitLink], a[bitLink]",
})
export class LinkDirective {
@HostBinding("class") get classList() {
return [
"tw-font-semibold",
"tw-py-0.5",
"tw-px-0",
"tw-bg-transparent",
"tw-border-0",
"tw-border-none",
"tw-rounded",
"tw-transition",
"hover:tw-underline",
"hover:tw-decoration-1",
"focus-visible:tw-outline-none",
"focus-visible:tw-underline",
"focus-visible:tw-decoration-1",
"focus-visible:tw-ring-2",
"focus-visible:tw-z-10",
"disabled:tw-no-underline",
"disabled:tw-cursor-not-allowed",
].concat(linkStyles[this.linkType] ?? []);
}
@Input()
linkType: LinkType = "primary";
}