Skip to content

Commit 559f665

Browse files
Add footer (#9)
* Add footer * style footer * improve content height * document sticky footer solution, per stefanv's out of band PR review --------- Co-authored-by: Brian Hawthorne <brian.lee.hawthorne@proton.me>
1 parent 847db02 commit 559f665

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed

footer.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
% This defines the footer of the site, and is not parsed as a regular "page"
2+
% We point to it with the following in `myst.yml`:
3+
% site:
4+
% parts:
5+
% footer: footer.md
6+
7+
% Here we use `grid` to add a basic grid structure to the HTML,
8+
% but the formatting column sizes are defined manually in css/footer.css
9+
% see the `grid-template-columns` line.
10+
:::::{grid} 3 3 5 5
11+
:class: outer-grid col-screen
12+
13+
<!-- Project description -->
14+
15+
::::{div}
16+
17+
# Landing Pages
18+
19+
```{image} https://jupyterbook.org/en/stable/_images/logo-square.svg
20+
:width: 50px
21+
:align: left
22+
```
23+
24+
This is a description of our project. And a [link to its homepage](https://github.com/jupyter-book/example-landing-pages).
25+
::::
26+
27+
<!-- Spacer between project description and links columns -->
28+
29+
::::{div}
30+
::::
31+
32+
<!-- Link columns -->
33+
34+
% This a _second_ grid embedded within the first one, to create nicer
35+
% responsive design experience. This grid will have a single column on narrow screens,
36+
% and fan out into three columns on wide screens. However, it always remains within
37+
% its parent grid column.
38+
::::{grid} 1 1 3 3
39+
40+
:::{div}
41+
42+
- [About](https://mystmd.org/overview/ecosystem)
43+
- [Guide](https://mystmd.org/guide)
44+
- [Sandbox](https://mystmd.org/sandbox)
45+
:::
46+
47+
:::{div}
48+
49+
- A second column!
50+
- With multiple entries
51+
:::
52+
53+
:::{div}
54+
55+
- And what about a third
56+
:::
57+
58+
::::
59+
60+
:::::

myst.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ site:
1919
favicon: images/favicon.ico
2020
logo: images/statistical-python-logo.svg
2121
logo_text: Statistical Python
22+
style: ./site.css
23+
parts:
24+
footer: footer.md

site.css

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
html,
2+
body {
3+
height: 100%;
4+
}
5+
body {
6+
display: flex;
7+
flex-direction: column;
8+
}
9+
10+
.article.content {
11+
/* Override 100vh from myst-theme:styles/typography.css so content div
12+
* doesn't push the footer offscreen.
13+
*/
14+
min-height: 0vh;
15+
flex: 1 0 auto;
16+
}
17+
18+
.footer {
19+
/* Make footer "sticky" to page bottom (also the above flex rules), per
20+
* the flexbox strategy described here:
21+
* https://css-tricks.com/couple-takes-sticky-footer/#aa-there-is-flexbox
22+
* and here:
23+
* https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/
24+
* This solution does not require hardcoding a fixed footer height in the
25+
* style rules.
26+
*/
27+
flex-shrink: 0;
28+
background: #013243;
29+
color: white;
30+
padding-left: 2rem;
31+
padding-right: 2rem;
32+
33+
padding-left: 3.5rem;
34+
padding-right: 3.5rem;
35+
36+
/* Outer content grid */
37+
& .outer-grid {
38+
/* spacer, project description, spacer, link columns, spacer */
39+
grid-template-columns: 3fr 3fr 4fr;
40+
align-items: center;
41+
margin-bottom: 0rem;
42+
43+
& li {
44+
list-style: none;
45+
}
46+
}
47+
48+
@media (max-width: 640px) {
49+
& .outer-grid {
50+
grid-template-columns: 1fr;
51+
justify-items: start;
52+
}
53+
}
54+
55+
/* Heading colours */
56+
& a,
57+
h1,
58+
h2,
59+
h3,
60+
h4,
61+
h5,
62+
h6 {
63+
color: white;
64+
}
65+
66+
& h1 {
67+
font-size: 1.25rem;
68+
font-weight: bold;
69+
}
70+
}

0 commit comments

Comments
 (0)