Initial commit

This commit is contained in:
Théo 2023-02-04 14:20:03 +01:00
parent 47d727b6d4
commit 4ba01a2d98
23 changed files with 972 additions and 789 deletions

0
.env.template Normal file
View file

4
.eslintignore Normal file
View file

@ -0,0 +1,4 @@
**/node_modules/*
**/out/*
**/.next/*
styles/globals.css

View file

@ -1,3 +1,14 @@
{ {
"extends": "next/core-web-vitals" "extends": [
"next/core-web-vitals",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint"],
"rules": {
"@next/next/no-html-link-for-pages": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/consistent-type-imports": "error",
"import/no-anonymous-default-export": "off"
}
} }

3
.gitignore vendored
View file

@ -26,7 +26,8 @@ yarn-error.log*
.pnpm-debug.log* .pnpm-debug.log*
# local env files # local env files
.env*.local .env*
!.env*.template
# vercel # vercel
.vercel .vercel

4
.prettierignore Normal file
View file

@ -0,0 +1,4 @@
node_modules
.next
pnpm-lock.yaml
public

7
.prettierrc Normal file
View file

@ -0,0 +1,7 @@
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none"
}

4
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,4 @@
{
"typescript.tsdk": "node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}

View file

@ -1,38 +1,41 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). # Peer-at Code
## Getting Started Peer-at Code est un site web qui permet d'offrir un parcours amusant qui but de donner lenvie de coder et dapprendre par le jeu.
First, run the development server: ## Installation
---
```bash 1. Installer [Node.js](https://nodejs.org/en/download/) (v14.15.4 ou supérieur)
npm run dev
# or
yarn dev
# or
pnpm dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 2. Installer [pnpm](https://pnpm.io/installation)
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. 3. Exécuter `pnpm install` dans le dossier du projet pour installer les dépendances
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. 4. Exécuter `pnpm dev` pour démarrer le serveur de développement
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. Ouvre [http://localhost:3000](http://localhost:3000) avec ton navigateur pour accéder au site.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. ## Déploiement
---
## Learn More 1. Exécuter `pnpm build` pour générer le site
To learn more about Next.js, take a look at the following resources: 2. Exécuter `pnpm start` pour démarrer le serveur de production
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. Ouvre [http://localhost:3000](http://localhost:3000) avec ton navigateur pour accéder au site.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! ## Contribution
---
## Deploy on Vercel C'est un projet open-source, donc n'hésite pas à contribuer ! Voici quelques conseils pour contribuer :
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 1. Crée une branche pour tes modifications
2. Fais tes modifications
3. Crée une pull-request
Tu peux aussi créer une issue si tu as des questions ou des suggestions.
N'oublie pas de rejoindre le [serveur Discord](https://discord.gg/72vuHcwUkE) pour discuter avec nous !
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

View file

@ -1,107 +0,0 @@
:root {
--max-width: 1100px;
--border-radius: 12px;
--font-mono: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono',
'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro',
'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
--primary-glow: conic-gradient(
from 180deg at 50% 50%,
#16abff33 0deg,
#0885ff33 55deg,
#54d6ff33 120deg,
#0071ff33 160deg,
transparent 360deg
);
--secondary-glow: radial-gradient(
rgba(255, 255, 255, 1),
rgba(255, 255, 255, 0)
);
--tile-start-rgb: 239, 245, 249;
--tile-end-rgb: 228, 232, 233;
--tile-border: conic-gradient(
#00000080,
#00000040,
#00000030,
#00000020,
#00000010,
#00000010,
#00000080
);
--callout-rgb: 238, 240, 241;
--callout-border-rgb: 172, 175, 176;
--card-rgb: 180, 185, 188;
--card-border-rgb: 131, 134, 135;
}
@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
--primary-glow: radial-gradient(rgba(1, 65, 255, 0.4), rgba(1, 65, 255, 0));
--secondary-glow: linear-gradient(
to bottom right,
rgba(1, 65, 255, 0),
rgba(1, 65, 255, 0),
rgba(1, 65, 255, 0.3)
);
--tile-start-rgb: 2, 13, 46;
--tile-end-rgb: 2, 5, 19;
--tile-border: conic-gradient(
#ffffff80,
#ffffff40,
#ffffff30,
#ffffff20,
#ffffff10,
#ffffff10,
#ffffff80
);
--callout-rgb: 20, 20, 20;
--callout-border-rgb: 108, 108, 108;
--card-rgb: 100, 100, 100;
--card-border-rgb: 200, 200, 200;
}
}
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
html,
body {
max-width: 100vw;
overflow-x: hidden;
}
body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
a {
color: inherit;
text-decoration: none;
}
@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
}

View file

@ -1,10 +1,37 @@
import DefaultTags from '@/ui/DefaultTags';
export default function Head() { export default function Head() {
return ( return (
<> <>
<title>Create Next App</title> <DefaultTags />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta name="description" content="Generated by create next app" /> <title>Peer-at Code</title>
<link rel="icon" href="/favicon.ico" />
<meta name="title" content="Peer-at Code" />
<meta
name="description"
content="Peer-at Code a pour but de donner lenvie de coder et dapprendre par le jeu!"
/>
<meta property="og:type" content="website" />
{/* <meta property="og:url" content="https://peer-at-code.be/" /> */}
<meta property="og:title" content="Peer-at Code" />
<meta
property="og:description"
content="Peer-at Code a pour but de donner lenvie de coder et dapprendre par le jeu!"
/>
{/* <meta property="og:image" content="/assets/social.jpg" /> */}
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="https://peet-at-code.be/" />
<meta property="twitter:title" content="Peer-at Code" />
<meta
property="twitter:description"
content="Peer-at Code a pour but de donner lenvie de coder et dapprendre par le jeu!"
/>
{/* <meta property="twitter:image" content="/assets/social.jpg" /> */}
</> </>
) );
} }

View file

@ -1,18 +1,14 @@
import './globals.css' import { cn } from '@/lib/utils';
import '@/styles/globals.css';
import { ReactNode } from 'react';
export default function RootLayout({ export default function RootLayout({ children }: { children: ReactNode }) {
children,
}: {
children: React.ReactNode
}) {
return ( return (
<html lang="en"> <html lang="fr" dir="ltr" className={cn('[color-scheme:dark] scroll-smooth')}>
{/*
<head /> will contain the components returned by the nearest parent
head.tsx. Find out more at https://beta.nextjs.org/docs/api-reference/file-conventions/head
*/}
<head /> <head />
<body>{children}</body> <body className="min-h-screen">
<main>{children}</main>
</body>
</html> </html>
) );
} }

View file

@ -1,271 +0,0 @@
.main {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 6rem;
min-height: 100vh;
}
.description {
display: inherit;
justify-content: inherit;
align-items: inherit;
font-size: 0.85rem;
max-width: var(--max-width);
width: 100%;
z-index: 2;
font-family: var(--font-mono);
}
.description a {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
.description p {
position: relative;
margin: 0;
padding: 1rem;
background-color: rgba(var(--callout-rgb), 0.5);
border: 1px solid rgba(var(--callout-border-rgb), 0.3);
border-radius: var(--border-radius);
}
.code {
font-weight: 700;
font-family: var(--font-mono);
}
.grid {
display: grid;
grid-template-columns: repeat(3, minmax(33%, auto));
width: var(--max-width);
max-width: 100%;
}
.card {
padding: 1rem 1.2rem;
border-radius: var(--border-radius);
background: rgba(var(--card-rgb), 0);
border: 1px solid rgba(var(--card-border-rgb), 0);
transition: background 200ms, border 200ms;
}
.card span {
display: inline-block;
transition: transform 200ms;
}
.card h2 {
font-weight: 600;
margin-bottom: 0.7rem;
}
.card p {
margin: 0;
opacity: 0.6;
font-size: 0.9rem;
line-height: 1.5;
max-width: 34ch;
}
.center {
display: flex;
justify-content: center;
align-items: center;
position: relative;
padding: 4rem 0;
}
.center::before {
background: var(--secondary-glow);
border-radius: 50%;
width: 480px;
height: 360px;
margin-left: -400px;
}
.center::after {
background: var(--primary-glow);
width: 240px;
height: 180px;
z-index: -1;
}
.center::before,
.center::after {
content: '';
left: 50%;
position: absolute;
filter: blur(45px);
transform: translateZ(0);
}
.logo,
.thirteen {
position: relative;
}
.thirteen {
display: flex;
justify-content: center;
align-items: center;
width: 75px;
height: 75px;
padding: 25px 10px;
margin-left: 16px;
transform: translateZ(0);
border-radius: var(--border-radius);
overflow: hidden;
box-shadow: 0px 2px 8px -1px #0000001a;
}
.thirteen::before,
.thirteen::after {
content: '';
position: absolute;
z-index: -1;
}
/* Conic Gradient Animation */
.thirteen::before {
animation: 6s rotate linear infinite;
width: 200%;
height: 200%;
background: var(--tile-border);
}
/* Inner Square */
.thirteen::after {
inset: 0;
padding: 1px;
border-radius: var(--border-radius);
background: linear-gradient(
to bottom right,
rgba(var(--tile-start-rgb), 1),
rgba(var(--tile-end-rgb), 1)
);
background-clip: content-box;
}
/* Enable hover only on non-touch devices */
@media (hover: hover) and (pointer: fine) {
.card:hover {
background: rgba(var(--card-rgb), 0.1);
border: 1px solid rgba(var(--card-border-rgb), 0.15);
}
.card:hover span {
transform: translateX(4px);
}
}
@media (prefers-reduced-motion) {
.thirteen::before {
animation: none;
}
.card:hover span {
transform: none;
}
}
/* Mobile and Tablet */
@media (max-width: 1023px) {
.content {
padding: 4rem;
}
.grid {
grid-template-columns: 1fr;
margin-bottom: 120px;
max-width: 320px;
text-align: center;
}
.card {
padding: 1rem 2.5rem;
}
.card h2 {
margin-bottom: 0.5rem;
}
.center {
padding: 8rem 0 6rem;
}
.center::before {
transform: none;
height: 300px;
}
.description {
font-size: 0.8rem;
}
.description a {
padding: 1rem;
}
.description p,
.description div {
display: flex;
justify-content: center;
position: fixed;
width: 100%;
}
.description p {
align-items: center;
inset: 0 0 auto;
padding: 2rem 1rem 1.4rem;
border-radius: 0;
border: none;
border-bottom: 1px solid rgba(var(--callout-border-rgb), 0.25);
background: linear-gradient(
to bottom,
rgba(var(--background-start-rgb), 1),
rgba(var(--callout-rgb), 0.5)
);
background-clip: padding-box;
backdrop-filter: blur(24px);
}
.description div {
align-items: flex-end;
pointer-events: none;
inset: auto 0 0;
padding: 2rem;
height: 200px;
background: linear-gradient(
to bottom,
transparent 0%,
rgb(var(--background-end-rgb)) 40%
);
z-index: 1;
}
}
@media (prefers-color-scheme: dark) {
.vercelLogo {
filter: invert(1);
}
.logo,
.thirteen img {
filter: invert(1) drop-shadow(0 0 0.3rem #ffffff70);
}
}
@keyframes rotate {
from {
transform: rotate(360deg);
}
to {
transform: rotate(0deg);
}
}

View file

@ -1,91 +1,12 @@
import Image from 'next/image'
import { Inter } from '@next/font/google'
import styles from './page.module.css'
const inter = Inter({ subsets: ['latin'] })
export default function Home() { export default function Home() {
return ( return (
<main className={styles.main}> <div className="flex h-screen w-full">
<div className={styles.description}> <div className="m-auto">
<p> <h1 className="text-4xl font-bold text-center">
Get started by editing&nbsp; Amuse toi avec <span className="rounded-md bg-white text-black p-1 ">Next.js</span> et{' '}
<code className={styles.code}>app/page.tsx</code> <span className="text-blue-500">Tailwindcss</span> !
</p> </h1>
<div>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className={styles.vercelLogo}
width={100}
height={24}
priority
/>
</a>
</div>
</div> </div>
</div>
<div className={styles.center}> );
<Image
className={styles.logo}
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
<div className={styles.thirteen}>
<Image src="/thirteen.svg" alt="13" width={40} height={31} priority />
</div>
</div>
<div className={styles.grid}>
<a
href="https://beta.nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2 className={inter.className}>
Docs <span>-&gt;</span>
</h2>
<p className={inter.className}>
Find in-depth information about Next.js features and API.
</p>
</a>
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2 className={inter.className}>
Templates <span>-&gt;</span>
</h2>
<p className={inter.className}>Explore the Next.js 13 playground.</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2 className={inter.className}>
Deploy <span>-&gt;</span>
</h2>
<p className={inter.className}>
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
</main>
)
} }

14
lib/utils.ts Normal file
View file

@ -0,0 +1,14 @@
import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge';
/**
* Permet de créer une classe Tailwind avec clsx et tailwind-merge
* pour éviter d'avoir des conflits de classes.
*
* @param inputs - Les classes à ajouter à la classe Tailwind.
*
* @returns La classe Tailwind.
*/
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

18
middleware.ts Normal file
View file

@ -0,0 +1,18 @@
import { NextResponse } from 'next/server';
/**
* Permet de créer un middleware Next.js qui sera exécuté avant chaque requête.
*
* @param request - La requête.
*/
export async function middleware() {
const response = NextResponse.next();
return response;
}
export const config = {
matcher: [
// On exclut les routes de l'API, les fichiers statiques, les images, les assets, le favicon et le service worker.
'/((?!api|_next/static|_next/image|assets|favicon|sw.js).*)'
]
};

View file

@ -1,8 +1,8 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
experimental: { experimental: {
appDir: true, appDir: true
}, }
} };
module.exports = nextConfig module.exports = nextConfig;

View file

@ -3,21 +3,39 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev --turbo",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "next lint" "lint": "next lint",
"prettier:format": "prettier --write .",
"prettier:check": "prettier --check \"**/*.{ts,tsx,json}\"",
"eslint:format": "eslint . --ext ts --ext tsx --ext js"
}, },
"dependencies": { "dependencies": {
"@next/font": "13.1.6", "@next/font": "13.1.6",
"@types/node": "18.11.18", "clsx": "^1.2.1",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"eslint": "8.33.0",
"eslint-config-next": "13.1.6",
"next": "13.1.6", "next": "13.1.6",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"swr": "^2.0.3",
"tailwind-merge": "^1.9.0",
"zod": "^3.20.2"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.3",
"@types/node": "18.11.18",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"autoprefixer": "^10.4.13",
"eslint": "8.33.0",
"eslint-config-next": "13.1.6",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"postcss": "^8.4.21",
"prettier": "^2.8.3",
"tailwindcss": "^3.2.4",
"typescript": "4.9.5" "typescript": "4.9.5"
} }
} }

View file

@ -1,13 +0,0 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
type Data = {
name: string
}
export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: 'John Doe' })
}

1031
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

6
postcss.config.js Normal file
View file

@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
};

3
styles/globals.css Normal file
View file

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

12
tailwind.config.js Normal file
View file

@ -0,0 +1,12 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
mode: 'jit',
content: ['./app/**/*.{js,ts,jsx,tsx}', './ui/**/*.{js,ts,jsx,tsx}'],
future: {
hoverOnlyWhenSupported: true
},
theme: {
extend: {}
},
plugins: [require('@tailwindcss/forms')]
};

8
ui/DefaultTags.tsx Normal file
View file

@ -0,0 +1,8 @@
export default function DefaultTags() {
return (
<>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/favicon.ico" rel="shortcut icon" />
</>
);
}