Compare commits
1 commit
master
...
react-todo
Author | SHA1 | Date | |
---|---|---|---|
|
3adbdb0ac1 |
21 changed files with 27997 additions and 0 deletions
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
24
LICENSE
Normal file
24
LICENSE
Normal file
|
@ -0,0 +1,24 @@
|
|||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <https://unlicense.org>
|
27538
package-lock.json
generated
Normal file
27538
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
44
package.json
Normal file
44
package.json
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "todo-app",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^6.0.0",
|
||||
"@testing-library/jest-dom": "^5.16.2",
|
||||
"@testing-library/react": "^12.1.3",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/react": "^17.0.39",
|
||||
"@types/react-dom": "^17.0.13",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-scripts": "5.0.0",
|
||||
"typescript": "^4.6.2",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
43
public/index.html
Normal file
43
public/index.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
BIN
public/logo192.png
Normal file
BIN
public/logo192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
public/logo512.png
Normal file
BIN
public/logo512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
25
public/manifest.json
Normal file
25
public/manifest.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
3
public/robots.txt
Normal file
3
public/robots.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
16
src/App.css
Normal file
16
src/App.css
Normal file
|
@ -0,0 +1,16 @@
|
|||
.app{
|
||||
max-width: 60rem;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
display: grid;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
9
src/App.test.tsx
Normal file
9
src/App.test.tsx
Normal file
|
@ -0,0 +1,9 @@
|
|||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
59
src/App.tsx
Normal file
59
src/App.tsx
Normal file
|
@ -0,0 +1,59 @@
|
|||
import React from 'react';
|
||||
import logo from './logo.png';
|
||||
import './App.css';
|
||||
import './table.css'
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="app">
|
||||
<header>
|
||||
<img src={logo} className="logo" alt="logo" width="125" height="125" />
|
||||
<h1>React.js Todo App</h1>
|
||||
</header>
|
||||
<main>
|
||||
<div className="add-task">
|
||||
<input
|
||||
v-model="task"
|
||||
type="text"
|
||||
placeholder="Enter Task"
|
||||
id="add-Task-Input"
|
||||
/>
|
||||
<button className="add-task-submit">Submit</button>
|
||||
</div>
|
||||
<table className="task-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Task</th>
|
||||
<th scope="col" id="table-head-status">Status</th>
|
||||
<th scope="col" className="text-center table-icon">#</th>
|
||||
<th scope="col" className="text-center table-icon">#</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr >
|
||||
<td></td>
|
||||
<td className="text-center task-status">
|
||||
<select name="task-status" className="task-status-select">
|
||||
<option>
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<div className="text-center task-action-button" >
|
||||
<span className="fa fa-pen"></span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div className="text-center task-action-button" >
|
||||
<span className="fa fa-trash"></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
38
src/index.css
Normal file
38
src/index.css
Normal file
|
@ -0,0 +1,38 @@
|
|||
:root {
|
||||
--color-light-blue2: #95e8ff;
|
||||
--color-light-blue1: #8AE6FF;
|
||||
--color-cyan: #61dafb;
|
||||
--color-cyan-dark1: #4AA4BC;
|
||||
--color-cyan-dark2: #367788;
|
||||
|
||||
--color-background: #282c34;
|
||||
--color-text: white;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
color: var(--color-text);
|
||||
background: var(--color-background);
|
||||
transition: color 0.5s, background-color 0.5s;
|
||||
line-height: 1.6;
|
||||
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
||||
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
||||
font-size: 15px;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
19
src/index.tsx
Normal file
19
src/index.tsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
import '@fortawesome/fontawesome-free/css/all.css'
|
||||
import '@fortawesome/fontawesome-free/js/all.js'
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
BIN
src/logo.png
Normal file
BIN
src/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
1
src/react-app-env.d.ts
vendored
Normal file
1
src/react-app-env.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="react-scripts" />
|
15
src/reportWebVitals.ts
Normal file
15
src/reportWebVitals.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { ReportHandler } from 'web-vitals';
|
||||
|
||||
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
5
src/setupTests.ts
Normal file
5
src/setupTests.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
109
src/table.css
Normal file
109
src/table.css
Normal file
|
@ -0,0 +1,109 @@
|
|||
table {
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
padding: 0;
|
||||
}
|
||||
th, td {
|
||||
height: 3rem;
|
||||
padding: 0.5rem;
|
||||
border: 1px solid var(--color-cyan);
|
||||
border-bottom: none;
|
||||
border-right: none;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
th{
|
||||
background-color: var(--color-cyan-dark2);
|
||||
}
|
||||
table th:first-child{
|
||||
border-top-left-radius: 0.5rem;
|
||||
}
|
||||
table th:last-child{
|
||||
border-top-right-radius: 0.5rem;
|
||||
border-right: 1px solid var(--color-cyan);
|
||||
}
|
||||
table td:last-child{
|
||||
border-right: 1px solid var(--color-cyan);
|
||||
}
|
||||
|
||||
table tr:last-child td{
|
||||
border-bottom: 1px solid var(--color-cyan);
|
||||
}
|
||||
table tr:last-child td:first-child{
|
||||
border-bottom-left-radius: 0.5rem;
|
||||
}
|
||||
table tr:last-child td:last-child{
|
||||
border-bottom-right-radius: 0.5rem;
|
||||
}
|
||||
|
||||
th.table-icon{
|
||||
width: 3rem;
|
||||
}
|
||||
|
||||
|
||||
.add-task {
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
#add-Task-Input {
|
||||
height: 1rem;
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
margin-right: 0.1rem;
|
||||
border-radius: 0.25rem;
|
||||
border: none;
|
||||
}
|
||||
.add-task-submit {
|
||||
background-color: var(--color-cyan);
|
||||
border-radius: 0.25rem;
|
||||
/*make a round border*/
|
||||
border: 0.1rem solid var(--color-cyan-dark1);
|
||||
transition-duration: 100ms;
|
||||
}
|
||||
.add-task-submit:hover {
|
||||
background-color: var(--color-light-blue2);
|
||||
border-color: var(--color-cyan);
|
||||
}
|
||||
.add-task-submit:active {
|
||||
background-color: var(--color-cyan-dark1);
|
||||
border-color: var(--color-cyan-dark2);
|
||||
}
|
||||
.task-table {
|
||||
width: 100%;
|
||||
margin: 1rem auto;
|
||||
}
|
||||
#table-head-status {
|
||||
width: 8rem;
|
||||
}
|
||||
.task-status {
|
||||
padding: 0;
|
||||
}
|
||||
.task-status-select {
|
||||
color: var(--color-text);
|
||||
background-color: var(--color-background);
|
||||
border: none;
|
||||
outline: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.task-status-select:hover {
|
||||
color: var(--color-cyan);
|
||||
}
|
||||
.task-status-select:active {
|
||||
color: var(--color-cyan-dark1);
|
||||
}
|
||||
.task-status-select option {
|
||||
color: var(--color-cyan);
|
||||
}
|
||||
.task-action-button {
|
||||
transition-duration: 100ms;
|
||||
}
|
||||
.task-action-button:hover {
|
||||
color: var(--color-cyan);
|
||||
}
|
||||
.task-action-button:active {
|
||||
color: var(--color-cyan-dark1);
|
||||
}
|
26
tsconfig.json
Normal file
26
tsconfig.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue