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"));
},
@computed("children")
childrenString(children) {
return children.join(", ");
},
@computed(
"theme.childThemes.length",
"theme.component",

View File

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

View File

@ -307,22 +307,15 @@
.components-list {
margin-top: 5px;
display: flex;
flex-wrap: wrap;
display: inline-block;
font-size: $font-down-1;
align-items: baseline;
color: $primary-high;
.others-count,
.others-count:hover {
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 {

View File

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