Skip to content

Commit 16f4369

Browse files
committed
OwnersList: Show detailed list for small number of owners
1 parent 272fca5 commit 16f4369

File tree

3 files changed

+54
-7
lines changed

3 files changed

+54
-7
lines changed

app/components/owners-list.hbs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
<ul local-class='owners' data-test-owners>
1+
<ul local-class="list {{if this.showDetailedList "detailed"}}" data-test-owners>
22
{{#each @owners as |owner|}}
33
<li>
4-
<LinkTo @route={{owner.kind}} @model={{owner.login}} data-test-owner-link={{owner.login}}>
5-
<UserAvatar @user={{owner}} @size="medium-small" />
4+
<LinkTo
5+
@route={{owner.kind}}
6+
@model={{owner.login}}
7+
local-class="link"
8+
data-test-owner-link={{owner.login}}
9+
>
10+
<UserAvatar @user={{owner}} @size="medium-small" local-class="avatar" />
11+
<span local-class="name">{{or owner.display_name owner.name}}</span>
612
</LinkTo>
713
</li>
814
{{/each}}

app/components/owners-list.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Component from '@glimmer/component';
2+
3+
export default class VersionRow extends Component {
4+
get showDetailedList() {
5+
return this.args.owners.length <= 5;
6+
}
7+
}

app/components/owners-list.module.css

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,45 @@
1-
.owners {
1+
.list.detailed {
2+
list-style: none;
3+
padding: 0;
4+
margin: 0;
5+
6+
> * + * {
7+
margin-top: 5px;
8+
}
9+
10+
.link {
11+
display: grid;
12+
grid-template-columns: auto 1fr;
13+
align-items: center;
14+
}
15+
16+
.avatar {
17+
margin-right: 10px;
18+
}
19+
20+
.name {
21+
overflow: hidden;
22+
text-overflow: ellipsis;
23+
white-space: nowrap;
24+
}
25+
}
26+
27+
.list:not(.detailed) {
228
display: flex;
329
flex-wrap: wrap;
430
list-style: none;
531
padding: 0;
6-
margin: 0;
32+
margin: 0 0 -10px;
733

8-
li {
9-
margin: 0 7px 7px 0;
34+
> * {
35+
margin: 0 10px 10px 0;
1036
}
37+
38+
.name {
39+
display: none;
40+
}
41+
}
42+
43+
.avatar {
44+
border-radius: 4px;
1145
}

0 commit comments

Comments
 (0)