Skip to content

Commit

Permalink
feat(apps/earth): adds root page and implements daisyui
Browse files Browse the repository at this point in the history
  • Loading branch information
deopea-david committed Feb 1, 2023
1 parent 49ba582 commit 9e92668
Show file tree
Hide file tree
Showing 17 changed files with 349 additions and 93 deletions.
3 changes: 2 additions & 1 deletion apps/earth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1",
"autoprefixer": "10.4.11",
"autoprefixer": "^10.4.11",
"daisyui": "^2.50.0",
"eslint": "^8.31.0",
"eslint-plugin-qwik": "^0.16.2",
"espree": "^9.4.1",
Expand Down
40 changes: 31 additions & 9 deletions apps/earth/src/components/button/BaseButton.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
import { ClassSlot, component$, HTMLAttributes, Slot } from "@builder.io/qwik";
import {
ClassSlot,
component$,
HTMLAttributes,
Slot,
useSignal,
} from "@builder.io/qwik";

export interface BaseButtonProps extends HTMLAttributes<HTMLButtonElement> {
class?: ClassSlot;
color?: "primary" | "secondary" | "accent";
size?: "xs" | "sm" | "md" | "lg";
}

export const BaseButton = component$<BaseButtonProps>((props) => {
return (
<button {...props} class={["py-2 px-3", props.class]}>
<span>
export const BaseButton = component$<BaseButtonProps>(
({ color = "primary", size = "md", ...props }) => {
const classes = useSignal({
primary: "btn-primary",
secondary: "btn-secondary",
accent: "btn-accent",

xs: "btn-xs",
sm: "btn-sm",
md: "btn-md",
lg: "btn-lg",
});

return (
<button
{...props}
class={["btn", classes.value[color], classes.value[size], props.class]}
>
<Slot />
</span>
</button>
);
});
</button>
);
},
);

export default BaseButton;
25 changes: 25 additions & 0 deletions apps/earth/src/components/button/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { component$, Slot, useSignal } from "@builder.io/qwik";
import { BaseButton, BaseButtonProps } from "./BaseButton";

export interface ButtonProps extends BaseButtonProps {
variant?: "contained" | "outlined" | "ghost";
}

export const Button = component$<ButtonProps>(
({ variant = "contained", ...props }) => {
const classes = useSignal({
contained: undefined,
outlined: "btn-outlined",
ghost: "btn-ghost",
});

return (
<BaseButton
{...props}
class={["btn", classes.value[variant], props.class]}
>
<Slot />
</BaseButton>
);
},
);
24 changes: 24 additions & 0 deletions apps/earth/src/components/button/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { component$, Slot, useSignal } from "@builder.io/qwik/core";
import { BaseButton, BaseButtonProps } from "./BaseButton";

export interface IconButtonProps extends BaseButtonProps {
variant?: "circle" | "square";
}

export const IconButton = component$<IconButtonProps>(
({ variant = "circle", ...props }) => {
const classes = useSignal({
circle: "btn-circle",
square: "btn-square",
});

return (
<BaseButton
{...props}
class={["btn", classes.value[variant], props.class]}
>
<Slot />
</BaseButton>
);
},
);
2 changes: 1 addition & 1 deletion apps/earth/src/components/button/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./BaseButton";
export * from "./Button";
4 changes: 1 addition & 3 deletions apps/earth/src/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { component$ } from "@builder.io/qwik";

export const Footer = component$(() => {
return (
<footer>
<footer class="prose prose-sm py-4 px-8 font-mono">
<a href="/">Made with ♡ by Deopea</a>
</footer>
);
});

export default Footer;
2 changes: 0 additions & 2 deletions apps/earth/src/components/head/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ export const Head = component$(() => {
</head>
);
});

export default Head;
30 changes: 15 additions & 15 deletions apps/earth/src/components/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { component$ } from "@builder.io/qwik";
import { useNavigate } from "@builder.io/qwik-city";
import { BaseButton } from "components/button";
import { Button } from "components/button";
import { Link } from "components/link";
import { LinkButton } from "components/link/LinkButton";

export const Header = component$(() => {
const navigate = useNavigate();
return (
<header class="p-2 flex">
<div class="flex-1">
<a onClick$={() => navigate("/")} href="/">
<header class="navbar flex py-4 px-8 font-mono">
<div class="navbar-start">
<Link class="font-mono uppercase" href="/">
deopea
</a>
</Link>
</div>
<nav class="flex justify-between space-x-2">
<a>What we do</a>
<a>About Us</a>
<a>The Team</a>
<nav class="navbar-center hidden md:block">
<LinkButton class="btn-sm">What we do</LinkButton>
<LinkButton class="btn-sm">About Us</LinkButton>
<LinkButton class="btn-sm">The Team</LinkButton>
</nav>
<div class="flex-1 flex justify-end">
<BaseButton>Contact Us</BaseButton>
<div class="navbar-end">
<Button variant="outlined" size="sm">
Contact Us
</Button>
</div>
</header>
);
});

export default Header;
17 changes: 17 additions & 0 deletions apps/earth/src/components/link/Link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ClassSlot, component$, Slot } from "@builder.io/qwik";
import {
Link as QCLink,
LinkProps as QCLinkProps,
} from "@builder.io/qwik-city";

export interface LinkProps extends QCLinkProps {
class?: ClassSlot;
}

export const Link = component$<LinkProps>((props) => {
return (
<QCLink {...props} class={["link link-hover", props.class]}>
<Slot />
</QCLink>
);
});
14 changes: 14 additions & 0 deletions apps/earth/src/components/link/LinkButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ClassSlot, component$, Slot } from "@builder.io/qwik";
import { Link, LinkProps } from "@builder.io/qwik-city";

export interface LinkButtonProps extends LinkProps {
class?: ClassSlot;
}

export const LinkButton = component$<LinkButtonProps>((props) => {
return (
<Link {...props} class={["btn btn-ghost", props.class]}>
<Slot />
</Link>
);
});
1 change: 1 addition & 0 deletions apps/earth/src/components/link/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./Link";
1 change: 1 addition & 0 deletions apps/earth/src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* the styles in here will be applied to the Document, without any sort of CSS scoping.
*
*/

@tailwind base;
@tailwind components;
@tailwind utilities;
Expand Down
2 changes: 1 addition & 1 deletion apps/earth/src/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
RouterOutlet,
ServiceWorkerRegister,
} from "@builder.io/qwik-city";
import Head from "components/head/Head";
import { Head } from "components/head";
import globalStyles from "./global.css?inline";

export default component$(() => {
Expand Down
4 changes: 2 additions & 2 deletions apps/earth/src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { DocumentHead } from "@builder.io/qwik-city";

export default component$(() => {
return (
<div>
<h1 class="prose prose-h1">Welcome to Deopea!</h1>
<div class="mx-8 min-h-screen md:container md:mx-auto md:px-8">
<div class="hero"></div>
</div>
);
});
Expand Down
6 changes: 2 additions & 4 deletions apps/earth/src/routes/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import { Header } from "components/header";
export default component$(() => {
return (
<>
<Header />
<main>
<Header />
<section>
<Slot />
</section>
<Slot />
</main>
<Footer />
</>
Expand Down
90 changes: 51 additions & 39 deletions apps/earth/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -1,55 +1,67 @@
const defaultTheme = require("tailwindcss/defaultTheme");
const typographyPlugin = require("@tailwindcss/typography");

/**
* @type {import('tailwindcss').Config}
*/
module.exports = {
content: ["./src/**/*.{ts,tsx,mdx}"],
plugins: [typographyPlugin],
plugins: [require("@tailwindcss/typography"), require("daisyui")],
daisyui: {
themes: [
{
deopea: {
"primary": "#0EA3F4",
"secondary": "#FB2576",
"accent": "#3F0071",
"base-100": "#010101",
"error": "#93000A",
},
},
],
},
theme: {
extend: {
fontFamily: {
mono: ["Space Mono", ...defaultTheme.fontFamily.mono],
sans: ["Quicksand", ...defaultTheme.fontFamily.sans],
},
colors: {
primary: {
"default": "#ffb3af",
"fg": "#660710",
"container": "#852123",
"container-fg": "#ffdad7",
},
secondary: {
"default": "#e7bdba",
"fg": "#442928",
"container": "#5d3f3d",
"container-fg": "#ffdad7",
},
tertiary: {
"default": "#e2c28c",
"fg": "#402d05",
"container": "#594319",
"container-fg": "#ffdea8",
},
error: {
"default": "#ffb4ab",
"fg": "#93000a",
"container": "#690005",
"container-fg": "#ffdad6",
},
bg: {
default: "#201a1a",
fg: "#ede0de",
},
surface: {
"default": "#201a1a",
"fg": "#ede0de",
"variant": "#534342",
"variant-fg": "#d8c2c0",
},
outline: "#a08c8b",
},
// colors: {
// primary: {
// "default": "#ffb3af",
// "fg": "#660710",
// "container": "#852123",
// "container-fg": "#ffdad7",
// },
// secondary: {
// "default": "#e7bdba",
// "fg": "#442928",
// "container": "#5d3f3d",
// "container-fg": "#ffdad7",
// },
// tertiary: {
// "default": "#e2c28c",
// "fg": "#402d05",
// "container": "#594319",
// "container-fg": "#ffdea8",
// },
// error: {
// "default": "#ffb4ab",
// "fg": "#93000a",
// "container": "#690005",
// "container-fg": "#ffdad6",
// },
// bg: {
// default: "#201a1a",
// fg: "#ede0de",
// },
// surface: {
// "default": "#201a1a",
// "fg": "#ede0de",
// "variant": "#534342",
// "variant-fg": "#d8c2c0",
// },
// outline: "#a08c8b",
// },
},
},
};
Loading

0 comments on commit 9e92668

Please sign in to comment.