Skip to content

Commit bded1fe

Browse files
authored
Merge pull request #65 from Aloso/mobile-header-footer
Improve header and footer
2 parents 22906e8 + 64a3a4c commit bded1fe

File tree

2 files changed

+63
-46
lines changed

2 files changed

+63
-46
lines changed

_layouts/default.html

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@
3333
{% if page.url != "/" %}
3434
<header>
3535
<div id="header-inner">
36-
<a class="site-title" href="{{ site.baseurl }}/">
37-
<img src="/assets/rust-analyzer.svg" alt="rust analyzer" id="header-logo">
38-
</a>
39-
<a class="nav-link" href="https://opencollective.com/rust-analyzer/">Sponsor</a>
40-
<a class="nav-link" href="/manual.html">Docs</a>
41-
<a class="nav-link" href="/blog">Blog</a>
42-
<a class="nav-link" href="/thisweek">Changelog</a>
36+
<div id="header-left">
37+
<a class="site-title" href="{{ site.baseurl }}/">
38+
<img src="/assets/rust-analyzer.svg" alt="rust analyzer" id="header-logo">
39+
</a>
40+
</div>
41+
<div id="header-right">
42+
<a class="nav-link" href="https://opencollective.com/rust-analyzer/">Sponsor</a>
43+
<a class="nav-link" href="/manual.html">Docs</a>
44+
<a class="nav-link" href="/blog">Blog</a>
45+
<a class="nav-link" href="/thisweek">Changelog</a>
46+
</div>
4347
</div>
4448
</header>
4549
{% endif %}
@@ -49,23 +53,26 @@
4953
</main>
5054

5155
<footer>
52-
<p id="footer-inner">
53-
<span class="footer-by">
56+
<div id="footer-inner">
57+
<div class="footer-by">
5458
<a href="https://ferrous-systems.com/">
55-
<img class="ferrous-logo" src="/assets/ferrous-logo.png">
56-
Ferrous Systems
57-
</a> & <a href="https://github.com/rust-analyzer/rust-analyzer/graphs/contributors">contributors</a>
58-
</span>
59-
<a href="{{ '/feed.xml' | prepend: site.baseurl }}" class="footer-link">
60-
<i class="fa fa-rss"></i> rss
61-
</a>
62-
<a href="https://github.com/rust-analyzer/rust-analyzer.github.io" class="footer-link">
63-
<i class="fa fa-github"></i> src
64-
</a>
65-
<a href="https://opencollective.com/rust-analyzer/" class="footer-link">
66-
<i class="fa fa-github"></i> sponsor
67-
</a>
68-
</p>
59+
<img class="ferrous-logo" src="/assets/ferrous-logo.png">Ferrous Systems</a>
60+
&
61+
<a href="https://github.com/rust-analyzer/rust-analyzer/graphs/contributors">contributors</a>
62+
</div>
63+
64+
<div id="footer-links">
65+
<a href="{{ '/feed.xml' | prepend: site.baseurl }}" class="footer-link">
66+
<i class="fa fa-rss"></i> rss
67+
</a>
68+
<a href="https://github.com/rust-analyzer/rust-analyzer.github.io" class="footer-link">
69+
<i class="fa fa-github"></i> src
70+
</a>
71+
<a href="https://opencollective.com/rust-analyzer/" class="footer-link">
72+
<i class="fa fa-github"></i> sponsor
73+
</a>
74+
</div>
75+
</div>
6976
</footer>
7077
</body>
7178

css/main.css

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,37 @@ header {
1010
box-shadow: 0 0 7px rgba(0, 0, 0, 0.15);
1111
}
1212

13-
#header-inner {
13+
#header-inner, #footer-inner {
1414
display: flex;
15-
flex-wrap: wrap;
1615
justify-content: space-between;
17-
align-items: stretch;
1816
width: 100%;
1917
max-width: 80ch;
20-
padding: 1ch;
18+
padding: 1ch 0;
2119
margin: 0 auto;
2220
}
2321

22+
#header-left, #header-right, #footer-links {
23+
display: flex;
24+
margin: 0 1ch;
25+
flex-wrap: wrap;
26+
align-content: center;
27+
justify-content: center;
28+
line-height: 2rem;
29+
}
30+
2431
#header-logo {
2532
display: block;
2633
width: calc(17vw + 4rem);
2734
max-width: 200px;
28-
margin-right: 0.4rem;
2935
}
3036

3137
#header-logo:hover, #header-logo:focus {
3238
opacity: 0.8;
3339
}
3440

35-
a.nav-link, a.site-title {
41+
a.nav-link, a.site-title, a.footer-link {
3642
display: flex;
37-
flex-direction: column;
43+
align-items: center;
3844
justify-content: center;
3945
}
4046

@@ -45,7 +51,7 @@ a.nav-link {
4551
font-style: normal;
4652
color: rgba(0, 0, 0, .8);
4753
text-decoration: none;
48-
border-radius: 4px;
54+
padding: 0 10px;
4955
}
5056

5157
a.nav-link:hover {
@@ -68,26 +74,14 @@ main {
6874

6975
footer {
7076
width: 100%;
71-
padding: 2ch;
72-
text-align: center;
7377
margin-top: 1rem;
7478
box-shadow: 0 0 7px rgba(0, 0, 0, 0.15);
7579
}
7680

77-
#footer-inner {
78-
display: flex;
79-
flex-wrap: wrap;
80-
width: 100%;
81-
max-width: 80ch;
82-
margin: 0 auto;
83-
}
84-
8581
.footer-by {
86-
margin-right: auto;
87-
}
88-
89-
footer p {
90-
margin: 0;
82+
margin: 0 1ch;
83+
padding: 10px 0;
84+
text-align: center;
9185
}
9286

9387
.ferrous-logo {
@@ -103,6 +97,7 @@ footer p {
10397
white-space: nowrap;
10498
}
10599
.footer-link > .fa {
100+
margin-right: 0.4em;
106101
color: rgba(0, 0, 0, .8)
107102
}
108103
footer > p {
@@ -186,3 +181,18 @@ a.source:hover {
186181
.post-link:hover {
187182
text-decoration: underline;
188183
}
184+
185+
@media (max-width: 600px) {
186+
#header-inner {
187+
flex-direction: column;
188+
padding: 1ch 0 0 0;
189+
}
190+
191+
a.nav-link {
192+
padding: 0 5px;
193+
}
194+
195+
#footer-inner {
196+
flex-direction: column;
197+
}
198+
}

0 commit comments

Comments
 (0)