Skip to content

Commit

Permalink
feat: Implement toggle component adhering to Material Design with ani…
Browse files Browse the repository at this point in the history
…mated switch and external event listeners

fix devhatt#71
  • Loading branch information
nathalia-84 committed Feb 17, 2024
1 parent 2e04ced commit 87f8ec0
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/components/Toggle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,13 @@ export default function Toggle() {
});
}

Toggle.prototype = Object.assign(
Toggle.prototype,
Component.prototype,
{
isChecked() {
this.selected.get('toggle-label').classList.add('checked');
this.emit('active');
},
notChecked() {
this.selected.get('toggle-label').classList.remove('checked');
this.emit('inactive');
},
Toggle.prototype = Object.assign(Toggle.prototype, Component.prototype, {
isChecked() {
this.selected.get('toggle-label').classList.add('checked');
this.emit('active');
},
);
notChecked() {
this.selected.get('toggle-label').classList.remove('checked');
this.emit('inactive');
},
});

0 comments on commit 87f8ec0

Please sign in to comment.