Skip to content

Commit 1003847

Browse files
committed
commit
1 parent 0da8545 commit 1003847

File tree

1,048 files changed

+271721
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,048 files changed

+271721
-0
lines changed

NewYearApp/frontend/.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+
}

NewYearApp/frontend/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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?

NewYearApp/frontend/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# React + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { useState } from "react";
2+
3+
export function CreateTodo(props) {
4+
// react-query
5+
const [title, setTitle] = useState("");
6+
const [description, setDescription] = useState("");
7+
8+
return <div>
9+
<input id="title" style={{
10+
padding: 10,
11+
margin: 10
12+
}} type="text" placeholder="title" onChange={function(e) {
13+
const value = e.target.value;
14+
setTitle(e.target.value);
15+
}}></input> <br />
16+
17+
<input id="desc" style={{
18+
padding: 10,
19+
margin: 10
20+
}} type="text" placeholder="description" onChange={function(e) {
21+
const value = e.target.value;
22+
setDescription(e.target.value);
23+
}}></input> <br />
24+
25+
<button style={{
26+
padding: 10,
27+
margin: 10
28+
}} onClick={() => {
29+
// axios
30+
fetch("http://localhost:3000/todo", {
31+
method: "POST",
32+
body: JSON.stringify({
33+
title: title,
34+
description: description
35+
}),
36+
headers: {
37+
"Content-type": "application/json"
38+
}
39+
})
40+
.then(async function(res) {
41+
const json = await res.json();
42+
alert("Todo added");
43+
})
44+
}}>Add a todo</button>
45+
</div>
46+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export function Todos({todos}) {
2+
3+
return <div>
4+
{todos.map(function(todo) {
5+
return <div>
6+
<h1>{todo.title}</h1>
7+
<h2>{todo.description}</h2>
8+
<button>{todo.completed == true ? "Completed" : "Mark as Complete"}</button>
9+
</div>
10+
})}
11+
</div>
12+
}

NewYearApp/frontend/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
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>Vite + React</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)