Skip to content

Commit 21e0f66

Browse files
committed
CrateSidebar: Extract OwnersList component
1 parent 06589a9 commit 21e0f66

File tree

4 files changed

+31
-32
lines changed

4 files changed

+31
-32
lines changed

app/components/crate-sidebar.hbs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,7 @@
8484

8585
<div>
8686
<h3>Owners</h3>
87-
88-
<ul local-class='owners' data-test-owners>
89-
{{#each @crate.owner_team as |team|}}
90-
<li>
91-
<LinkTo @route={{team.kind}} @model={{team.login}} data-test-team-link={{team.login}}>
92-
<UserAvatar @user={{team}} @size="medium-small" />
93-
</LinkTo>
94-
</li>
95-
{{/each}}
96-
97-
{{#each @crate.owner_user as |user|}}
98-
<li>
99-
<LinkTo @route={{user.kind}} @model={{user.login}} data-test-user-link={{user.login}}>
100-
<UserAvatar @user={{user}} @size="medium-small" />
101-
</LinkTo>
102-
</li>
103-
{{/each}}
104-
</ul>
87+
<OwnersList @teams={{@crate.owner_team}} @users={{@crate.owner_user}} />
10588
</div>
10689
</div>
10790

@@ -110,7 +93,7 @@
11093
{{#if @crate.categories}}
11194
<div>
11295
<h3>Categories</h3>
113-
<ul>
96+
<ul local-class="categories">
11497
{{#each @crate.categories as |category|}}
11598
<li><LinkTo @route="category" @model={{category.slug}}>{{category.category}}</LinkTo></li>
11699
{{/each}}

app/components/crate-sidebar.module.css

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
flex-direction: column;
1111
}
1212

13-
ul {
13+
.categories {
1414
padding-left: 20px;
1515
}
1616
}
@@ -103,18 +103,6 @@
103103
}
104104
}
105105

106-
ul.owners {
107-
display: flex;
108-
flex-wrap: wrap;
109-
list-style: none;
110-
padding: 0;
111-
margin: 0;
112-
113-
li {
114-
margin: 0 7px 7px 0;
115-
}
116-
}
117-
118106
.more-versions-link,
119107
.reverse-deps-link {
120108
composes: small from '../styles/shared/typography.module.css';

app/components/owners-list.hbs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<ul local-class='owners' data-test-owners>
2+
{{#each @teams as |team|}}
3+
<li>
4+
<LinkTo @route={{team.kind}} @model={{team.login}} data-test-team-link={{team.login}}>
5+
<UserAvatar @user={{team}} @size="medium-small" />
6+
</LinkTo>
7+
</li>
8+
{{/each}}
9+
10+
{{#each @users as |user|}}
11+
<li>
12+
<LinkTo @route={{user.kind}} @model={{user.login}} data-test-user-link={{user.login}}>
13+
<UserAvatar @user={{user}} @size="medium-small" />
14+
</LinkTo>
15+
</li>
16+
{{/each}}
17+
</ul>

app/components/owners-list.module.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.owners {
2+
display: flex;
3+
flex-wrap: wrap;
4+
list-style: none;
5+
padding: 0;
6+
margin: 0;
7+
8+
li {
9+
margin: 0 7px 7px 0;
10+
}
11+
}

0 commit comments

Comments
 (0)