UX: minor tweaks to theme components selection UI (#6596)

This commit is contained in:
Joffrey JAFFEUX 2018-11-13 14:57:50 +01:00 committed by GitHub
parent c1e82e7442
commit 7fa21ce199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 18 deletions

View File

@ -67,6 +67,11 @@ export default Ember.Component.extend({
return children.map(t => t.get("name")); return children.map(t => t.get("name"));
}, },
@computed("children")
childrenString(children) {
return children.join(", ");
},
@computed( @computed(
"theme.childThemes.length", "theme.childThemes.length",
"theme.component", "theme.component",

View File

@ -25,11 +25,8 @@
{{#if displayComponents}} {{#if displayComponents}}
<div class="components-list"> <div class="components-list">
{{#each children as |child|}} <span class="components">{{childrenString}}</span>
<span class="component">
{{child}}
</span>
{{/each}}
{{#if displayHasMore}} {{#if displayHasMore}}
<span {{action "toggleChildrenExpanded"}} class="others-count"> <span {{action "toggleChildrenExpanded"}} class="others-count">
{{#if childrenExpanded}} {{#if childrenExpanded}}

View File

@ -307,22 +307,15 @@
.components-list { .components-list {
margin-top: 5px; margin-top: 5px;
display: flex; display: inline-block;
flex-wrap: wrap;
font-size: $font-down-1; font-size: $font-down-1;
align-items: baseline; align-items: baseline;
color: $primary-high;
.others-count,
.others-count:hover { .others-count:hover {
text-decoration: underline; text-decoration: underline;
} }
.component {
display: flex;
padding: 3px 5px 3px 5px;
border-radius: 2px;
border: 1px solid $primary-low;
margin-right: 5px;
margin-bottom: 5px;
}
} }
.inner-wrapper { .inner-wrapper {

View File

@ -69,12 +69,17 @@ componentTest("with children", {
test(assert) { test(assert) {
assert.expect(2); assert.expect(2);
assert.deepEqual( assert.deepEqual(
Array.from(this.$(".component")).map(node => node.innerText.trim()), find(".components")
childrenList.splice(0, 4).map(theme => theme.get("name")), .text()
.trim(),
childrenList
.splice(0, 4)
.map(theme => theme.get("name"))
.join(", "),
"lists the first 4 children" "lists the first 4 children"
); );
assert.deepEqual( assert.deepEqual(
this.$(".others-count") find(".others-count")
.text() .text()
.trim(), .trim(),
I18n.t("admin.customize.theme.and_x_more", { count: 1 }), I18n.t("admin.customize.theme.and_x_more", { count: 1 }),