Skip to content

Commit f9cb55e

Browse files
committed
Auto merge of #3347 - Turbo87:keyword-header, r=pichfl
Move keyword list from `CrateSidebar` to `CrateHeader` This moves the list of crate keywords right below the crate description in the header to make them easier to discover and navigate :) <img width="1026" alt="Bildschirmfoto 2021-02-27 um 11 57 56" src="https://user-images.githubusercontent.com/141300/109385375-9f4de380-78f3-11eb-9f24-351185a311d2.png">
2 parents 6fddb34 + 52c32a3 commit f9cb55e

File tree

4 files changed

+34
-14
lines changed

4 files changed

+34
-14
lines changed

app/components/crate-header.hbs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,24 @@
1212
<FollowButton @crate={{@crate}}/>
1313
{{/if}}
1414
</div>
15+
1516
{{#if @crate.description}}
1617
<div local-class="description">
1718
{{@crate.description}}
1819
</div>
1920
{{/if}}
21+
22+
{{#if @crate.keywords}}
23+
<ul local-class="keywords">
24+
{{#each @crate.keywords as |keyword|}}
25+
<li>
26+
<LinkTo @route="keyword" @model={{keyword}}>
27+
<span local-class="hash">#</span>{{keyword.id}}
28+
</LinkTo>
29+
</li>
30+
{{/each}}
31+
</ul>
32+
{{/if}}
2033
</PageHeader>
2134

2235
<NavTabs aria-label="{{@crate.name}} crate subpages" local-class="nav" as |nav|>

app/components/crate-header.module.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,26 @@
3535
line-height: 1.35;
3636
}
3737

38+
.keywords {
39+
list-style: none;
40+
margin: 10px 0 0;
41+
padding: 0;
42+
43+
> li {
44+
display: inline;
45+
46+
&:not(:last-child) {
47+
margin-right: 15px;
48+
}
49+
}
50+
}
51+
52+
.hash {
53+
margin-right: 1px;
54+
font-family: monospace;
55+
font-size: 90%;
56+
}
57+
3858
.nav {
3959
margin-bottom: 20px;
4060
}

app/components/crate-sidebar.hbs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,6 @@
104104
</div>
105105
{{/if}}
106106

107-
{{#unless @crate.keywords.isPending}}
108-
{{#if @crate.keywords}}
109-
<div>
110-
<h3>Keywords</h3>
111-
<ul local-class='keywords'>
112-
{{#each @crate.keywords as |keyword|}}
113-
<li><LinkTo @route="keyword" @model={{keyword}}>{{keyword.id}}</LinkTo></li>
114-
{{/each}}
115-
</ul>
116-
</div>
117-
{{/if}}
118-
{{/unless}}
119-
120107
{{#unless @crate.categories.isPending}}
121108
{{#if @crate.categories}}
122109
<div>

app/components/crate-sidebar.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
}
100100
}
101101

102-
ul.owners, ul.keywords {
102+
ul.owners {
103103
display: flex;
104104
flex-wrap: wrap;
105105
list-style: none;

0 commit comments

Comments
 (0)