Skip to content

Commit 0068fb0

Browse files
committed
feat: update template versions
1 parent 55debaa commit 0068fb0

16 files changed

+1932
-405
lines changed

.cdmrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
tabs: ["src/App.jsx"]
2-
live-reload-browser: false
1+
tabs: ["src/App.jsx", "src/main.jsx", "src/App.css"]
32
terminals: ["yarn install && yarn dev"]
3+
run-button: yarn dev

.eslintrc.cjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:react/recommended',
7+
'plugin:react/jsx-runtime',
8+
'plugin:react-hooks/recommended',
9+
],
10+
ignorePatterns: ['dist', '.eslintrc.cjs'],
11+
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
12+
settings: { react: { version: '18.2' } },
13+
plugins: ['react-refresh'],
14+
rules: {
15+
'react-refresh/only-export-components': [
16+
'warn',
17+
{ allowConstantExport: true },
18+
],
19+
},
20+
}

.gitignore

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1-
node_modules/
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

index.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>codedamn React Playground</title>
8-
</head>
9-
<body>
10-
<div id="root"></div>
11-
<script type="module" src="/src/index.jsx"></script>
12-
</body>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>React Vite Playground</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
1313
</html>

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
{
2-
"name": "vite-react-starter",
2+
"name": "react-vite",
3+
"private": true,
34
"version": "0.0.0",
5+
"type": "module",
46
"scripts": {
57
"dev": "vite --host --port 1337",
68
"build": "vite build",
9+
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
710
"preview": "vite preview"
811
},
912
"dependencies": {
1013
"react": "^18.2.0",
1114
"react-dom": "^18.2.0"
1215
},
1316
"devDependencies": {
14-
"@vitejs/plugin-react": "^2.0.0",
15-
"vite": "^4.0.0"
17+
"@types/react": "^18.2.15",
18+
"@types/react-dom": "^18.2.7",
19+
"@vitejs/plugin-react": "^4.0.3",
20+
"eslint": "^8.45.0",
21+
"eslint-plugin-react": "^7.32.2",
22+
"eslint-plugin-react-hooks": "^4.6.0",
23+
"eslint-plugin-react-refresh": "^0.4.3",
24+
"vite": "^4.4.5"
1625
}
1726
}

public/favicon.ico

-15 KB
Binary file not shown.

public/logo.svg

Lines changed: 0 additions & 6 deletions
This file was deleted.

public/vite.svg

Lines changed: 1 addition & 0 deletions
Loading

src/App.css

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
1-
.App {
2-
text-align: center;
1+
#root {
2+
max-width: 1280px;
3+
margin: 0 auto;
4+
padding: 2rem;
5+
text-align: center;
36
}
47

5-
.App-logo {
6-
height: 40vmin;
7-
pointer-events: none;
8+
.logo {
9+
height: 6em;
10+
padding: 1.5em;
11+
will-change: filter;
12+
transition: filter 300ms;
13+
}
14+
.logo:hover {
15+
filter: drop-shadow(0 0 2em #646cffaa);
16+
}
17+
.logo.react:hover {
18+
filter: drop-shadow(0 0 2em #61dafbaa);
819
}
920

10-
@media (prefers-reduced-motion: no-preference) {
11-
.App-logo {
12-
animation: App-logo-spin infinite 20s linear;
13-
}
21+
@keyframes logo-spin {
22+
from {
23+
transform: rotate(0deg);
24+
}
25+
to {
26+
transform: rotate(360deg);
27+
}
1428
}
1529

16-
.App-header {
17-
background-color: #282c34;
18-
min-height: 100vh;
19-
display: flex;
20-
flex-direction: column;
21-
align-items: center;
22-
justify-content: center;
23-
font-size: calc(10px + 2vmin);
24-
color: white;
30+
@media (prefers-reduced-motion: no-preference) {
31+
a:nth-of-type(2) .logo {
32+
animation: logo-spin infinite 20s linear;
33+
}
2534
}
2635

27-
.App-link {
28-
color: #61dafb;
36+
.card {
37+
padding: 2em;
2938
}
3039

31-
@keyframes App-logo-spin {
32-
from {
33-
transform: rotate(0deg);
34-
}
35-
to {
36-
transform: rotate(360deg);
37-
}
40+
.read-the-docs {
41+
color: #888;
3842
}

src/App.jsx

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,39 @@
1-
import React from "react";
1+
import { useState } from "react";
2+
import reactLogo from "./assets/react.svg";
3+
import viteLogo from "/vite.svg";
24
import "./App.css";
35

46
function App() {
5-
return (
6-
<div className="App">
7-
<header className="App-header">
8-
<img src="/logo.svg" className="App-logo" alt="logo" />
9-
<p>
10-
Edit <code>src/App.jsx</code> and save to reload!
11-
</p>
12-
<span className="App-link">Hello from codedamn :)</span>
13-
</header>
14-
</div>
15-
);
7+
const [count, setCount] = useState(0);
8+
9+
return (
10+
<>
11+
<div>
12+
<a href="https://vitejs.dev" target="_blank">
13+
<img src={viteLogo} className="logo" alt="Vite logo" />
14+
</a>
15+
<a href="https://react.dev" target="_blank">
16+
<img
17+
src={reactLogo}
18+
className="logo react"
19+
alt="React logo"
20+
/>
21+
</a>
22+
</div>
23+
<h1>Vite + React</h1>
24+
<div className="card">
25+
<button onClick={() => setCount((count) => count + 1)}>
26+
count is {count}
27+
</button>
28+
<p>
29+
Edit <code>src/App.jsx</code> and save to test HMR
30+
</p>
31+
</div>
32+
<p className="read-the-docs">
33+
Click on the Vite and React logos to learn more
34+
</p>
35+
</>
36+
);
1637
}
1738

1839
export default App;

src/assets/react.svg

Lines changed: 1 addition & 0 deletions
Loading

src/index.css

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,69 @@
1+
:root {
2+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3+
line-height: 1.5;
4+
font-weight: 400;
5+
6+
color-scheme: light dark;
7+
color: rgba(255, 255, 255, 0.87);
8+
background-color: #242424;
9+
10+
font-synthesis: none;
11+
text-rendering: optimizeLegibility;
12+
-webkit-font-smoothing: antialiased;
13+
-moz-osx-font-smoothing: grayscale;
14+
-webkit-text-size-adjust: 100%;
15+
}
16+
17+
a {
18+
font-weight: 500;
19+
color: #646cff;
20+
text-decoration: inherit;
21+
}
22+
a:hover {
23+
color: #535bf2;
24+
}
25+
126
body {
2-
margin: 0;
3-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
4-
'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
5-
'Helvetica Neue', sans-serif;
6-
-webkit-font-smoothing: antialiased;
7-
-moz-osx-font-smoothing: grayscale;
27+
margin: 0;
28+
display: flex;
29+
place-items: center;
30+
min-width: 320px;
31+
min-height: 100vh;
32+
}
33+
34+
h1 {
35+
font-size: 3.2em;
36+
line-height: 1.1;
37+
}
38+
39+
button {
40+
border-radius: 8px;
41+
border: 1px solid transparent;
42+
padding: 0.6em 1.2em;
43+
font-size: 1em;
44+
font-weight: 500;
45+
font-family: inherit;
46+
background-color: #1a1a1a;
47+
cursor: pointer;
48+
transition: border-color 0.25s;
49+
}
50+
button:hover {
51+
border-color: #646cff;
52+
}
53+
button:focus,
54+
button:focus-visible {
55+
outline: 4px auto -webkit-focus-ring-color;
856
}
957

10-
code {
11-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12-
monospace;
58+
@media (prefers-color-scheme: light) {
59+
:root {
60+
color: #213547;
61+
background-color: #ffffff;
62+
}
63+
a:hover {
64+
color: #747bff;
65+
}
66+
button {
67+
background-color: #f9f9f9;
68+
}
1369
}

src/index.jsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/main.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom/client'
3+
import App from './App.jsx'
4+
import './index.css'
5+
6+
ReactDOM.createRoot(document.getElementById('root')).render(
7+
<React.StrictMode>
8+
<App />
9+
</React.StrictMode>,
10+
)

vite.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import react from '@vitejs/plugin-react'
33

44
// https://vitejs.dev/config/
55
export default defineConfig({
6-
plugins: [react()],
6+
plugins: [react()],
77
})

0 commit comments

Comments
 (0)