Skip to content

Commit

Permalink
fix darkmode theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Neofox committed Jun 29, 2023
1 parent 1e7b7f8 commit cf9956a
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 59 deletions.
12 changes: 12 additions & 0 deletions app/Providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use client";
import { ThemeProvider } from "next-themes";

const Providers = ({ children }: { children: React.ReactNode }) => {
return (
<ThemeProvider enableSystem={true} attribute="class">
{children}
</ThemeProvider>
);
};

export default Providers;
35 changes: 17 additions & 18 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@
@tailwind utilities;

:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
@media (prefers-color-scheme: light) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
color: #213547;
background-color: #ffffff;
}
}

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
}
9 changes: 9 additions & 0 deletions app/head.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function Head() {
return (
<>
<title>Jerome Schaeffer Resume</title>
<meta content="width=device-width, initial-scale=1" name="viewport" />
<link rel="icon" href="/favicon.ico" />
</>
);
}
38 changes: 21 additions & 17 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import './globals.css'
import { Inter } from 'next/font/google'
"use client";

const inter = Inter({ subsets: ['latin'] })
import "./globals.css";
import { Inter } from "next/font/google";
import Head from "./head";
import Providers from "./Providers";

export const metadata = {
title: 'Jerome Schaeffer',
description: 'Resume of Jerome Schaeffer',
}
const inter = Inter({ subsets: ["latin"] });

// export const metadata = {
// title: "Jerome Schaeffer",
// description: "Resume of Jerome Schaeffer",
// };

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" className="h-full scroll-smooth" suppressHydrationWarning>
<Head />

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
)
<body className={inter.className}>
<Providers>{children}</Providers>
</body>
</html>
);
}
2 changes: 1 addition & 1 deletion components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Header: React.FC = () => (
width={200}
height={200}
/>
<div className="mt-10 self-center text-3xl">Jerome Schaeffer</div>
<div className=" mt-10 self-center text-3xl text-gray-900 dark:text-white">Jerome Schaeffer</div>
<div className="mt-2 self-center text-xl text-gray-400 drop-shadow-sm">Senior Web Developer</div>

<div className="mt-8 self-center">
Expand Down
2 changes: 1 addition & 1 deletion components/Information.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Information: React.FC = () => (
})}
{informations.map((info, i) => {
return (
<div key={i} className="w-36 py-2 font-semibold">
<div key={i} className=" text-gray-900 dark:text-white w-36 py-2 font-semibold">
{info.value}
</div>
);
Expand Down
8 changes: 2 additions & 6 deletions components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useState } from "react";
import Availability from "./Utils/Availability";
import { MdModeNight, MdLightMode } from "react-icons/md";
import DarkModeButton from "./Utils/DarkModeButton";

const languages: { flag: string; name: string; code: string }[] = [
{ flag: "🇺🇸", name: "English", code: "en" },
Expand Down Expand Up @@ -31,12 +32,7 @@ const Navbar: React.FC = () => {
<span className="ml-2 hidden md:inline">{languages[0].name}</span>
</button>

<button
type="button"
className="mr-2 inline-flex items-center rounded-lg p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
>
<MdModeNight className="h-10 w-10 rounded-full border p-1" />
</button>
<DarkModeButton />
</div>
</div>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion components/Utils/Block.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Block: React.FC<{ children: React.ReactNode }> = ({ children }) => {
return (
<div className="flex flex-col rounded-2xl bg-transparent p-5 shadow-lg backdrop-blur-md transition-all hover:shadow-2xl md:h-full md:p-6 xl:p-8 2xl:p-12">
<div className="text-gray-900 dark:text-white flex flex-col rounded-2xl bg-transparent p-5 shadow-lg backdrop-blur-md transition-all hover:shadow-2xl md:h-full md:p-6 xl:p-8 2xl:p-12">
{children}
</div>
);
Expand Down
25 changes: 25 additions & 0 deletions components/Utils/DarkModeButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use client";

import { useTheme } from "next-themes";
import { MdLightMode, MdModeNight } from "react-icons/md";

const DarkModeButton: React.FC = () => {
const { systemTheme, theme, setTheme } = useTheme();
const currentTheme = theme === "system" ? systemTheme : theme;

return (
<button
type="button"
onClick={() => (currentTheme == "dark" ? setTheme("light") : setTheme("dark"))}
className="mr-2 inline-flex items-center rounded-lg p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
>
{currentTheme == "dark" ? (
<MdLightMode className="h-10 w-10 rounded-full border p-1" />
) : (
<MdModeNight className="h-10 w-10 rounded-full border p-1" />
)}
</button>
);
};

export default DarkModeButton;
30 changes: 15 additions & 15 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
},
darkMode: "class",
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
backgroundImage: {
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic": "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
},
},
plugins: [],
}
plugins: [],
};
7 changes: 7 additions & 0 deletions types/Education.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type EducationType = {
begin: Date;
end?: Date;
name: string;
schoolName: string;
description?: string;
}
8 changes: 8 additions & 0 deletions types/Experience.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type ExperienceType = {
begin: Date;
end?: Date;
jobTitle: string;
companyName: string;
location: string;
description?: string;
}
8 changes: 8 additions & 0 deletions types/Project.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type ProjectType = {
begin: Date;
name: string;
type: string;
description?: string;
link: string,
technologies: string[]
}

0 comments on commit cf9956a

Please sign in to comment.