Skip to content

Commit

Permalink
* Update ft-icon-button to remove unused old API
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuEXE committed Oct 4, 2021
1 parent 9df139b commit 45ab43e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 28 deletions.
27 changes: 1 addition & 26 deletions src/renderer/components/ft-icon-button/ft-icon-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,16 @@ export default Vue.extend({
// - value: String (if type == 'labelValue')
type: Array,
default: () => { return [] }
},
dropdownNames: {
type: Array,
default: () => { return [] }
},
dropdownValues: {
type: Array,
default: () => { return [] }
},
dropdownConvertNullNamesToDividers: {
type: Boolean,
default: false
}
},
data: function () {
return {
dropdownShown: false,
dropdownOptionsWithFallback: [],
id: ''
}
},
mounted: function () {
this.id = `iconButton${this._uid}`

if (this.dropdownOptions.length > 0) {
this.dropdownOptionsWithFallback = this.dropdownOptions
} else if (this.dropdownOptions.length === 0 && this.dropdownNames.length > 0) {
// Backward compatibility
this.dropdownOptionsWithFallback = this.dropdownNames.map((dropdownName, index) => {
return {
label: dropdownName,
value: this.dropdownValues[index]
}
})
}
},
methods: {
toggleDropdown: function () {
Expand Down Expand Up @@ -128,7 +103,7 @@ export default Vue.extend({
},

handleIconClick: function () {
if (this.forceDropdown || (this.dropdownOptionsWithFallback.length > 0)) {
if (this.forceDropdown || (this.dropdownOptions.length > 0)) {
this.toggleDropdown()
} else {
this.$emit('click')
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/ft-icon-button/ft-icon-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
>
<slot>
<ul
v-if="dropdownOptionsWithFallback.length > 0"
v-if="dropdownOptions.length > 0"
class="list"
>
<li
v-for="(option, index) in dropdownOptionsWithFallback"
v-for="(option, index) in dropdownOptions"
:key="index"
:class="option.type === 'divider' ? 'listItemDivider' : 'listItem'"
@click="handleDropdownClick(option.value)"
Expand Down

0 comments on commit 45ab43e

Please sign in to comment.