Skip to content

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JustYuuto committed Oct 25, 2024
1 parent a78157b commit 0b387af
Show file tree
Hide file tree
Showing 16 changed files with 181 additions and 160 deletions.
19 changes: 12 additions & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import tailwind from 'eslint-plugin-tailwindcss';

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
files: ['**/*.{js,ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
Expand All @@ -23,6 +24,10 @@ export default tseslint.config(
'warn',
{ allowConstantExport: true },
],
quotes: ['error', 'single'],
semi: ['error', 'always'],
indent: ['error', 2, { SwitchCase: 1 }],
},
},
)
...tailwind.configs['flat/recommended']
);
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>Yuuto</title>
<link rel="preload" as="fetch" href="https://api.lanyard.rest/v1/users/269415459735076864">
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:[email protected]&display=swap" rel="stylesheet">
</head>
<body>
<div id="root"></div>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"eslint-plugin-tailwindcss": "^3.17.5",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
Expand Down
1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

42 changes: 0 additions & 42 deletions src/App.css

This file was deleted.

45 changes: 18 additions & 27 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import Header from './components/Header.tsx';
import MainSection from './components/MainSection.tsx';
import {useEffect, useState} from 'react';
import Loading from './components/Loading.tsx';

function App() {
const [count, setCount] = useState(0)
const [user, setUser] = useState(null);
useEffect(() => {
fetch('https://api.lanyard.rest/v1/users/269415459735076864')
.then(res => res.json())
.then(data => {
setUser(data.data);
});
}, []);

return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
{!user ? <Loading /> : <>
<Header />
<MainSection user={user} />
</>}
</>
)
);
}

export default App
export default App;
1 change: 0 additions & 1 deletion src/assets/react.svg

This file was deleted.

38 changes: 38 additions & 0 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export default function Header() {
const links = [
{
name: 'Projects',
url: '#projects'
},
{
name: 'Contact',
url: '#contact'
}
];

return (
<header className="absolute inset-x-0 top-0 flex items-center justify-between px-8 py-4">
<div>
<span role="link" className="cursor-pointer text-2xl font-bold" onClick={() => {
scroll(0, 0);
}}>
Yuuto
<span className="text-base text-gray-500">.dev</span>
</span>
</div>
<div>
<nav>
<ul className="flex space-x-6">
{links.map(link => (
<li key={link.url}>
<a href={link.url} className="text-gray-100 duration-150 hover:text-gray-400">
{link.name}
</a>
</li>
))}
</ul>
</nav>
</div>
</header>
);
}
29 changes: 29 additions & 0 deletions src/components/Loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {useEffect, useState} from 'react';

export default function Loading() {
const [dots, setDots] = useState<number>(0);

useEffect(() => {
const interval = setInterval(() => {
setDots(prev => {
if (prev === 3) {
return 1;
} else {
return prev + 1;
}
});
}, 500);

return () => clearInterval(interval);
}, []);

return (
<div className="absolute inset-0 z-50 bg-black">
<div className="flex h-screen items-center justify-center">
<div className="text-4xl font-bold text-white">
{'.'.repeat(dots)}
</div>
</div>
</div>
);
}
17 changes: 17 additions & 0 deletions src/components/MainSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default function MainSection({ user }: { user: LanyardUser }) {
return (
<section id="main">
<div className="flex h-screen flex-col items-center justify-center text-center">
<div className="max-w-lg space-y-4">
<img src={
`https://cdn.discordapp.com/avatars/${user.discord_user.id}/${user.discord_user.avatar}.png?size=256`
} alt="Avatar" className="mx-auto mb-8 size-32 rounded-full" draggable={false} />
<h1 className="text-4xl font-bold">Hi! I'm Yuuto</h1>
<p>
I'm a 17 yo developer from France.
</p>
</div>
</div>
</section>
);
}
78 changes: 13 additions & 65 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,68 +1,16 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
@tailwind base;
@tailwind components;
@tailwind utilities;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
@layer base {
*, ::before, ::after {
scroll-behavior: smooth;
}

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

a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}

body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}

h1 {
font-size: 3.2em;
line-height: 1.1;
}

button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}

@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
body {
background-image: linear-gradient(45deg, #0A0F29 0%, #1B2A41 100%);
background-repeat: no-repeat;
background-attachment: fixed;
color: theme(colors.white);
}
}
10 changes: 5 additions & 5 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import './index.css';
import App from './App.tsx';

createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
);
10 changes: 10 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
/// <reference types="vite/client" />

interface LanyardUser {
discord_user: {
username: string;
public_flags: number;
id: string;
discriminator: string;
avatar: string;
};
}
23 changes: 19 additions & 4 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
/** @type {import('tailwindcss').Config} */
export default {
content: [],
content: [
'./index.html',
'./src/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {},
extend: {
fontFamily: {
sans: '"Fira Code", sans-serif',
},
animation: {
blink: 'blink 1s linear infinite',
},
keyframes: {
blink: {
'0%, 100%': { opacity: 1 },
'50%': { opacity: 0 },
},
},
},
},
plugins: [],
}

};
10 changes: 6 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';

// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})
plugins: [
react(),
],
});
Loading

0 comments on commit 0b387af

Please sign in to comment.