Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💄 feat: implement frontend #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { h, tw } from "../deps.ts";

const NavBar = (
props: {
size?: "small" | "large";
theme?: "light" | "dark";
},
) => {
const { size = "large", theme = "light" } = props;
let bgColor, textColor, padding, imageSize, textSize;
if (theme === "light") {
bgColor = "bg-white";
textColor = "text-black";
} else {
bgColor = "bg-black";
textColor = "text-white";
}
if (size === "small") {
padding = "p-5";
imageSize = "h-16";
textSize = "text-4xl";
} else {
padding = "p-6";
imageSize = "h-20";
textSize = "text-5xl";
}

return (
<div class={tw`flex items-center gap-4 ${padding} ${bgColor} ${textColor}`}>
<img src="" class={tw`flex-initial aspect-square ${imageSize}`} />
<p
class={tw`text-6xl font-bold ${
size === "small"
? "none"
: null
}`}
>
Harmony{" "}
</p>
<p
class={tw`${textSize}`}
>
by Example
</p>
</div>
);
};

export default NavBar;
Binary file added images/harmony.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import { h, html, Page, ssr, tw } from "./common.ts";
import { examples, parseExample } from "../examples/mod.ts";
import NavBar from "../components/navbar.tsx";

let cached: string | null;

function Index() {
return ssr(() => [
<title>Harmony by Example</title>,
<div class={tw`bg-white flex h-screen`}>
<div class={tw`bg-white flex h-screen flex-column`}>
<NavBar />
<h1 class={tw`text-5xl text-gray-600 m-auto mt-20`}>
Harmony by Example
</h1>
Expand Down