Skip to content

Commit

Permalink
refactor(tile-select): simplify pointer enter/leave handlers (#6778)
Browse files Browse the repository at this point in the history
**Related Issue:** N/A

## Summary

✨🧹✨
  • Loading branch information
jcfranco authored Apr 13, 2023
1 parent 948146e commit 40bb711
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/components/tile-select/tile-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,19 @@ export class TileSelect implements InteractiveComponent, LoadableComponent {

@Listen("pointerenter")
pointerEnterHandler(): void {
if (this.input.localName === "calcite-radio-button") {
(this.input as HTMLCalciteRadioButtonElement).hovered = true;
}
if (this.input.localName === "calcite-checkbox") {
(this.input as HTMLCalciteCheckboxElement).hovered = true;
const { localName } = this.input;

if (localName === "calcite-radio-button" || localName === "calcite-checkbox") {
(this.input as HTMLCalciteRadioButtonElement | HTMLCalciteCheckboxElement).hovered = true;
}
}

@Listen("pointerleave")
pointerLeaveHandler(): void {
if (this.input.localName === "calcite-radio-button") {
(this.input as HTMLCalciteRadioButtonElement).hovered = false;
}
if (this.input.localName === "calcite-checkbox") {
(this.input as HTMLCalciteCheckboxElement).hovered = false;
const { localName } = this.input;

if (localName === "calcite-radio-button" || localName === "calcite-checkbox") {
(this.input as HTMLCalciteRadioButtonElement | HTMLCalciteCheckboxElement).hovered = false;
}
}

Expand Down

0 comments on commit 40bb711

Please sign in to comment.