mirror of
https://github.com/discourse/discourse.git
synced 2024-12-23 06:16:07 +08:00
d1cc60c435
Changes made using the ember-native-class-codemod, plus some manual tweaks
33 lines
846 B
JavaScript
33 lines
846 B
JavaScript
import { computed } from "@ember/object";
|
|
import { classNames } from "@ember-decorators/component";
|
|
import ComboBoxComponent from "select-kit/components/combo-box";
|
|
import {
|
|
pluginApiIdentifiers,
|
|
selectKitOptions,
|
|
} from "select-kit/components/select-kit";
|
|
|
|
@classNames("flair-chooser")
|
|
@selectKitOptions({
|
|
selectedNameComponent: "selected-flair",
|
|
})
|
|
@pluginApiIdentifiers(["flair-chooser"])
|
|
export default class FlairChooser extends ComboBoxComponent {
|
|
modifyComponentForRow() {
|
|
return "flair-row";
|
|
}
|
|
|
|
@computed("value", "content.[]", "selectKit.noneItem")
|
|
get selectedContent() {
|
|
const content = (this.content || []).findBy(
|
|
this.selectKit.valueProperty,
|
|
this.value
|
|
);
|
|
|
|
if (content) {
|
|
return this.selectKit.modifySelection(content);
|
|
} else {
|
|
return this.selectKit.noneItem;
|
|
}
|
|
}
|
|
}
|