-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: class syntax and tagless all the way
- Loading branch information
1 parent
609a0e1
commit f893b07
Showing
7 changed files
with
1,685 additions
and
443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,33 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import { tagName, layout as templateLayout } from '@ember-decorators/component'; | ||
import { action, computed } from '@ember/object'; | ||
import { readOnly } from '@ember/object/computed'; | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import layout from './template'; | ||
|
||
export default Component.extend({ | ||
layout, | ||
tagName: '', | ||
for: readOnly('switchId'), | ||
@classic | ||
@templateLayout(layout) | ||
@tagName('') | ||
export default class XToggleLabel extends Component { | ||
@readOnly('switchId') | ||
for; | ||
|
||
labelType: computed('type', function () { | ||
@computed('type') | ||
get labelType() { | ||
let type = this.type; | ||
|
||
return `${type}-label`; | ||
}), | ||
} | ||
|
||
type: computed('value', { | ||
get() { | ||
return this.value ? 'on' : 'off'; | ||
}, | ||
}), | ||
@computed('value') | ||
get type() { | ||
return this.value ? 'on' : 'off'; | ||
} | ||
|
||
actions: { | ||
clickLabel(e) { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
this.sendToggle(this.value); | ||
}, | ||
}, | ||
}); | ||
@action | ||
clickLabel(e) { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
this.sendToggle(this.value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.