Skip to content

Commit 973af6a

Browse files
author
Darío Espinoza
committed
feat: Add Header component and implement dark mode support across various components
1 parent 896ff68 commit 973af6a

6 files changed

Lines changed: 20 additions & 13 deletions

File tree

components/Header.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import ButtonPrint from "../islands/ButtonPrint.tsx";
21
import DarkMode from "../islands/DarkMode.tsx";
32
export default function Header() {
43
return (
54
<header class="min-w-min px-4 py-2 rounded-lg max-w-min mx-auto flex gap-4 items-center bg-slate-200/50 left-1/2 -translate-x-1/2 fixed bottom-4 md:sticky md:top-4 z-50 backdrop-blur-md dark:bg-slate-800/50 print:hidden">
6-
<ButtonPrint />
75
<a
86
href="https://github.com/darioesp"
97
target="_blank"

components/WrapperPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ interface ParentComponentProps {
44
readonly children: preact.ComponentChildren;
55
}
66
export default function WrapperPage({attrClass, children}: ParentComponentProps ) {
7-
const valueClass = attrClass ? `${attrClass} relative bg-white px-4 md:px-12 rounded-sm container max-w-[21cm] min-h-[29.7cm] mx-auto py-16 aspect-[210mm 297mm] select-none z-10 print:h-auto print:py-0 print:mt-0 mt-5 [&:has(.decorator-bl, .decorator-br)~div>.decorator-tl]:bg-red-100` : 'relative bg-white px-4 md:px-12 rounded-sm container max-w-[22cm] min-h-[29.7cm] mx-auto py-16 aspect-[210mm 297mm] select-none z-10 mt-5';
7+
const valueClass = attrClass ? `${attrClass} relative bg-white dark:bg-slate-800 px-4 md:px-12 rounded-sm container max-w-[21cm] min-h-[29.7cm] mx-auto py-16 aspect-[210mm 297mm] select-none z-10 print:h-auto print:py-0 print:mt-0 mt-5 [&:has(.decorator-bl, .decorator-br)~div>.decorator-tl]:bg-red-100` : 'relative bg-white dark:bg-slate-800 px-4 md:px-12 rounded-sm container max-w-[22cm] min-h-[29.7cm] mx-auto py-16 aspect-[210mm 297mm] select-none z-10 mt-5';
88
return (
99
<div class={valueClass}>
1010
{children}

routes/[lang]/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { PageProps } from "$fresh/server.ts";
22
import Footer from "../../components/Footer.tsx";
3+
import Header from "../../components/Header.tsx";
34
import SectionWrapperContent from "../../components/SectionWrapperContent.tsx";
45
import WrapperPage from "../../components/WrapperPage.tsx";
56
import translations from "../../locales/es.json" with { type: "json" };
@@ -12,7 +13,7 @@ export default function Home({ state }: PageProps<State>) {
1213
const { lang: _lang, translations } = state;
1314
return (
1415
<>
15-
{/* <Header /> */}
16+
<Header />
1617
<div class="relative mx-4 md:mx-10 font-roboto-mono">
1718
<WrapperPage attrClass="">
1819
<div class="border-b pb-3 flex justify-end items-center gap-x-2 text-sm">
@@ -28,7 +29,7 @@ export default function Home({ state }: PageProps<State>) {
2829
<h3 class="font-bold text-base mt-5">
2930
{section.title}
3031
</h3>
31-
<ul class="ml-6 list-disc col-span-full text-slate-800/90 text-pretty text-sm">
32+
<ul class="ml-6 list-disc col-span-full text-slate-800/90 dark:text-slate-200/80 text-pretty text-sm">
3233
{
3334
section.items.map((item, index) => (
3435
<li key={index}>

routes/_404.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
import { Head } from "$fresh/runtime.ts";
22
import { pageProps } from "$fresh/server.ts";
3-
export default function Error404({message}: pageProps<{message: string}>) {
3+
export default function Error404({ message }: pageProps<{ message: string }>) {
44
return (
55
<>
66
<Head>
77
<title>404 - ¡Creo que andas perdido!</title>
88
</Head>
9-
<section class="grid place-content-center h-screen w-screen bg-white py-4 px-5 md:py-10 md:px-12">
9+
<section class="grid place-content-center h-screen w-screen bg-white dark:bg-slate-800 py-4 px-5 md:py-10 md:px-12">
1010
<div class="flex flex-col items-center gap-5">
1111
<h1 class="text-center flex flex-col items-center gap-2">
12-
<span class="text-4xl md:text-6xl font-bold">Wow 🧉</span> ¡Creo que andas perdido!
12+
<span class="text-4xl md:text-6xl font-bold">Wow 🧉</span>{" "}
13+
¡Creo que andas perdido!
1314
</h1>
14-
<a href="/" class="flex justify-center items-center px-3 py-1.5 bg-black/5 border border-[#ddd] rounded-md backdrop-blur-sm">
15+
<a
16+
href="/"
17+
class="flex justify-center items-center px-3 py-1.5 bg-black/5 dark:bg-black/95 border border-[#ddd] dark:border-black rounded-md backdrop-blur-sm"
18+
>
1519
Regresar a Vibe Coding
1620
</a>
17-
<a href="https://github.com/darioesp/vide-coding" class="flex justify-center items-center px-3 py-1.5 bg-black/5 border border-[#ddd] rounded-md backdrop-blur-sm">
21+
<a
22+
href="https://github.com/darioesp/vide-coding"
23+
class="flex justify-center items-center px-3 py-1.5 bg-black/5 dark:bg-black/95 border border-[#ddd] dark:border-black rounded-md backdrop-blur-sm"
24+
>
1825
ir al repositorio
1926
</a>
2027
</div>

routes/_app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default async function App(
2525
</title>
2626
<link rel="stylesheet" href="/styles.css" />
2727
</head>
28-
<body class="bg-[#f9f9f9] text-[#444444]">
28+
<body class="bg-[#f9f9f9] text-[#444444] dark:bg-[#0C0C0C] dark:text-[#f9f9f9]">
2929
<ctx.Component />
3030
</body>
3131
</html>

routes/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { PageProps } from "$fresh/server.ts";
22
import Footer from "../components/Footer.tsx";
3+
import Header from "../components/Header.tsx";
34
import SectionWrapperContent from "../components/SectionWrapperContent.tsx";
45
import WrapperPage from "../components/WrapperPage.tsx";
56
import translations from "../locales/es.json" with { type: "json" };
@@ -12,7 +13,7 @@ export default function Home({ state }: PageProps<State>) {
1213
const { lang, translations } = state;
1314
return (
1415
<>
15-
{/* <Header /> */}
16+
<Header />
1617
<div class="relative mx-4 md:mx-10 font-roboto-mono">
1718
<WrapperPage attrClass="">
1819
<div class="border-b pb-3 flex justify-end items-center gap-x-2 text-sm">
@@ -27,7 +28,7 @@ export default function Home({ state }: PageProps<State>) {
2728
<h3 class="font-bold text-base mt-5">
2829
{section.title}
2930
</h3>
30-
<ul class="ml-6 list-disc col-span-full text-slate-800/90 text-pretty text-sm">
31+
<ul class="ml-6 list-disc col-span-full text-slate-800/90 dark:text-slate-200/80 text-pretty text-sm">
3132
{section.items.map((item, index) => (
3233
<li key={index}>
3334
<div

0 commit comments

Comments
 (0)