Skip to content

Commit d9521d4

Browse files
committed
theme: customize the 404 page
Swizzle the 404 page and customize to match the 404 page on Golioth.io Signed-off-by: Mike Szczys <[email protected]>
1 parent c0b6d1a commit d9521d4

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed

src/theme/NotFound/Content/index.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import Translate from '@docusaurus/Translate';
4+
import Heading from '@theme/Heading';
5+
import styles from './styles.module.css';
6+
7+
//Encoding command:
8+
//ffmpeg -i Echo-Coding-loop.gif -c:v libvpx -an -s 272x288 -auto-alt-ref 0 Echo-Coding-loop.webm
9+
import EchoCodingWEBM from '@site/static/img/Echo-Coding-loop.webm';
10+
11+
export default function NotFoundContent({className}) {
12+
return (
13+
<main className={clsx(`container margin-vert--xl ${styles.notfound_container}`, className)}>
14+
<div className="row">
15+
<div className={`col col--8 col--offset-2 ${styles.notfound}`}>
16+
<div className={styles.notfound_videobox}>
17+
<video autoPlay loop muted>
18+
<source src={EchoCodingWEBM} type="video/webm" />
19+
</video>
20+
</div>
21+
<div>
22+
<Heading as="h1" className="hero__title">
23+
<Translate
24+
id="theme.NotFound.title"
25+
description="The title of the 404 page">
26+
Oops! This page was bricked.
27+
</Translate>
28+
</Heading>
29+
<p>
30+
<Translate
31+
id="theme.NotFound.p1"
32+
description="The first paragraph of the 404 page">
33+
We’re working on it. Can we help you with something else?
34+
</Translate>
35+
</p>
36+
</div>
37+
</div>
38+
<div className={`col col--8 col--offset-2 ${styles.notfound_search}`}>
39+
<form action="/search">
40+
<input type="text" name="q" placeholder="Search Golioth for IoT Stuff..." />
41+
<input type="submit" value=">" />
42+
</form>
43+
</div>
44+
</div>
45+
</main>
46+
);
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
.notfound {
2+
display: flex;
3+
align-items: center;
4+
gap: 1rem;
5+
}
6+
7+
@media (max-width: 576px) {
8+
.notfound_container {
9+
margin-top: 10px !important;
10+
}
11+
12+
.notfound {
13+
flex-direction: column;
14+
align-items: flex-start;
15+
}
16+
17+
.notfound_videobox {
18+
margin: 0 auto;
19+
}
20+
.notfound h1 {
21+
font-size: var(--ifm-h1-font-size);
22+
}
23+
}
24+
25+
.notfound_search form {
26+
display: flex;
27+
flex-direction: row;
28+
}
29+
30+
.notfound_search input {
31+
border: none;
32+
background-color: var(--golioth-color-concrete);
33+
min-height: 3rem;
34+
padding: .5rem 1rem;
35+
font-size: var(--ifm-font-size-base);
36+
width: 100%;
37+
}
38+
39+
.notfound_search input[type="text"] {
40+
flex-grow: 4;
41+
}
42+
43+
.notfound_search input::placeholder {
44+
font-weight: 100;
45+
opacity: 0.7;
46+
}
47+
48+
.notfound_search input[type="submit"] {
49+
max-width: 3rem;
50+
min-height: 3rem;
51+
}
52+
53+
html[data-theme="dark"] .notfound_search input {
54+
background-color: var(--golioth-color-charcoal);
55+
}
56+
57+
.notfound_search input:focus {
58+
outline: none;
59+
}
60+
61+
.notfound_search form:focus-within {
62+
outline: 1px solid var(--golioth-color-coral);
63+
}

src/theme/NotFound/index.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import {translate} from '@docusaurus/Translate';
3+
import {PageMetadata} from '@docusaurus/theme-common';
4+
import Layout from '@theme/Layout';
5+
import NotFoundContent from '@theme/NotFound/Content';
6+
export default function Index() {
7+
const title = translate({
8+
id: 'theme.NotFound.title',
9+
message: 'Page Not Found',
10+
});
11+
return (
12+
<>
13+
<PageMetadata title={title} />
14+
<Layout>
15+
<NotFoundContent />
16+
</Layout>
17+
</>
18+
);
19+
}

static/img/Echo-Coding-loop.webm

290 KB
Binary file not shown.

0 commit comments

Comments
 (0)