Skip to content

Commit

Permalink
Bulletproofs button component
Browse files Browse the repository at this point in the history
- fixes hover styles
- fixes font inheritance and antialiasing
- replicates aria roles onto button element
  • Loading branch information
d13 committed Dec 2, 2024
1 parent 457e86e commit cb71cee
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/webviews/apps/shared/components/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class GlButton extends LitElement {
cursor: pointer;
border: 1px solid var(--button-border);
border-radius: var(--gk-action-radius, 0.3rem);
-webkit-font-smoothing: auto;
}
.control {
Expand All @@ -59,6 +60,7 @@ export class GlButton extends LitElement {
gap: var(--button-gap);
padding: var(--button-padding);
line-height: var(--button-line-height);
font-family: inherit;
color: inherit;
text-decoration: none;
Expand Down Expand Up @@ -160,7 +162,7 @@ export class GlButton extends LitElement {
--code-icon-v-align: unset;
}
:host(:hover:not([disabled]):not([aria-checked='true'])) {
:host([aria-checked]:hover:not([disabled]):not([aria-checked='true'])) {
background-color: var(--vscode-inputOption-hoverBackground);
}
Expand Down Expand Up @@ -254,7 +256,12 @@ export class GlButton extends LitElement {
><slot name="prefix"></slot><slot class="label"></slot><slot name="suffix"></slot
></a>`;
}
return html`<button class="control" ?disabled=${this.disabled}>
return html`<button
class="control"
role=${ifDefined(this.role)}
aria-checked=${ifDefined(this.ariaChecked)}
?disabled=${this.disabled}
>
<slot name="prefix"></slot><slot class="label"></slot><slot name="suffix"></slot>
</button>`;
}
Expand Down

0 comments on commit cb71cee

Please sign in to comment.