mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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,
|
autoFilterable: false,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
showFullTitle: true,
|
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() {
|
modifyComponentForRow() {
|
||||||
|
@ -14,5 +14,18 @@ export default SingleSelectHeaderComponent.extend({
|
|||||||
|
|
||||||
btnClassName: computed("showFullTitle", function() {
|
btnClassName: computed("showFullTitle", function() {
|
||||||
return `btn ${this.showFullTitle ? "btn-icon-text" : "no-text btn-icon"}`;
|
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,
|
autoFilterable: false,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
i18nPrefix: "",
|
i18nPrefix: "",
|
||||||
i18nPostfix: ""
|
i18nPostfix: "",
|
||||||
|
showCaret: true
|
||||||
},
|
},
|
||||||
|
|
||||||
modifyComponentForRow() {
|
modifyComponentForRow() {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
|
||||||
import { computed, action } from "@ember/object";
|
import { computed, action } from "@ember/object";
|
||||||
|
|
||||||
const UNPINNED = "unpinned";
|
const UNPINNED = "unpinned";
|
||||||
@ -17,7 +16,7 @@ export default DropdownSelectBoxComponent.extend({
|
|||||||
const state = pinned ? `pinned${globally}` : UNPINNED;
|
const state = pinned ? `pinned${globally}` : UNPINNED;
|
||||||
const title = I18n.t(`topic_statuses.${state}.title`);
|
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.title = title;
|
||||||
content.name = state;
|
content.name = state;
|
||||||
content.icon = `thumbtack${state === UNPINNED ? " unpinned" : ""}`;
|
content.icon = `thumbtack${state === UNPINNED ? " unpinned" : ""}`;
|
||||||
|
@ -6,3 +6,5 @@
|
|||||||
selectKit=selectKit
|
selectKit=selectKit
|
||||||
shouldDisplayClearableButton=shouldDisplayClearableButton
|
shouldDisplayClearableButton=shouldDisplayClearableButton
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
{{d-icon caretIcon class="caret-icon"}}
|
||||||
|
@ -106,6 +106,7 @@
|
|||||||
|
|
||||||
.caret-icon {
|
.caret-icon {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
margin-right: 0;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
Loading…
Reference in New Issue
Block a user