Skip to content

Commit 99f75f2

Browse files
authored
start work on doc footer (tokio-rs#35)
1 parent 574f6ea commit 99f75f2

File tree

11 files changed

+311
-56
lines changed

11 files changed

+311
-56
lines changed

components/content.tsx

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Menu from "../components/menu";
2+
import { DiscordIcon, GitHubIcon } from "./icons";
23
import ReactMarkdown from "react-markdown/with-html";
34
import SyntaxHighlighter from "react-syntax-highlighter";
45

@@ -10,7 +11,7 @@ const CodeBlock = ({ language, value }) => {
1011
);
1112
};
1213

13-
export default function Content({ menu, href, title, body }) {
14+
export default function Content({ menu, href, title, next, prev, body }) {
1415
return (
1516
<>
1617
<div className="columns is-marginless tk-docs">
@@ -31,6 +32,60 @@ export default function Content({ menu, href, title, body }) {
3132
source={body}
3233
renderers={{ code: CodeBlock }}
3334
/>
35+
<div className="tk-doc-footer">
36+
<div className="level">
37+
<div className="level-left">
38+
<div className="level-item tk-prev">
39+
{next && (
40+
<a href={next.href}>
41+
<span
42+
className="tk-arrow"
43+
style={{ marginRight: "0.5rem" }}
44+
>
45+
<img src="/img/arrow-left.svg" />
46+
</span>
47+
{next.title}
48+
</a>
49+
)}
50+
</div>
51+
</div>
52+
<div className="level-right">
53+
<div className="level-item tk-next">
54+
{prev && (
55+
<a href={prev.href}>
56+
{prev.title}
57+
<span
58+
className="tk-arrow"
59+
style={{ marginLeft: "0.5rem" }}
60+
>
61+
<img src="/img/arrow-right.svg" />
62+
</span>
63+
</a>
64+
)}
65+
</div>
66+
</div>
67+
</div>
68+
<div className="level">
69+
<div className="level-left">
70+
<div className="level-item tk-help-links">
71+
<p>
72+
Get Help:
73+
<a href="https://github.com/tokio-rs/tokio/discussions">
74+
<GitHubIcon className="is-medium" />
75+
</a>
76+
<a href="https://discord.gg/tokio">
77+
<DiscordIcon className="is-medium" />
78+
</a>
79+
</p>
80+
</div>
81+
</div>
82+
<div className="level-right">
83+
<div className="level-item tk-edit-this-page">
84+
<a href="#">Edit this page</a>
85+
</div>
86+
</div>
87+
</div>
88+
</div>
3489
</section>
3590
</div>
3691
</div>

components/footer.tsx

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,28 @@ import React from "react";
22
import { DiscordIcon, GitHubIcon, TwitterIcon } from "./icons";
33

44
export default function Footer() {
5-
const libs = [
6-
["Tokio", "/tokio", "https://github.com/tokio-rs/tokio"],
7-
["Hyper", "https://docs.rs/hyper", "https://github.com/hyperium/hyper"],
8-
["Tonic", "https://docs.rs/tonic", "https://github.com/hyperium/tonic"],
9-
["Tower", "https://docs.rs/tower", "https://github.com/tower-rs/tower"],
10-
["Mio", "https://docs.rs/mio", "https://github.com/tokio-rs/mio"],
11-
["Tracing", "https://docs.rs/tracing", "https://github.com/tokio-rs/tracing"],
12-
].map(([name, docs, github]) => (
13-
<div key={name} className="column is-one-third">
14-
<p className="tk-lib-name">{name}</p>
15-
<p><a href={docs}>Docs</a></p>
16-
<p><a href={github}>Github</a></p>
17-
</div>
18-
));
5+
const libs = [
6+
["Tokio", "/tokio", "https://github.com/tokio-rs/tokio"],
7+
["Hyper", "https://docs.rs/hyper", "https://github.com/hyperium/hyper"],
8+
["Tonic", "https://docs.rs/tonic", "https://github.com/hyperium/tonic"],
9+
["Tower", "https://docs.rs/tower", "https://github.com/tower-rs/tower"],
10+
["Mio", "https://docs.rs/mio", "https://github.com/tokio-rs/mio"],
11+
[
12+
"Tracing",
13+
"https://docs.rs/tracing",
14+
"https://github.com/tokio-rs/tracing",
15+
],
16+
].map(([name, docs, github]) => (
17+
<div key={name} className="column is-one-third">
18+
<p className="tk-lib-name">{name}</p>
19+
<p>
20+
<a href={docs}>Docs</a>
21+
</p>
22+
<p>
23+
<a href={github}>Github</a>
24+
</p>
25+
</div>
26+
));
1927
return (
2028
<footer className="footer">
2129
<div className="container">
@@ -28,27 +36,27 @@ export default function Footer() {
2836
height="56"
2937
/>
3038
<div className="tk-help-links">
31-
<p>
32-
Get Help:
33-
<a href="https://github.com/tokio-rs/tokio/discussions">
34-
<GitHubIcon className="is-medium"/>
35-
</a>
36-
<a href="https://discord.gg/tokio">
37-
<DiscordIcon className="is-medium"/>
38-
</a>
39-
</p>
40-
<p>
41-
Stay up to date:
42-
<a href="https://twitter.com/tokio_rs">
43-
<TwitterIcon className="is-medium"/>
44-
</a>
45-
</p>
39+
<p>
40+
Get Help:
41+
<a href="https://github.com/tokio-rs/tokio/discussions">
42+
<GitHubIcon className="is-medium" />
43+
</a>
44+
<a href="https://discord.gg/tokio">
45+
<DiscordIcon className="is-medium" />
46+
</a>
47+
</p>
48+
<p>
49+
Stay up to date:
50+
<a href="https://twitter.com/tokio_rs">
51+
<TwitterIcon className="is-medium" />
52+
</a>
53+
</p>
4654
</div>
4755
</div>
4856
<div className="column is-half">
49-
<div className="columns is-multiline is-mobile tk-footer-libs">
50-
{libs}
51-
</div>
57+
<div className="columns is-multiline is-mobile tk-footer-libs">
58+
{libs}
59+
</div>
5260
</div>
5361
</div>
5462
</div>

components/icons.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ const DISCORD_VIEW_BOX = "0 0 245 240";
55

66
type Props = {
77
children: ReactNode;
8-
className?: string,
8+
className?: string;
99
viewBox?: string;
1010
};
1111

12-
const Icon: FC<Props> = ({ children, className = "", viewBox = DEFAULT_VIEW_BOX }) => (
12+
const Icon: FC<Props> = ({
13+
children,
14+
className = "",
15+
viewBox = DEFAULT_VIEW_BOX,
16+
}) => (
1317
<span className={`icon ${className}`}>
1418
<svg
1519
width="45"
@@ -22,36 +26,40 @@ const Icon: FC<Props> = ({ children, className = "", viewBox = DEFAULT_VIEW_BOX
2226
</span>
2327
);
2428

25-
export function GitHubIcon({className = ""}) {
29+
export function GitHubIcon({ className = "" }) {
2630
return (
2731
<Icon className={className}>
2832
<path
33+
className="tk-svg-path"
2934
d="M896 128q209 0 385.5 103t279.5 279.5 103 385.5q0 251-146.5 451.5t-378.5 277.5q-27 5-40-7t-13-30q0-3 .5-76.5t.5-134.5q0-97-52-142 57-6 102.5-18t94-39 81-66.5 53-105 20.5-150.5q0-119-79-206 37-91-8-204-28-9-81 11t-92 44l-38 24q-93-26-192-26t-192 26q-16-11-42.5-27t-83.5-38.5-85-13.5q-45 113-8 204-79 87-79 206 0 85 20.5 150t52.5 105 80.5 67 94 39 102.5 18q-39 36-49 103-21 10-45 15t-57 5-65.5-21.5-55.5-62.5q-19-32-48.5-52t-49.5-24l-20-3q-21 0-29 4.5t-5 11.5 9 14 13 12l7 5q22 10 43.5 38t31.5 51l10 23q13 38 44 61.5t67 30 69.5 7 55.5-3.5l23-4q0 38 .5 88.5t.5 54.5q0 18-13 30t-40 7q-232-77-378.5-277.5t-146.5-451.5q0-209 103-385.5t279.5-279.5 385.5-103zm-477 1103q3-7-7-12-10-3-13 2-3 7 7 12 9 6 13-2zm31 34q7-5-2-16-10-9-16-3-7 5 2 16 10 10 16 3zm30 45q9-7 0-19-8-13-17-6-9 5 0 18t17 7zm42 42q8-8-4-19-12-12-20-3-9 8 4 19 12 12 20 3zm57 25q3-11-13-16-15-4-19 7t13 15q15 6 19-6zm63 5q0-13-17-11-16 0-16 11 0 13 17 11 16 0 16-11zm58-10q-2-11-18-9-16 3-14 15t18 8 14-14z"
3035
fill="#fff"
3136
/>
3237
</Icon>
3338
);
3439
}
3540

36-
export function TwitterIcon({className = ""}) {
41+
export function TwitterIcon({ className = "" }) {
3742
return (
3843
<Icon className={className}>
3944
<path
45+
className="tk-svg-path"
4046
d="M1684 408q-67 98-162 167 1 14 1 42 0 130-38 259.5t-115.5 248.5-184.5 210.5-258 146-323 54.5q-271 0-496-145 35 4 78 4 225 0 401-138-105-2-188-64.5t-114-159.5q33 5 61 5 43 0 85-11-112-23-185.5-111.5t-73.5-205.5v-4q68 38 146 41-66-44-105-115t-39-154q0-88 44-163 121 149 294.5 238.5t371.5 99.5q-8-38-8-74 0-134 94.5-228.5t228.5-94.5q140 0 236 102 109-21 205-78-37 115-142 178 93-10 186-50z"
4147
fill="#fff"
4248
/>
4349
</Icon>
4450
);
4551
}
4652

47-
export function DiscordIcon({className = ""}) {
53+
export function DiscordIcon({ className = "" }) {
4854
return (
4955
<Icon className={className} viewBox={DISCORD_VIEW_BOX}>
5056
<path
57+
className="tk-svg-path"
5158
fill="#FFF"
5259
d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"
5360
/>
5461
<path
62+
className="tk-svg-path"
5563
fill="#FFF"
5664
d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"
5765
/>

components/menu.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function Menu({ href, menu }) {
3030
{/* TODO: hook this up, only when needed */}
3131
<p className="menu-label tk-menu-back">
3232
<img
33-
src="/img/left-arrow.svg"
33+
src="/img/arrow-left-small.svg"
3434
style={{
3535
display: "inline-block",
3636
verticalAlign: "middle",

components/social-links.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ const DATA = [
2222
const SocialLinks: FC = () => (
2323
<>
2424
{DATA.map((link) => (
25-
<a className="navbar-item navbar-icon tk-social" href={link.url} key={link.name}>
25+
<a
26+
className="navbar-item navbar-icon tk-social"
27+
href={link.url}
28+
key={link.name}
29+
>
2630
{link.icon}
2731
</a>
2832
))}

components/syn.tsx

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
export default {
2+
hljs: {
3+
display: "block",
4+
overflowX: "auto",
5+
padding: "0.5em",
6+
color: "#000",
7+
background: "#f8f8ff",
8+
},
9+
"hljs-comment": {
10+
color: "#408080",
11+
fontStyle: "italic",
12+
},
13+
"hljs-quote": {
14+
color: "#408080",
15+
fontStyle: "italic",
16+
},
17+
"hljs-keyword": {
18+
color: "#954121",
19+
},
20+
"hljs-selector-tag": {
21+
color: "#954121",
22+
},
23+
"hljs-literal": {
24+
color: "#954121",
25+
},
26+
"hljs-subst": {
27+
color: "#954121",
28+
},
29+
"hljs-number": {
30+
color: "#40a070",
31+
},
32+
"hljs-string": {
33+
color: "#219161",
34+
},
35+
"hljs-doctag": {
36+
color: "#219161",
37+
},
38+
"hljs-selector-id": {
39+
color: "#19469d",
40+
},
41+
"hljs-selector-class": {
42+
color: "#19469d",
43+
},
44+
"hljs-section": {
45+
color: "#19469d",
46+
},
47+
"hljs-type": {
48+
color: "#19469d",
49+
},
50+
"hljs-params": {
51+
color: "#00f",
52+
},
53+
"hljs-title": {
54+
color: "#458",
55+
fontWeight: "bold",
56+
},
57+
"hljs-tag": {
58+
color: "#000080",
59+
fontWeight: "normal",
60+
},
61+
"hljs-name": {
62+
color: "#000080",
63+
fontWeight: "normal",
64+
},
65+
"hljs-attribute": {
66+
color: "#000080",
67+
fontWeight: "normal",
68+
},
69+
"hljs-variable": {
70+
color: "#008080",
71+
},
72+
"hljs-template-variable": {
73+
color: "#008080",
74+
},
75+
"hljs-regexp": {
76+
color: "#b68",
77+
},
78+
"hljs-link": {
79+
color: "#b68",
80+
},
81+
"hljs-symbol": {
82+
color: "#990073",
83+
},
84+
"hljs-bullet": {
85+
color: "#990073",
86+
},
87+
"hljs-built_in": {
88+
color: "#0086b3",
89+
},
90+
"hljs-builtin-name": {
91+
color: "#0086b3",
92+
},
93+
"hljs-meta": {
94+
color: "#999",
95+
fontWeight: "bold",
96+
},
97+
"hljs-deletion": {
98+
background: "#fdd",
99+
},
100+
"hljs-addition": {
101+
background: "#dfd",
102+
},
103+
"hljs-emphasis": {
104+
fontStyle: "italic",
105+
},
106+
"hljs-strong": {
107+
fontWeight: "bold",
108+
},
109+
};

lib/page.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,25 @@ import Content from "../components/content";
22
import Layout from "../components/layout";
33

44
export default function Page({ app, menu, page: { href, title, body } }) {
5+
const next = {
6+
href: "#",
7+
title: "Reducing tail latencies wit...",
8+
};
9+
const prev = {
10+
href: "#",
11+
title: "Announcing Mio 0.7-alpha.1",
12+
};
513
return (
614
<>
715
<Layout blog={app.blog}>
8-
<Content href={href} title={title} menu={menu} body={body} />
16+
<Content
17+
href={href}
18+
title={title}
19+
menu={menu}
20+
next={next}
21+
prev={prev}
22+
body={body}
23+
/>
924
</Layout>
1025
</>
1126
);
File renamed without changes.

public/img/arrow-left.svg

Lines changed: 3 additions & 0 deletions
Loading

public/img/arrow-right.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)