Skip to content

Commit

Permalink
Merge pull request #6 from Valimp/darkmode
Browse files Browse the repository at this point in the history
feat: darkmode
  • Loading branch information
Valimp authored Apr 5, 2024
2 parents ef5e59e + d1a86a2 commit de08da7
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Valimp | Développeur</title>
</head>
<body class="bg-white-default">
<body class="bg-white-default dark:bg-gray-dark">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function App() {
return (
<PageLayout>
<Routes>
<Route path='/' element={<Homepage />} />
<Route path='/' element={<Homepage/>} />
</Routes>
</PageLayout>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ReactNode } from 'react'
const Card = ({children, url}: {children: ReactNode, url: string}) => {

return (
<a target='_blank' href={url} className='bg-gray-light hover:bg-gray-light/60 shadow-lg rounded-lg p-5 duration-300 flex flex-col justify-center items-start'>
<a target='_blank' href={url} className='bg-gray-light hover:bg-gray-light/60 dark:bg-gray-dark dark:hover:bg-gray-dark/60 shadow-lg rounded-lg p-5 duration-300 flex flex-col justify-center items-start'>
{children}
</a>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import TextButton from "./TextButton"

const Navbar = (props: any) => {
return (
<header className="h-16 w-full shadow backdrop-blur-lg bg-opacity-70 bg-white-default sticky top-0 flex justify-center items-center gap-5">
<header className="h-16 w-full shadow backdrop-blur-lg bg-opacity-70 dark:bg-opacity-70 bg-white-default dark:bg-gray-dark sticky top-0 flex justify-center items-center gap-5">
<a href="/">
<img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Animals/Beetle.png" alt="Beetle" width="25" height="25" />
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface TitleProps {

const Title = ({children}: TitleProps) => {
return (
<h3 className="font-extrabold text-2xl my-5 inline-block text-gray-dark mb-6">
<h3 className="font-extrabold text-2xl my-5 inline-block text-gray-dark dark:text-gray-light mb-6">
{children}
<span className="block max-w-0 group-hover:max-w-full transition-all duration-500 h-[3px] bg-gradient-to-r from-green-default to-green-dark rounded"></span>
</h3>
Expand Down
32 changes: 26 additions & 6 deletions src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useState } from 'react'

import Article from '../components/Article'
import Title from '../components/Title'
import Image from '../components/Image'
Expand All @@ -7,13 +9,31 @@ import Badge from '../components/Badge'
import { FaLinkedin } from "react-icons/fa";
import { FaGithub } from "react-icons/fa";
import { IoIosMail } from "react-icons/io";
import { IoIosSunny } from "react-icons/io";
import { IoMdMoon } from "react-icons/io";

const HomePage = () => {

const [darkMode, setDarkMode] = useState(false)

const toggleDarkMode = () => {
const html = document.documentElement;
html.classList.toggle('dark');
setDarkMode(!darkMode)
}

return (
<>
<div className={`${darkMode ? "dark" : "light"}`}>
<button onClick={toggleDarkMode} className={`hover:animate-spin-slow fixed bottom-5 right-5 p-1 border-[1.5px] rounded-full ${darkMode ? "border-white-default" : "border-gray-dark"}`}>
{ darkMode ?
<IoIosSunny size={25} className='text-white-default'/>
:
<IoMdMoon size={25} className='text-gray-dark'/>
}
</button>
<div className="w-full h-[250px] self-center bg-cover bg-center" style={{ backgroundImage: "url(/forest.jpg)" }}></div>
<span className="sm:text-4xl text-2xl mt-8 text-gray-default">Bonjour ! Je suis</span>
<h2 className="sm:text-5xl text-3xl mt-8 font-extrabold text-gray-dark">Valentin Chauvet</h2>
<h2 className="sm:text-5xl text-3xl mt-8 font-extrabold text-gray-dark dark:text-gray-light">Valentin Chauvet</h2>
<h3 className="sm:text-4xl text-2xl mt-8 font-black bg-gradient-to-r from-green-default to-green-dark inline-block bg-clip-text text-transparent">un développeur web éco-responsable</h3>
<img className="self-center mt-10" src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/People%20with%20professions/Man%20Technologist%20Light%20Skin%20Tone.png" alt="Man Technologist Light Skin Tone" width="175" height="175" />
<Article id="about">
Expand Down Expand Up @@ -44,17 +64,17 @@ const HomePage = () => {
<div className='grid lg:grid-cols-2 grid-cols-1 gap-5'>
<Card url='https://github.com/Valimp/vite-react-ts'>
<Image src='/project1.jpg' alt="project1" width="400" height="250" />
<h3 className='text-gray-dark mt-3 text-xl font-bold'>Mon portfolio</h3>
<h3 className='text-gray-dark dark:text-gray-light mt-3 text-xl font-bold'>Mon portfolio</h3>
<p className='text-gray-default mt-2'>Vous y êtes ! Il est beau n'est ce pas ? Restez autant que vous le voudrez.</p>
</Card>
<Card url='https://github.com/openfoodfacts/nutripatrol-frontend'>
<Image src='/project2.jpg' alt="project2" width="400" height="250" />
<h3 className='text-gray-dark mt-3 text-xl font-bold'>L'interface Nutripatrol</h3>
<h3 className='text-gray-dark dark:text-gray-light mt-3 text-xl font-bold'>L'interface Nutripatrol</h3>
<p className='text-gray-default mt-2'>Une interface de moderation de tickets. Et opensource s'il vous plait !</p>
</Card>
<Card url='https://github.com/openfoodfacts/nutripatrol'>
<Image src='/project3.jpg' alt="project3" width="400" height="250"/>
<h3 className='text-gray-dark mt-3 text-xl font-bold'>L' API Nutripatrol</h3>
<h3 className='text-gray-dark dark:text-gray-light mt-3 text-xl font-bold'>L' API Nutripatrol</h3>
<p className='text-gray-default mt-2'>J'avais dis développeur fullstack, alors je développe aussi des APIs.</p>
</Card>
</div>
Expand All @@ -73,7 +93,7 @@ const HomePage = () => {
</Badge>
</div>
</Article>
</>
</div>
)
}

Expand Down
7 changes: 6 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ export default {
fontFamily: {
poppins: ['Poppins', 'sans-serif'],
},
extend: {},
extend: {
animation: {
'spin-slow': 'spin 3s linear infinite',
}
},
},
plugins: [],
darkMode: 'class',
}

0 comments on commit de08da7

Please sign in to comment.