typescript(loopover-leaderboards): feat: basic navbar
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
37754f1a3f
commit
744c7cf49a
|
@ -10,7 +10,8 @@ export default function(config, env, helpers) {
|
||||||
banner:
|
banner:
|
||||||
"// This file is automatically generated from your CSS. Any edits will be overwritten.",
|
"// This file is automatically generated from your CSS. Any edits will be overwritten.",
|
||||||
namedExport: true,
|
namedExport: true,
|
||||||
silent: true
|
silent: true,
|
||||||
|
modules: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@import url("https://fonts.googleapis.com/css?family=Varela+Round&display=swap");
|
@import url("https://fonts.googleapis.com/css?family=Roboto|Varela+Round&display=swap");
|
||||||
|
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
|
@ -13,7 +13,12 @@ body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
font-family: var(--font);
|
||||||
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
--font: "Roboto", sans-serif;
|
||||||
--title-font: "Varela Round", sans-serif;
|
--title-font: "Varela Round", sans-serif;
|
||||||
--max-width: 800px;
|
--max-width: 800px;
|
||||||
--spacing: 2rem;
|
--spacing: 2rem;
|
||||||
|
|
2
typescript/loopover-leaderboards/src/global.css.d.ts
vendored
Normal file
2
typescript/loopover-leaderboards/src/global.css.d.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
// This file is automatically generated from your CSS. Any edits will be overwritten.
|
||||||
|
export const app: string;
|
|
@ -1,7 +1,8 @@
|
||||||
import { h } from "preact";
|
import { h } from "preact";
|
||||||
import { Route, Router } from "preact-router";
|
import { Route, Router } from "preact-router";
|
||||||
|
|
||||||
import { Home } from "./Home";
|
import { Home } from "./Home";
|
||||||
|
import { Nav } from "./Nav";
|
||||||
|
import { Layer, Stack } from "./Stack";
|
||||||
|
|
||||||
if ((module as any).hot) {
|
if ((module as any).hot) {
|
||||||
// tslint:disable-next-line:no-var-requires
|
// tslint:disable-next-line:no-var-requires
|
||||||
|
@ -11,9 +12,17 @@ if ((module as any).hot) {
|
||||||
export const App: preact.FunctionalComponent = () => {
|
export const App: preact.FunctionalComponent = () => {
|
||||||
return (
|
return (
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
<Stack height="100vh">
|
||||||
|
<Layer>
|
||||||
<Router>
|
<Router>
|
||||||
<Route path="/" component={Home} />
|
<Route path="/" component={Home} />
|
||||||
</Router>
|
</Router>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
<Layer>
|
||||||
|
<Nav />
|
||||||
|
</Layer>
|
||||||
|
</Stack>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
.link {
|
||||||
|
text-decoration: none;
|
||||||
|
color: white;
|
||||||
|
filter: brightness(0.8);
|
||||||
|
font-size: 1.6rem;
|
||||||
|
padding: 1.4rem;
|
||||||
|
font: "Roboto light";
|
||||||
|
}
|
||||||
|
|
||||||
|
.activeLink {
|
||||||
|
filter: brightness(1);
|
||||||
|
}
|
3
typescript/loopover-leaderboards/src/modules/core/components/Nav.css.d.ts
vendored
Normal file
3
typescript/loopover-leaderboards/src/modules/core/components/Nav.css.d.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
// This file is automatically generated from your CSS. Any edits will be overwritten.
|
||||||
|
export const link: string;
|
||||||
|
export const activeLink: string;
|
|
@ -0,0 +1,42 @@
|
||||||
|
import { Block, Row } from "jsxstyle";
|
||||||
|
import { h } from "preact";
|
||||||
|
import { Link } from "preact-router/match";
|
||||||
|
import styles from "./Nav.css";
|
||||||
|
|
||||||
|
interface Route {
|
||||||
|
url: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const routes: Route[] = [
|
||||||
|
{
|
||||||
|
url: "/",
|
||||||
|
name: "Home"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: "/leaderboards",
|
||||||
|
name: "Leaderboards"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: "/play",
|
||||||
|
name: "Play"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
export const Nav = () => {
|
||||||
|
return (
|
||||||
|
<Row background="rgba(0,0,0, 0.3)">
|
||||||
|
{routes.map(route => (
|
||||||
|
// We cannot style this directly, so I'm using classes
|
||||||
|
<Link
|
||||||
|
key={route.url}
|
||||||
|
href={route.url}
|
||||||
|
class={styles.link}
|
||||||
|
activeClassName={styles.activeLink}
|
||||||
|
>
|
||||||
|
{route.name}
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</Row>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in a new issue