Skip to content

Commit 8dab4d4

Browse files
Convert documentation tab into button
1 parent f54bf1d commit 8dab4d4

File tree

3 files changed

+43
-25
lines changed

3 files changed

+43
-25
lines changed

templates/crate/details.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@
4545
{%- endif -%}
4646

4747
{# If the crate has a custom doc url, show it #}
48-
{%- if details.documentation_url -%}
49-
<li class="pure-menu-item">
50-
<a href="{{ details.documentation_url }}" title="Canonical documentation" class="pure-menu-link">
51-
{{ "file-alt" | far(fw=true) }} Documentation
52-
</a>
53-
</li>
54-
{%- endif -%}
5548

5649
{# If the release has a repository, show it #}
5750
{%- if details.repository_url -%}

templates/header/package_navigation.html

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
{% macro package_navigation(title=false, metadata, platforms=false, active_tab) %}
1616
<div class="cratesfyi-package-container">
1717
<div class="container">
18+
{# The partial path of the crate, `:name/:release` #}
19+
{%- set crate_path = metadata.name ~ "/" ~ metadata.version -%}
20+
21+
{# If docs are built, show a button for them #}
22+
1823
{# Page title #}
1924
<h1 id="crate-title">
2025
{%- if title -%}
@@ -25,10 +30,17 @@ <h1 id="crate-title">
2530
{%- endif -%}
2631
</h1>
2732

28-
{# Page description #}
29-
<div class="description">
30-
{%- if metadata.description -%}
31-
{{ metadata.description }}
33+
<div class="description-container">
34+
{# Page description #}
35+
<div class="description">
36+
{%- if metadata.description -%}
37+
{{ metadata.description }}
38+
{%- endif -%}
39+
</div>
40+
{%- if metadata.rustdoc_status -%}
41+
<a href="/{{ crate_path | safe }}/{{ metadata.target_name }}/" class="doc-link">
42+
{{ "book" | fas(fw=true) }} Documentation
43+
</a>
3244
{%- endif -%}
3345
</div>
3446

@@ -53,20 +65,6 @@ <h1 id="crate-title">
5365
{%- endif -%}
5466

5567
<ul class="pure-menu-list">
56-
{# The partial path of the crate, `:name/:release` #}
57-
{%- set crate_path = metadata.name ~ "/" ~ metadata.version -%}
58-
59-
{# If docs are built, show a tab for them #}
60-
{%- if metadata.rustdoc_status -%}
61-
<li class="pure-menu-item">
62-
{# The docs tab redirects to the docs, so the tab will never be selected and seen #}
63-
<a href="/{{ crate_path | safe }}/{{ metadata.target_name }}/" class="pure-menu-link">
64-
{{ "book" | fas(fw=true) }}
65-
<span class="title"> Documentation</span>
66-
</a>
67-
</li>
68-
{%- endif -%}
69-
7068
{# The crate information tab #}
7169
<li class="pure-menu-item"><a href="/crate/{{ crate_path | safe }}"
7270
class="pure-menu-link{% if active_tab == 'crate' %} pure-menu-active{% endif %}">

templates/style/base.scss

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,33 @@ div.cratesfyi-package-container {
523523
display: inline-block;
524524
}
525525
}
526+
527+
.description-container {
528+
display: flex;
529+
530+
.description {
531+
padding-top: 6px;
532+
}
533+
534+
.doc-link {
535+
display: flex;
536+
margin-right: 10px;
537+
height: min-content;
538+
background: #fff;
539+
padding: 7px;
540+
border: 1px solid #ccc;
541+
border-radius: 5px;
542+
543+
.fas {
544+
margin-top: 2px;
545+
margin-right: 4px;
546+
}
547+
548+
&:hover {
549+
border-color: #81c5ee;
550+
}
551+
}
552+
}
526553
}
527554

528555
div.cratesfyi-package-container-rustdoc {

0 commit comments

Comments
 (0)