Better home, crips images

This commit is contained in:
Hamcha 2020-07-02 12:26:08 +02:00
parent 447473a5b7
commit ec56a2a9a4
Signed by untrusted user: hamcha
GPG key ID: 41467804B19A3315
6 changed files with 116 additions and 67 deletions

View file

@ -34,6 +34,7 @@ steps:
- yarn build - yarn build
environment: environment:
SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_}-${DRONE_COMMIT_SHA:0:8} SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_}-${DRONE_COMMIT_SHA:0:8}
REVISION: ${DRONE_COMMIT_SHA}
when: when:
event: event:
- push - push
@ -47,6 +48,7 @@ steps:
environment: environment:
SUBPATH: /tghandbook/pr-${DRONE_PULL_REQUEST} SUBPATH: /tghandbook/pr-${DRONE_PULL_REQUEST}
OUTDIR: ./dist-pr OUTDIR: ./dist-pr
REVISION: ${DRONE_COMMIT_SHA}
when: when:
event: event:
- pull_request - pull_request
@ -60,6 +62,7 @@ steps:
environment: environment:
SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_} SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_}
OUTDIR: ./dist-branch OUTDIR: ./dist-branch
REVISION: ${DRONE_COMMIT_SHA}
when: when:
event: event:
- push - push

View file

@ -49,7 +49,7 @@
<nav id="section-list"></nav> <nav id="section-list"></nav>
<nav id="tab-list"></nav> <nav id="tab-list"></nav>
<section id="tabs"> <section id="tabs">
<div class="page center" id="Welcome" data-tab="$Welcome"> <div class="page special center" id="Welcome" data-tab="$Welcome">
<div class="wrapper"> <div class="wrapper">
<header> <header>
<img class="icon" src="assets/images/outline.svg" /> <img class="icon" src="assets/images/outline.svg" />
@ -72,13 +72,11 @@
are not as polished as they should be. are not as polished as they should be.
</li> </li>
</ul> </ul>
<p> <div class="action_buttons">
Click any guide in the top menu to open it or <button id="welcome_expand">Extra features</button>
<a href="#" id="welcome_expand">click here</a> to learn about
some of the extra features packed in.
</p>
</div> </div>
<div class="features"> </div>
<div class="features hidden">
<h2> <h2>
Extra Features Extra Features
</h2> </h2>
@ -123,6 +121,24 @@
</p> </p>
</div> </div>
</div> </div>
<div class="credits hidden">
<h2>
Other infos
</h2>
<p>
Thanks to /tg/station and every wiki contributor who did most of
the work!
</p>
<p>
This thing is Open Source:
<a href="https://git.fromouter.space/hamcha/tghandbook"
>git.fromouter.space/hamcha/tghandbook</a
>
</p>
<p>
/tg/station handbook revision: <span id="tgh-version"></span>
</p>
</div>
</div> </div>
</div> </div>
</section> </section>

View file

@ -75,6 +75,13 @@ if ("serviceWorker" in navigator) {
}); });
} }
// Start loading pages
load(); load();
// Add search box
document.body.appendChild(searchBox()); document.body.appendChild(searchBox());
// Add revision info
document
.getElementById("tgh-version")
.appendChild(document.createTextNode(process.env.REVISION || "unknown"));

View file

@ -1,13 +1,25 @@
import { nextAnimationFrame } from "../../utils"; import { nextAnimationFrame } from "../../utils";
function expandPage(root: HTMLElement) {
// Show all sections
root.querySelectorAll<HTMLElement>("div.hidden").forEach((div) => {
div.style.display = "block";
div.style.opacity = "1";
});
// Hide buttons
root.querySelector<HTMLElement>(".action_buttons").style.display = "none";
// Remove vertical centering
root.classList.remove("center");
}
export function welcomeScript(root: HTMLElement): void { export function welcomeScript(root: HTMLElement): void {
const expandLink = document.getElementById("welcome_expand"); const expandLink = document.getElementById("welcome_expand");
expandLink.addEventListener("click", async () => { expandLink.addEventListener("click", async () => {
expandPage(root);
const featureDiv = root.querySelector<HTMLDivElement>(".features"); const featureDiv = root.querySelector<HTMLDivElement>(".features");
featureDiv.style.display = "block";
root.classList.remove("center");
await nextAnimationFrame(); await nextAnimationFrame();
featureDiv.style.opacity = "1";
featureDiv.scrollIntoView({ featureDiv.scrollIntoView({
block: "start", block: "start",
inline: "nearest", inline: "nearest",

View file

@ -76,6 +76,12 @@ $max-width: 960px;
} }
} }
.page:not(.special) img {
image-rendering: -moz-crisp-edges;
image-rendering: pixelated;
-ms-interpolation-mode: nearest-neighbor;
}
.wrapper { .wrapper {
margin: 0 auto; margin: 0 auto;
max-width: $max-width; max-width: $max-width;

View file

@ -29,13 +29,18 @@
} }
} }
.features { .hidden {
width: 100%; width: 100%;
opacity: 0; opacity: 0;
display: none; display: none;
transition: all 200ms; transition: all 200ms;
} }
h1,
h2 {
margin-top: 2em;
}
h3 { h3 {
font-size: 15pt; font-size: 15pt;
} }