UX: allows dropdown-select-box to display a caret (#9803)
``` selectKitOptions: { showCaret: true // default false } ```
This commit is contained in:
parent
e5dc843185
commit
320b21ab5b
|
@ -8,7 +8,10 @@ export default SingleSelectComponent.extend({
|
|||
autoFilterable: false,
|
||||
filterable: false,
|
||||
showFullTitle: true,
|
||||
headerComponent: "dropdown-select-box/dropdown-select-box-header"
|
||||
headerComponent: "dropdown-select-box/dropdown-select-box-header",
|
||||
caretUpIcon: "caret-up",
|
||||
caretDownIcon: "caret-down",
|
||||
showCaret: false
|
||||
},
|
||||
|
||||
modifyComponentForRow() {
|
||||
|
|
|
@ -14,5 +14,18 @@ export default SingleSelectHeaderComponent.extend({
|
|||
|
||||
btnClassName: computed("showFullTitle", function() {
|
||||
return `btn ${this.showFullTitle ? "btn-icon-text" : "no-text btn-icon"}`;
|
||||
})
|
||||
}),
|
||||
|
||||
caretUpIcon: readOnly("selectKit.options.caretUpIcon"),
|
||||
|
||||
caretDownIcon: readOnly("selectKit.options.caretDownIcon"),
|
||||
|
||||
caretIcon: computed(
|
||||
"selectKit.isExpanded",
|
||||
"caretUpIcon",
|
||||
"caretDownIcon",
|
||||
function() {
|
||||
return this.selectKit.isExpanded ? this.caretUpIcon : this.caretDownIcon;
|
||||
}
|
||||
)
|
||||
});
|
||||
|
|
|
@ -13,7 +13,8 @@ export default DropdownSelectBoxComponent.extend({
|
|||
autoFilterable: false,
|
||||
filterable: false,
|
||||
i18nPrefix: "",
|
||||
i18nPostfix: ""
|
||||
i18nPostfix: "",
|
||||
showCaret: true
|
||||
},
|
||||
|
||||
modifyComponentForRow() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import I18n from "I18n";
|
||||
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { computed, action } from "@ember/object";
|
||||
|
||||
const UNPINNED = "unpinned";
|
||||
|
@ -17,7 +16,7 @@ export default DropdownSelectBoxComponent.extend({
|
|||
const state = pinned ? `pinned${globally}` : UNPINNED;
|
||||
const title = I18n.t(`topic_statuses.${state}.title`);
|
||||
|
||||
content.label = `<span>${title}</span>${iconHTML("caret-down")}`.htmlSafe();
|
||||
content.label = `<span>${title}</span>`.htmlSafe();
|
||||
content.title = title;
|
||||
content.name = state;
|
||||
content.icon = `thumbtack${state === UNPINNED ? " unpinned" : ""}`;
|
||||
|
|
|
@ -6,3 +6,5 @@
|
|||
selectKit=selectKit
|
||||
shouldDisplayClearableButton=shouldDisplayClearableButton
|
||||
}}
|
||||
|
||||
{{d-icon caretIcon class="caret-icon"}}
|
||||
|
|
|
@ -106,6 +106,7 @@
|
|||
|
||||
.caret-icon {
|
||||
margin-left: auto;
|
||||
margin-right: 0;
|
||||
padding-left: 5px;
|
||||
pointer-events: none;
|
||||
color: inherit;
|
||||
|
|
Loading…
Reference in New Issue