Skip to content

Commit

Permalink
feat: remove hypescript usage
Browse files Browse the repository at this point in the history
  • Loading branch information
niconiahi committed Jan 22, 2024
1 parent 0cef5ba commit f00cbfa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/button/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ class Button extends HTMLButtonElement {
if (newValue === "toggle") {
const pressed = this.getAttribute("data-pressed")
this.setAttribute("aria-pressed", pressed ?? "false")
this.setAttribute("_", `
on click
if @aria-pressed equals 'true'
set @aria-pressed to 'false'
else
set @aria-pressed to 'true'
`)
this.addEventListener("click", () => {
const ariaPressed = this.getAttribute("aria-pressed") ?? "false"
if (ariaPressed === "true") {
this.setAttribute("aria-pressed", "false")
} else {
this.setAttribute("aria-pressed", "true")
}
})
}

// menu
Expand Down

0 comments on commit f00cbfa

Please sign in to comment.