├── .gitignore
├── alarm-clock
├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── alarmRing.mp3
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
└── src
│ ├── App.css
│ ├── App.js
│ ├── Components
│ ├── Alarm
│ │ ├── Alarm.css
│ │ └── index.jsx
│ ├── AlarmContainer
│ │ ├── AlarmContainer.css
│ │ └── index.jsx
│ └── Clock
│ │ ├── Clock.css
│ │ └── index.jsx
│ ├── Hooks
│ ├── useFormat.js
│ └── useStore.js
│ ├── index.css
│ ├── index.js
│ └── redux
│ ├── actions
│ ├── AlarmAction.js
│ └── TimerAction.js
│ ├── reducers
│ ├── alarmReducer.js
│ ├── index.js
│ └── timerReducer.js
│ └── store.js
├── calculator-app
├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
└── src
│ ├── App.css
│ ├── App.js
│ ├── Components
│ └── Keypad.jsx
│ ├── index.css
│ ├── index.js
│ └── logo.svg
├── calendar-app
├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
└── src
│ ├── App.css
│ ├── App.js
│ ├── Components
│ ├── Calendar
│ │ ├── index.js
│ │ └── style.css
│ ├── CalendarDay
│ │ ├── index.js
│ │ └── style.css
│ ├── CalendarHeader
│ │ ├── index.js
│ │ └── style.css
│ └── CalendarTable
│ │ ├── index.js
│ │ └── style.css
│ ├── index.css
│ └── index.js
├── quiz-app
├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
└── src
│ ├── .env
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── components
│ ├── AnswerSection
│ │ └── index.jsx
│ └── Quiz
│ │ ├── index.jsx
│ │ └── style.css
│ ├── index.css
│ ├── index.js
│ ├── logo.svg
│ ├── reportWebVitals.js
│ └── setupTests.js
├── tic-tac-toe-app
├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
└── src
│ ├── App.css
│ ├── App.js
│ ├── components
│ ├── GameBoard
│ │ ├── index.jsx
│ │ └── style.css
│ └── TicTacToe
│ │ ├── index.jsx
│ │ └── style.css
│ ├── index.css
│ ├── index.js
│ └── logo.svg
├── tip-calculator
├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
└── src
│ ├── App.css
│ ├── App.js
│ ├── components
│ └── TipCalculator
│ │ ├── CalcForm.jsx
│ │ ├── index.css
│ │ └── index.jsx
│ ├── index.css
│ ├── index.js
│ └── logo.svg
└── todo-app
├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
└── robots.txt
└── src
├── App.css
├── App.js
├── Components
├── Task
│ ├── Task.css
│ └── index.jsx
└── TaskContainer
│ ├── TaskContainer.css
│ └── index.jsx
├── index.css
└── index.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/alarm-clock/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/alarm-clock/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `npm start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 |
14 | The page will reload when you make changes.\
15 | You may also see any lint errors in the console.
16 |
17 | ### `npm test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `npm run build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `npm run eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 |
36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 |
40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `npm run build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/alarm-clock/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "alarm-clock",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.5",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "moment": "^2.29.4",
10 | "react": "^18.2.0",
11 | "react-dom": "^18.2.0",
12 | "react-icons": "^4.8.0",
13 | "react-redux": "^8.0.5",
14 | "react-scripts": "5.0.1",
15 | "redux": "^4.2.1",
16 | "redux-thunk": "^2.4.2",
17 | "web-vitals": "^2.1.4"
18 | },
19 | "scripts": {
20 | "start": "react-scripts start",
21 | "build": "react-scripts build",
22 | "test": "react-scripts test",
23 | "eject": "react-scripts eject"
24 | },
25 | "eslintConfig": {
26 | "extends": [
27 | "react-app",
28 | "react-app/jest"
29 | ]
30 | },
31 | "browserslist": {
32 | "production": [
33 | ">0.2%",
34 | "not dead",
35 | "not op_mini all"
36 | ],
37 | "development": [
38 | "last 1 chrome version",
39 | "last 1 firefox version",
40 | "last 1 safari version"
41 | ]
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/alarm-clock/public/alarmRing.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/alarm-clock/public/alarmRing.mp3
--------------------------------------------------------------------------------
/alarm-clock/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/alarm-clock/public/favicon.ico
--------------------------------------------------------------------------------
/alarm-clock/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 | Alarm Clock
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/alarm-clock/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/alarm-clock/public/logo192.png
--------------------------------------------------------------------------------
/alarm-clock/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/alarm-clock/public/logo512.png
--------------------------------------------------------------------------------
/alarm-clock/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/alarm-clock/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/alarm-clock/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | justify-content: center;
4 | color: white;
5 | flex-direction: column;
6 | min-height: 100vh;
7 | display: flex;
8 | align-items: center;
9 | }
10 |
--------------------------------------------------------------------------------
/alarm-clock/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import { useEffect } from 'react';
3 | import Clock from './Components/Clock';
4 | import AlarmContainer from './Components/AlarmContainer';
5 | import { useDispatch, useSelector } from 'react-redux';
6 | import { setAlarmsFromStorage } from './redux/actions/AlarmAction';
7 |
8 | function App() {
9 | const activeAlarms = useSelector(state => state.alarmReducer.activeAlarm)
10 | const dispatch = useDispatch()
11 |
12 | useEffect(() => {
13 | const myAlarms = localStorage.getItem('myAlarms');
14 | if (myAlarms) {
15 | dispatch(setAlarmsFromStorage(JSON.parse(myAlarms)))
16 | }
17 | }, []);
18 |
19 | return (
20 |
24 | );
25 |
26 | }
27 |
28 | export default App;
29 |
--------------------------------------------------------------------------------
/alarm-clock/src/Components/Alarm/Alarm.css:
--------------------------------------------------------------------------------
1 | .alarm-container{
2 | margin-top: 30px;
3 | padding: 30px;
4 | width: fit-content;
5 | border: 1px solid #232d31;
6 | border-radius: 5px;
7 | margin: 10px 12px;
8 | font-family: 'BebasNeueRegular', Arial, Helvetica, sans-serif;
9 | color: #232d31;
10 | }
11 | .alarm-time-container{
12 | height: fit-content;
13 | }
14 | .alarm-time{
15 | font-size: 3rem;
16 | padding: 2.66px 4.755px;
17 | font-weight: bold;
18 | width: fit-content;
19 | background-color: transparent;
20 | }
21 | .alarm-time-input{
22 | font-size: 3rem;
23 | font-weight: bold;
24 | width: fit-content;
25 | }
26 | .alarm-actions{
27 | display: flex;
28 | justify-content: space-around;
29 | margin-top: 15px;
30 | }
31 | .alarm-action-btn{
32 | border-radius: 5px;
33 | border: none;
34 | outline: none;
35 | cursor: pointer;
36 | padding: 10px;
37 | }
38 | .alarm-remove-btn{
39 | color: #ff0000;
40 | }
41 | .alarm-edit-btn{
42 | color: #1b7200
43 | }
44 | .alarm-remove-btn:hover, .alarm-edit-btn:hover{
45 | background-color: #232d31;
46 | }
47 | .alarm-remove-btn:hover{
48 | color: #ff2222;
49 | }
50 | .alarm-edit-btn:hover{
51 | color: #49ff12
52 | }
--------------------------------------------------------------------------------
/alarm-clock/src/Components/Alarm/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import { deleteAlarm, setActiveAlarm, clearActiveAlarm } from '../../redux/actions/AlarmAction'
3 | import { AiFillDelete, AiFillEdit } from 'react-icons/ai'
4 | import { MdOutlineDownloadDone } from 'react-icons/md'
5 | import moment from 'moment'
6 |
7 | import { useDispatch, useSelector } from 'react-redux'
8 | import { updateAlarm } from '../../redux/actions/AlarmAction'
9 |
10 | import './Alarm.css'
11 | import useFormatTime from '../../Hooks/useFormat'
12 | import useStoreLocal from '../../Hooks/useStore'
13 |
14 | const Alarm = ({ index, alarm }) => {
15 | const dispatch = useDispatch()
16 | const alarms = useSelector(state => state.alarmReducer.alarms)
17 | const currentTime = useSelector(state => state.updateTimeReducer.time)
18 | const alarmRing = new Audio('alarmRing.mp3')
19 |
20 | const [isEdit, setIsEdit] = useState(false)
21 | const [time, setTime] = useState(alarm.time);
22 |
23 | const HandleRemove = () => {
24 | let newAlarms = [...alarms]
25 | newAlarms.splice(index, 1)
26 | dispatch(deleteAlarm(newAlarms))
27 | useStoreLocal(newAlarms)
28 | }
29 |
30 | const handleChange = (e) => {
31 | setTime(e.target.value)
32 | }
33 |
34 | const HandleEdit = () => {
35 | setIsEdit(false)
36 | let newAlarms = [...alarms]
37 | newAlarms.splice(index, 1, { time: time, bgColor: alarm.bgColor })
38 | dispatch(updateAlarm(newAlarms))
39 | useStoreLocal(newAlarms)
40 | }
41 | const TimeDeff = () => {
42 | let startTime = moment(currentTime.toLocaleTimeString(), 'hh:mm:ss a')
43 | let endTime = moment(alarm.time, 'hh:mm')
44 | const diffTime = moment.duration(endTime.diff(startTime));
45 |
46 | if (diffTime._milliseconds === 0) {
47 | alarmRing.play();
48 | dispatch(setActiveAlarm(alarm))
49 | setTimeout(() => {
50 | alarmRing.pause()
51 | dispatch(clearActiveAlarm())
52 | }, 5000)
53 | }
54 | if (diffTime._milliseconds < 0) {
55 | diffTime.add(1, 'days')
56 | }
57 | return useFormatTime(diffTime)
58 | }
59 |
60 | return (
61 |
62 |
63 | {isEdit ?
64 |
65 | :
{moment(alarm.time, 'HH:mm').format('hh:mm A')}
66 | }
67 |
68 |
{TimeDeff()}
69 |
70 |
71 | {isEdit ?
72 | :
73 | }
74 |
75 |
76 | )
77 | }
78 |
79 | export default Alarm
--------------------------------------------------------------------------------
/alarm-clock/src/Components/AlarmContainer/AlarmContainer.css:
--------------------------------------------------------------------------------
1 | .alarm-page-container{
2 | max-width: 95vw;
3 | width: 1000px;
4 | margin-bottom: 70px;
5 | }
6 | .alarm-container-input{
7 | display: flex;
8 | align-items: center;
9 | justify-content: center;
10 | margin-bottom: 15px;
11 | }
12 | .add-alarm-input{
13 | margin-right: 15px;
14 | padding: 15px 25px;
15 | border-radius: 5px;
16 | font-size: 18px;
17 | outline: none;
18 | }
19 | .add-alarm-button{
20 | padding: 15px 25px;
21 | font-size: 18px;
22 | cursor: pointer;
23 | background-color: rgb(243, 113, 21);
24 | outline: none;
25 | border-radius: 5px;
26 | border: none;
27 | }
28 | .alarm-list-container{
29 | display: flex;
30 | justify-content: center;
31 | flex-wrap: wrap;
32 | }
--------------------------------------------------------------------------------
/alarm-clock/src/Components/AlarmContainer/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import { useDispatch, useSelector } from 'react-redux'
3 | import useStoreLocal from '../../Hooks/useStore'
4 | import { setAlarm } from '../../redux/actions/AlarmAction'
5 | import Alarm from '../Alarm'
6 |
7 | import './AlarmContainer.css'
8 |
9 | const AlarmContainer = () => {
10 | const dispatch = useDispatch()
11 | const [time, setTime] = useState('')
12 |
13 | const alarms = useSelector(state => state.alarmReducer.alarms)
14 | const activeAlarms = useSelector(state => state.alarmReducer.activeAlarm)
15 |
16 | const generateLightColorHex = () => {
17 | let color = "#";
18 | do {
19 | for (let i = 0; i < 3; i++)
20 | color += ("0" + Math.floor(((1 + Math.random()) * Math.pow(16, 2)) / 2).toString(16)).slice(-2);
21 | // eslint-disable-next-line no-loop-func
22 | } while (alarms.filter(alarm => alarm.bgColor === color).length > 0);
23 | return color;
24 | }
25 |
26 | const HandleAddAlarm = () => {
27 | if (time) {
28 | if (alarms.filter(alarm => alarm.time === time).length === 0) {
29 | const bgColor = generateLightColorHex();
30 | dispatch(setAlarm({ time, bgColor }))
31 | // eslint-disable-next-line react-hooks/rules-of-hooks
32 | useStoreLocal([...alarms, { time, bgColor }])
33 | }
34 | else {
35 | alert("Alarm is already scheduled")
36 | console.log("pakda gaya");
37 | }
38 | }
39 | setTime('')
40 | }
41 |
42 | const handleChange = (e) => {
43 | setTime(e.target.value)
44 | }
45 |
46 | return (
47 |
48 |
Alarms
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | {alarms?.map((alarm, i) =>
)}
57 |
58 |
59 | )
60 | }
61 |
62 | export default AlarmContainer
--------------------------------------------------------------------------------
/alarm-clock/src/Components/Clock/Clock.css:
--------------------------------------------------------------------------------
1 | .clock-container {
2 | max-width: 850px;
3 | width: 85vw;
4 | margin: 70px 10px 30px 10px;
5 | padding: 30px;
6 | border: 1px solid #333;
7 | border-radius: 6px;
8 | color: #fff;
9 | }
10 |
11 | .time {
12 | margin: 0 auto;
13 | padding: 0px;
14 | font-size: 7em;
15 | font-weight: 600;
16 | text-overflow: clip;
17 | font-family: 'BebasNeueRegular', Arial, Helvetica, sans-serif;
18 | text-shadow: 0 0 4px #80b5c4;
19 | }
20 |
21 | .date {
22 | font-family: 'BebasNeueRegular', Arial, Helvetica, sans-serif;
23 | font-size: 36px;
24 | text-align: center;
25 | font-weight: 400;
26 | text-shadow: 0 0 3px #80b5c4;
27 | }
--------------------------------------------------------------------------------
/alarm-clock/src/Components/Clock/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from 'react'
2 | import moment from 'moment'
3 | import './Clock.css'
4 |
5 | import { useDispatch, useSelector } from 'react-redux';
6 | import { updateTime } from '../../redux/actions/TimerAction';
7 |
8 | const Clock = () => {
9 | const dispatch = useDispatch()
10 | const time = useSelector(state => state.updateTimeReducer.time)
11 | const activeAlarms = useSelector(state => state.alarmReducer.activeAlarm)
12 |
13 | useEffect(() => {
14 | const timerId = setInterval(() => dispatch(updateTime()), 1000);
15 | return function cleanup() {
16 | clearInterval(timerId);
17 | };
18 | // eslint-disable-next-line
19 | }, []);
20 |
21 | return (
22 |
23 |
{moment(time).format('hh:mm:ss A')}
24 |
{moment(time).add(-1, "days").format('DD/MM/YYYY')}
25 |
26 | )
27 | }
28 |
29 | export default Clock
--------------------------------------------------------------------------------
/alarm-clock/src/Hooks/useFormat.js:
--------------------------------------------------------------------------------
1 |
2 | const useFormatTime = (milliseconds) => {
3 | const formatTime = `${milliseconds.hours() < 10 ? '0' + milliseconds.hours() : milliseconds.hours()} : ${milliseconds.minutes() < 10 ? '0' + milliseconds.minutes() : milliseconds.minutes()} : ${milliseconds.seconds() < 10 ? '0' + milliseconds.seconds() : milliseconds.seconds()}`
4 | return [formatTime]
5 | }
6 |
7 | export default useFormatTime
--------------------------------------------------------------------------------
/alarm-clock/src/Hooks/useStore.js:
--------------------------------------------------------------------------------
1 |
2 | const useStoreLocal = (data) => {
3 | localStorage.setItem('myAlarms', JSON.stringify(data))
4 | return [JSON.stringify(data)]
5 | }
6 |
7 | export default useStoreLocal
--------------------------------------------------------------------------------
/alarm-clock/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/alarm-clock/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 |
6 | import { Provider } from 'react-redux';
7 | import store from './redux/store';
8 |
9 |
10 | const root = ReactDOM.createRoot(document.getElementById('root'));
11 | root.render(
12 |
13 |
14 |
15 |
16 |
17 | );
18 |
--------------------------------------------------------------------------------
/alarm-clock/src/redux/actions/AlarmAction.js:
--------------------------------------------------------------------------------
1 | export const setAlarm = (alarm) => {
2 | return (dispatch, getState) => {
3 | dispatch({
4 | type: 'SET_ALARM',
5 | payload: alarm
6 | })
7 | }
8 | }
9 |
10 | export const setAlarmsFromStorage = (alarm) => {
11 | return (dispatch, getState) => {
12 | dispatch({
13 | type: 'SET_ALARMS_FROM_STORAGE',
14 | payload: alarm
15 | })
16 | }
17 | }
18 |
19 | export const setActiveAlarm = (alarm) => {
20 | return (dispatch, getState) => {
21 | dispatch({
22 | type: 'SET_ACTIVE_ALARM',
23 | payload: alarm
24 | })
25 | }
26 | }
27 |
28 | export const clearActiveAlarm = () => {
29 | return (dispatch, getState) => {
30 | dispatch({
31 | type: 'CLEAR_ACTIVE_ALARM'
32 | })
33 | }
34 | }
35 |
36 | export const deleteAlarm = (newAlarms) => {
37 | return (dispatch, getState) => {
38 | dispatch({
39 | type: 'DELETE_ALARM',
40 | payload: newAlarms
41 | })
42 | }
43 | }
44 |
45 | export const updateAlarm = (updatedAlarm) => {
46 | return (dispatch, getState) => {
47 | dispatch({
48 | type: 'UPDATE_ALARM',
49 | payload: updatedAlarm
50 | })
51 | }
52 | }
--------------------------------------------------------------------------------
/alarm-clock/src/redux/actions/TimerAction.js:
--------------------------------------------------------------------------------
1 | export const updateTime = () => {
2 | let time = new Date()
3 | return (dispatch, getState) => {
4 | dispatch({
5 | type: 'UPDATE_TIME',
6 | payload: time
7 | })
8 | }
9 | }
--------------------------------------------------------------------------------
/alarm-clock/src/redux/reducers/alarmReducer.js:
--------------------------------------------------------------------------------
1 | const initialState = {
2 | alarms: [],
3 | activeAlarm: null
4 | }
5 |
6 | export const alarmReducer = (state = initialState, action) => {
7 | switch (action.type) {
8 | case 'SET_ALARM':
9 | return {
10 | ...state,
11 | alarms: [...state.alarms, action.payload]
12 | }
13 |
14 | case 'SET_ALARMS_FROM_STORAGE':
15 | return {
16 | ...state,
17 | alarms: action.payload
18 | }
19 |
20 | case 'UPDATE_ALARM':
21 | return {
22 | ...state,
23 | alarms: action.payload
24 | }
25 |
26 | case 'DELETE_ALARM':
27 | return {
28 | ...state,
29 | alarms: action.payload
30 | }
31 |
32 | case 'SET_ACTIVE_ALARM':
33 | return {
34 | ...state,
35 | activeAlarm: action.payload
36 | }
37 |
38 | case 'CLEAR_ACTIVE_ALARM':
39 | return {
40 | ...state,
41 | activeAlarm: null
42 | }
43 |
44 | default:
45 | return state
46 | }
47 | }
--------------------------------------------------------------------------------
/alarm-clock/src/redux/reducers/index.js:
--------------------------------------------------------------------------------
1 | import { combineReducers } from "redux";
2 | import { updateTimeReducer } from "./timerReducer";
3 | import { alarmReducer } from "./alarmReducer";
4 |
5 | const rootReducer = combineReducers({ updateTimeReducer, alarmReducer });
6 |
7 | export default rootReducer;
--------------------------------------------------------------------------------
/alarm-clock/src/redux/reducers/timerReducer.js:
--------------------------------------------------------------------------------
1 | const initialState = {
2 | time: new Date()
3 | }
4 |
5 | export const updateTimeReducer = (state=initialState, action) =>{
6 | switch(action.type){
7 | case 'UPDATE_TIME':
8 | return {
9 | ...state,
10 | time: action.payload
11 | }
12 | default:
13 | return state
14 | }
15 | }
--------------------------------------------------------------------------------
/alarm-clock/src/redux/store.js:
--------------------------------------------------------------------------------
1 | import { createStore, applyMiddleware } from 'redux'
2 | import rootReducer from './reducers';
3 | import thunk from 'redux-thunk';
4 |
5 | const store = createStore(rootReducer, applyMiddleware(thunk))
6 |
7 | export default store;
--------------------------------------------------------------------------------
/calculator-app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/calculator-app/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `npm start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 |
14 | The page will reload when you make changes.\
15 | You may also see any lint errors in the console.
16 |
17 | ### `npm test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `npm run build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `npm run eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 |
36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 |
40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `npm run build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/calculator-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "calculator-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.5",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.2.0",
10 | "react-dom": "^18.2.0",
11 | "react-scripts": "5.0.1",
12 | "web-vitals": "^2.1.4"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject"
19 | },
20 | "eslintConfig": {
21 | "extends": [
22 | "react-app",
23 | "react-app/jest"
24 | ]
25 | },
26 | "browserslist": {
27 | "production": [
28 | ">0.2%",
29 | "not dead",
30 | "not op_mini all"
31 | ],
32 | "development": [
33 | "last 1 chrome version",
34 | "last 1 firefox version",
35 | "last 1 safari version"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/calculator-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/calculator-app/public/favicon.ico
--------------------------------------------------------------------------------
/calculator-app/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 | Calculator
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/calculator-app/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/calculator-app/public/logo192.png
--------------------------------------------------------------------------------
/calculator-app/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/calculator-app/public/logo512.png
--------------------------------------------------------------------------------
/calculator-app/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/calculator-app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/calculator-app/src/App.css:
--------------------------------------------------------------------------------
1 | *{
2 | box-sizing: border-box;
3 | }
4 |
5 | .App{
6 | font-family: "Roboto", Arial, sans-serif !important;
7 | -webkit-font-smoothing: antialiased;
8 | -moz-osx-font-smoothing: grayscale;
9 | display: flex;
10 | justify-content: center;
11 | min-height: 100vh;
12 | align-items: center;
13 | }
14 |
15 | .calculator{
16 | margin: 5px;
17 | box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
18 | border-radius: 12px;
19 | overflow: hidden;
20 |
21 | }
22 | .display {
23 | outline: none;
24 | border: none;
25 | width: 800px;
26 | height: 220px;
27 | font-size: 5rem;
28 | font-weight: 100;
29 | padding: 30px;
30 | text-align: right;
31 | color: white;
32 | background: #1c191c;
33 | }
34 |
35 | .keypad {
36 | display: grid;
37 | grid-template-columns: repeat(4, 1fr);
38 | border-radius: 12px;
39 | width: 800px;
40 | height: 900px;
41 | grid-template-rows: repeat(4, 1fr);
42 | }
43 |
44 | button {
45 | font-size: 50px;
46 | font-weight: 100;
47 | cursor: pointer;
48 | border-top: 1px solid #666;
49 | border-left: none;
50 | border-bottom: none;
51 | }
52 |
53 | .digit-keys {
54 | background-color: #E0E0E7;
55 | border-right: 1px solid #666;
56 | }
57 |
58 | .fun-keys {
59 | background-color: #C9C8CC;
60 | border-right: 1px solid #666;
61 | }
62 |
63 | .operator-keys {
64 | color: #fff;
65 | border-right: none;
66 | background-color: #5142FF;
67 | }
68 |
69 | .digit-keys:hover {
70 | background-color: #d9d9d9;
71 | }
72 |
73 | .fun-keys:hover {
74 | background-color: #aba9a9;
75 | }
76 |
77 | .operator-keys:hover {
78 | background-color: #3021d7;
79 | }
--------------------------------------------------------------------------------
/calculator-app/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import { useState } from 'react';
3 | import Keypad from './Components/Keypad';
4 |
5 | function App() {
6 | const [input, setInput] = useState('');
7 | const handleClick = (value) => {
8 | setInput(input + value);
9 | };
10 |
11 | const handleEqual = () => {
12 | setInput(eval(input).toString());
13 | };
14 |
15 | const handleClear = () => {
16 | setInput("");
17 | };
18 | return (
19 |
28 | );
29 | }
30 |
31 | export default App;
32 |
--------------------------------------------------------------------------------
/calculator-app/src/Components/Keypad.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Keypad = ({ handleClick, handleClear, handleEqual }) => {
4 | const buttonConfigurations = [
5 | '7', '8', '9', '/',
6 | '4', '5', '6', '*',
7 | '1', '2', '3', '-',
8 | '0', '=', 'C', '+'
9 | ];
10 |
11 | return (
12 |
13 | {buttonConfigurations.map((label, index) => (
14 |
24 | ))}
25 |
26 | );
27 | }
28 |
29 | export default Keypad;
30 |
--------------------------------------------------------------------------------
/calculator-app/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | background-color: rgb(224, 218, 255);
9 | }
10 |
11 | code {
12 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
13 | monospace;
14 | }
15 |
--------------------------------------------------------------------------------
/calculator-app/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'));
7 | root.render(
8 |
9 |
10 |
11 | );
--------------------------------------------------------------------------------
/calculator-app/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/calendar-app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/calendar-app/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `npm start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 |
14 | The page will reload when you make changes.\
15 | You may also see any lint errors in the console.
16 |
17 | ### `npm test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `npm run build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `npm run eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 |
36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 |
40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `npm run build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/calendar-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "calendar-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.5",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "date-fns": "^2.29.3",
10 | "react": "^18.2.0",
11 | "react-dom": "^18.2.0",
12 | "react-scripts": "5.0.1",
13 | "web-vitals": "^2.1.4"
14 | },
15 | "scripts": {
16 | "start": "react-scripts start",
17 | "build": "react-scripts build",
18 | "test": "react-scripts test",
19 | "eject": "react-scripts eject"
20 | },
21 | "eslintConfig": {
22 | "extends": [
23 | "react-app",
24 | "react-app/jest"
25 | ]
26 | },
27 | "browserslist": {
28 | "production": [
29 | ">0.2%",
30 | "not dead",
31 | "not op_mini all"
32 | ],
33 | "development": [
34 | "last 1 chrome version",
35 | "last 1 firefox version",
36 | "last 1 safari version"
37 | ]
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/calendar-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/calendar-app/public/favicon.ico
--------------------------------------------------------------------------------
/calendar-app/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 | Calendar App
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/calendar-app/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/calendar-app/public/logo192.png
--------------------------------------------------------------------------------
/calendar-app/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/calendar-app/public/logo512.png
--------------------------------------------------------------------------------
/calendar-app/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/calendar-app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/calendar-app/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
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;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/calendar-app/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import Calendar from './Components/Calendar';
3 |
4 | function App() {
5 | return (
6 |
7 |
8 |
9 | );
10 | }
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/calendar-app/src/Components/Calendar/index.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import CalendarHeader from '../CalendarHeader';
3 | import CalendarTable from '../CalendarTable';
4 | import './style.css'
5 |
6 | function Calendar() {
7 | const [date, setDate] = useState(new Date());
8 |
9 | const handlePrevMonth = () => {
10 | const newDate = new Date(date.getFullYear(), date.getMonth() - 1, 1);
11 | setDate(newDate);
12 | };
13 |
14 | const handleNextMonth = () => {
15 | const newDate = new Date(date.getFullYear(), date.getMonth() + 1, 1);
16 | setDate(newDate);
17 | };
18 |
19 | return (
20 |
21 |
26 |
27 |
28 | );
29 | }
30 |
31 | export default Calendar;
--------------------------------------------------------------------------------
/calendar-app/src/Components/Calendar/style.css:
--------------------------------------------------------------------------------
1 | /* Calendar Container */
2 | .calendar {
3 | max-width: 800px;
4 | margin: 0 auto;
5 | font-family: 'Open Sans', sans-serif;
6 | }
7 | /* Responsive */
8 | @media (max-width: 768px) {
9 | .calendar-header h2 {
10 | font-size: 24px;
11 | }
12 |
13 | .calendar-header button {
14 | font-size: 18px;
15 | }
16 |
17 | .calendar-table th,
18 | .calendar-table td {
19 | font-size: 16px;
20 | }
21 | }
--------------------------------------------------------------------------------
/calendar-app/src/Components/CalendarDay/index.js:
--------------------------------------------------------------------------------
1 | import { format, isEqual } from 'date-fns';
2 | import './style.css'
3 |
4 | function CalendarDay({ day, days }) {
5 | const today = new Date().setHours(0,0,0,0);
6 |
7 | return (
8 |
9 | {days.map((d, i) => (
10 |
11 |
12 | {format(d, 'd')}
13 |
14 | |
15 | )
16 | )}
17 |
18 | );
19 | }
20 |
21 | export default CalendarDay;
22 |
--------------------------------------------------------------------------------
/calendar-app/src/Components/CalendarDay/style.css:
--------------------------------------------------------------------------------
1 | /* Calendar Container */
2 | .calendar {
3 | max-width: 800px;
4 | margin: 0 auto;
5 | font-family: 'Open Sans', sans-serif;
6 | }
7 | .today {
8 | background-color: yellow;
9 | }
10 |
11 | .weekend{
12 | background-color:rgb(218, 218, 218);
13 | }
14 |
--------------------------------------------------------------------------------
/calendar-app/src/Components/CalendarHeader/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { format } from 'date-fns';
3 | import './style.css'
4 |
5 | function CalendarHeader({ date, onPrevMonth, onNextMonth }) {
6 | return (
7 |
8 |
9 |
{format(date, 'MMMM yyyy')}
10 |
11 |
12 | );
13 | }
14 |
15 | export default CalendarHeader;
--------------------------------------------------------------------------------
/calendar-app/src/Components/CalendarHeader/style.css:
--------------------------------------------------------------------------------
1 | /* Calendar Header */
2 | .calendar-header {
3 | display: flex;
4 | justify-content: space-between;
5 | align-items: center;
6 | background-color: #FFFFFF;
7 | padding: 20px;
8 | border-top-left-radius: 10px;
9 | border-top-right-radius: 10px;
10 | box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
11 | }
12 |
13 | .calendar-header h2 {
14 | font-size: 30px;
15 | font-weight: bold;
16 | margin: 0;
17 | }
18 |
19 | .calendar-header button {
20 | background-color: #FFFFFF;
21 | color: #333333;
22 | border: none;
23 | cursor: pointer;
24 | font-size: 20px;
25 | transition: all 0.2s ease-in-out;
26 | }
27 |
28 | .calendar-header button:hover {
29 | transform: scale(1.1);
30 | }
31 |
32 | .calendar-header button:active {
33 | transform: scale(0.9);
34 | }
--------------------------------------------------------------------------------
/calendar-app/src/Components/CalendarTable/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { startOfMonth, endOfMonth, startOfWeek, endOfWeek, addDays } from 'date-fns';
3 | import './style.css'
4 | import CalendarDay from '../CalendarDay';
5 |
6 | function CalendarTable({ date }) {
7 | const monthStart = startOfMonth(date);
8 | const monthEnd = endOfMonth(monthStart);
9 | const startDate = startOfWeek(monthStart);
10 | const endDate = endOfWeek(monthEnd);
11 | const rows = [];
12 | const WEEK_DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
13 |
14 | let days = [];
15 | let day = startDate;
16 |
17 | while (day <= endDate) {
18 | for (let i = 0; i < 7; i++) {
19 | days.push(day);
20 | day = addDays(day, 1);
21 | }
22 | rows.push({ day, days })
23 | days = [];
24 | }
25 |
26 | return (
27 |
28 |
29 |
30 | {WEEK_DAYS.map((day, i) => (
31 | {day} |
32 | ))}
33 |
34 |
35 | {rows?.map((row, i) => (
36 |
37 | ))}
38 |
39 | );
40 | }
41 |
42 | export default CalendarTable;
--------------------------------------------------------------------------------
/calendar-app/src/Components/CalendarTable/style.css:
--------------------------------------------------------------------------------
1 | /* Calendar Table */
2 | .calendar-table {
3 | width: 100%;
4 | background-color: #FFFFFF;
5 | border-bottom-left-radius: 10px;
6 | border-bottom-right-radius: 10px;
7 | box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
8 | overflow: hidden;
9 | }
10 |
11 | .calendar-table table {
12 | width: 100%;
13 | border-collapse: collapse;
14 | }
15 |
16 | .calendar-table th,
17 | .calendar-table td {
18 | text-align: center;
19 | padding: 15px 10px;
20 | }
21 |
22 | .calendar-table th {
23 | font-size: 20px;
24 | color: #FFFFFF;
25 | background-color: #5D5FEF;
26 | text-transform: uppercase;
27 | }
28 |
29 | .calendar-table td {
30 | font-size: 20px;
31 | color: #333333;
32 | }
33 |
34 | .calendar-table td.inactive {
35 | color: #CCCCCC;
36 | cursor: default;
37 | }
38 |
39 | .calendar-table td.today {
40 | background-color: #F8E71C;
41 | }
42 |
43 | .calendar-table td.selected {
44 | background-color: #5D5FEF;
45 | color: #FFFFFF;
46 | border-radius: 50%;
47 | }
48 |
49 | .calendar-table td:hover {
50 | background-color: #F8E71C;
51 | cursor: pointer;
52 | }
--------------------------------------------------------------------------------
/calendar-app/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/calendar-app/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'));
7 | root.render(
8 |
9 |
10 |
11 | );
12 |
--------------------------------------------------------------------------------
/quiz-app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/quiz-app/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `npm start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 |
14 | The page will reload when you make changes.\
15 | You may also see any lint errors in the console.
16 |
17 | ### `npm test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `npm run build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `npm run eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 |
36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 |
40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `npm run build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/quiz-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "quiz-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.5",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "axios": "^1.3.5",
10 | "react": "^18.2.0",
11 | "react-dom": "^18.2.0",
12 | "react-scripts": "5.0.1",
13 | "web-vitals": "^2.1.4"
14 | },
15 | "scripts": {
16 | "start": "react-scripts start",
17 | "build": "react-scripts build",
18 | "test": "react-scripts test",
19 | "eject": "react-scripts eject"
20 | },
21 | "eslintConfig": {
22 | "extends": [
23 | "react-app",
24 | "react-app/jest"
25 | ]
26 | },
27 | "browserslist": {
28 | "production": [
29 | ">0.2%",
30 | "not dead",
31 | "not op_mini all"
32 | ],
33 | "development": [
34 | "last 1 chrome version",
35 | "last 1 firefox version",
36 | "last 1 safari version"
37 | ]
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/quiz-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/quiz-app/public/favicon.ico
--------------------------------------------------------------------------------
/quiz-app/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 |
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/quiz-app/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/quiz-app/public/logo192.png
--------------------------------------------------------------------------------
/quiz-app/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/quiz-app/public/logo512.png
--------------------------------------------------------------------------------
/quiz-app/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/quiz-app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/quiz-app/src/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_QUIZ_API_KEY=pQ0u0hStoEM5xE6ucNrXGpNQJsZvqKRWPQFgz1gh
--------------------------------------------------------------------------------
/quiz-app/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | display: flex;
4 | min-height: 100vh;
5 | background: rgb(2,0,36);
6 | background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%);
7 | }
8 |
--------------------------------------------------------------------------------
/quiz-app/src/App.js:
--------------------------------------------------------------------------------
1 | import logo from './logo.svg';
2 | import './App.css';
3 | import Quiz from './components/Quiz';
4 |
5 | function App() {
6 | return (
7 |
8 |
9 |
10 | );
11 | }
12 |
13 | export default App;
14 |
--------------------------------------------------------------------------------
/quiz-app/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render();
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/quiz-app/src/components/AnswerSection/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const index = ({questions, currentQuestion, handleAnswerOptionClick}) => {
4 | return (
5 |
6 | {questions[currentQuestion]?.answers &&
7 | Object.entries(questions[currentQuestion]?.answers).map(([key, value]) => (
8 | value && (
9 |
19 | )
20 | ))}
21 |
22 | )
23 | }
24 |
25 | export default index
--------------------------------------------------------------------------------
/quiz-app/src/components/Quiz/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 | import axios from 'axios';
3 | import './style.css'
4 | import AnswerSection from '../AnswerSection'
5 |
6 | const QuizApp = () => {
7 | const [questions, setQuestions] = useState([]);
8 | const [currentQuestion, setCurrentQuestion] = useState(0);
9 | const [showScore, setShowScore] = useState(false);
10 | const [score, setScore] = useState(0);
11 | const [selectedAnswers, setSelectedAnswers] = useState([]);
12 |
13 | const fetchQuestions = async() => {
14 | const response = await axios.get(`https://quizapi.io/api/v1/questions?apiKey=${process.env.REACT_APP_QUIZ_API_KEY}&limit=10&category=code`);
15 | setQuestions(response.data);
16 | }
17 | useEffect(() => {
18 | fetchQuestions();
19 | }, []);
20 |
21 | const handleAnswerOptionClick = (isCorrect, answer) => {
22 | if (isCorrect) {
23 | setScore((prev) => prev + 1);
24 | }
25 | const updatedSelectedAnswers = [...selectedAnswers];
26 | updatedSelectedAnswers[currentQuestion] = answer;
27 | setSelectedAnswers(updatedSelectedAnswers);
28 | const nextQuestion = currentQuestion + 1;
29 | if (nextQuestion < questions.length) {
30 | setCurrentQuestion(nextQuestion);
31 | } else {
32 | setShowScore(true);
33 | }
34 | };
35 |
36 | const handlePlayAgainClick = () => {
37 | setCurrentQuestion(0);
38 | setShowScore(false);
39 | setScore(0);
40 | setSelectedAnswers([]);
41 | };
42 |
43 | return (
44 |
45 | {showScore ? (
46 |
47 |
Your Score: {score}
48 |
49 |
50 | ) : (
51 | <>
52 | {questions.length > 0 ?
53 | <>
54 |
55 |
56 | {currentQuestion + 1}/{questions.length}
57 |
58 |
{questions[currentQuestion]?.question}
59 |
60 |
61 |
62 | {currentQuestion > 0 && (
63 |
64 | )}
65 | {currentQuestion < questions.length - 1 && (
66 |
67 | )}
68 |
69 | >
70 | :
71 |
Loading...
72 | }
73 | >
74 | )}
75 |
76 | );
77 | };
78 |
79 | export default QuizApp;
80 |
--------------------------------------------------------------------------------
/quiz-app/src/components/Quiz/style.css:
--------------------------------------------------------------------------------
1 | .quiz {
2 | width: 600px;
3 | margin: auto;
4 | padding: 50px;
5 | box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
6 | background-color: #fff;
7 | border-radius: 7px;
8 | }
9 |
10 | .question-section {
11 | font-size: 24px;
12 | font-weight: 600;
13 | margin-bottom: 40px;
14 | }
15 |
16 | .question-count {
17 | font-size: 28px;
18 | margin-bottom: 10px;
19 | text-align: start;
20 | color: rgb(9,9,121);
21 | }
22 |
23 | .question-text {
24 | text-align: start;
25 | margin-bottom: 20px;
26 | }
27 |
28 | .answer-section {
29 | display: flex;
30 | flex-wrap: wrap;
31 | flex-direction: column;
32 | gap: 10px;
33 | }
34 | .answer-options{
35 | text-align: start;
36 |
37 | }
38 | .answer-options:hover{
39 | background-color: #333;
40 | color: #fff;
41 | }
42 |
43 | button {
44 | padding: 10px 20px;
45 | background-color: #fff;
46 | color: #333;
47 | border: 2px solid #333;
48 | border-radius: 5px;
49 | font-size: 16px;
50 | font-weight: bold;
51 | cursor: pointer;
52 | transition: all 0.2s ease-in-out;
53 | }
54 |
55 | button:active {
56 | transform: scale(0.95);
57 | }
58 |
59 | .score-section {
60 | font-size: 24px;
61 | font-weight: bold;
62 | text-align: center;
63 | margin-top: 50px;
64 | }
65 |
66 | .score-section button {
67 | margin-top: 20px;
68 | padding: 10px 20px;
69 | background-color: #333;
70 | color: #fff;
71 | border: none;
72 | border-radius: 5px;
73 | font-size: 16px;
74 | font-weight: bold;
75 | cursor: pointer;
76 | transition: all 0.2s ease-in-out;
77 | }
78 |
79 | .score-section .playAgain-btn:hover {
80 | background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgb(9, 9, 121) 35%, rgba(0,212,255,1) 100%);
81 | }
82 |
83 | .navigation-buttons{
84 | margin-top: 35px;
85 | display: flex;
86 | gap: 20px;
87 | justify-content: center;
88 | }
89 | .navigation-buttons button:hover{
90 | color: #fff;
91 | background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%);
92 | }
--------------------------------------------------------------------------------
/quiz-app/src/index.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Anek+Malayalam:wght@100;200;300;400;500;600;700;800&display=swap');
2 | body {
3 | margin: 0;
4 | font-family: 'Anek Malayalam', sans-serif;
5 | }
6 |
--------------------------------------------------------------------------------
/quiz-app/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/quiz-app/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quiz-app/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/quiz-app/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `npm start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 |
14 | The page will reload when you make changes.\
15 | You may also see any lint errors in the console.
16 |
17 | ### `npm test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `npm run build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `npm run eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 |
36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 |
40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `npm run build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tic-tac-toe-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.5",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.2.0",
10 | "react-dom": "^18.2.0",
11 | "react-scripts": "5.0.1",
12 | "web-vitals": "^2.1.4"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject"
19 | },
20 | "eslintConfig": {
21 | "extends": [
22 | "react-app",
23 | "react-app/jest"
24 | ]
25 | },
26 | "browserslist": {
27 | "production": [
28 | ">0.2%",
29 | "not dead",
30 | "not op_mini all"
31 | ],
32 | "development": [
33 | "last 1 chrome version",
34 | "last 1 firefox version",
35 | "last 1 safari version"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/tic-tac-toe-app/public/favicon.ico
--------------------------------------------------------------------------------
/tic-tac-toe-app/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 | Tic-tac-toe
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/tic-tac-toe-app/public/logo192.png
--------------------------------------------------------------------------------
/tic-tac-toe-app/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/tic-tac-toe-app/public/logo512.png
--------------------------------------------------------------------------------
/tic-tac-toe-app/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/src/App.css:
--------------------------------------------------------------------------------
1 | *{
2 | box-sizing: border-box;
3 | }
4 | .App {
5 | display: flex;
6 | flex-direction: column;
7 | align-items: center;
8 | justify-content: center;
9 | height: 100vh;
10 | background-color: #d5b4ff;
11 | }
--------------------------------------------------------------------------------
/tic-tac-toe-app/src/App.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import "./App.css";
3 | import TicTacToe from "./components/TicTacToe";
4 |
5 | function App() {
6 | return (
7 |
8 |
9 |
10 | );
11 | }
12 |
13 | export default App;
14 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/src/components/GameBoard/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import './style.css'
3 |
4 | const GameBoard = ({ winner,currentPlayer,winningCells,handleCellClick,resetGame,board }) => {
5 | return (
6 |
7 | {winner ? winner === "draw" ? (
8 |
It's a draw!
9 | ) : (
10 |
Player
11 | {winner} wins!
12 |
13 | ) :
Current Player:
14 | {currentPlayer}
15 |
}
16 |
17 | {board.map((cell, index) => (
18 |
handleCellClick(index)}
22 | >
23 | {cell}
24 |
25 | ))}
26 |
27 | {winner && (
28 |
29 |
30 |
31 | )}
32 | )
33 | }
34 |
35 | export default GameBoard
--------------------------------------------------------------------------------
/tic-tac-toe-app/src/components/GameBoard/style.css:
--------------------------------------------------------------------------------
1 |
2 | p.winner-title{
3 | font-weight: 600;
4 | font-size: 18px;
5 | }
6 | p.winner-title span.X{
7 | color: #ff5722;
8 | }
9 | p.winner-title span.O{
10 | color: #2196f3;
11 | }
12 | .game-board{
13 | text-align: center;
14 | }
15 |
16 | .board {
17 | display: grid;
18 | grid-template-columns: repeat(3, 1fr);
19 | grid-gap: 10px;
20 | max-width: 400px;
21 | margin-bottom: 40px;
22 | }
23 |
24 | .cell {
25 | display: flex;
26 | align-items: center;
27 | justify-content: center;
28 | background-color: #fff;
29 | color: #333;
30 | font-size: 48px;
31 | cursor: pointer;
32 | border-radius: 8px;
33 | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
34 | transition: background-color 0.3s, color 0.3s;
35 | width: 100px;
36 | height: 100px;
37 | }
38 |
39 | .cell:hover {
40 | background-color: #f1f1f1;
41 | }
42 |
43 | .X {
44 | color: #ff5722;
45 | }
46 |
47 | .O {
48 | color: #2196f3;
49 | }
50 |
51 | .cell.winning.X {
52 | animation: blink 1s infinite;
53 | border: 2px solid #ff5722;
54 | }
55 |
56 | .cell.winning.O {
57 | border: 2px solid #2196f3;
58 | animation: blink 1s infinite;
59 | }
60 |
61 | .message {
62 | margin-top: 20px;
63 | font-size: 24px;
64 | }
65 |
66 | button {
67 | padding: 10px 20px;
68 | background-color: #9544ff;
69 | color: #fff;
70 | border: none;
71 | border-radius: 4px;
72 | font-size: 16px;
73 | cursor: pointer;
74 | transition: background-color 0.3s;
75 | }
76 |
77 | button:hover {
78 | background-color: #8427ff;
79 | }
80 |
81 | @keyframes blink {
82 | 50% {
83 | border: 2px solid #ffffff;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/src/components/TicTacToe/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import GameBoard from '../GameBoard';
3 | import './style.css'
4 |
5 | const initialBoard = Array(9).fill(null);
6 |
7 | const TicTacToe = () => {
8 | const [board, setBoard] = useState(initialBoard);
9 | const [currentPlayer, setCurrentPlayer] = useState("X");
10 | const [winner, setWinner] = useState(null);
11 | const [winningCells, setWinningCells] = useState([])
12 |
13 | const handleCellClick = (index) => {
14 | if (board[index] || winner) {
15 | return;
16 | }
17 | const newBoard = [...board];
18 | newBoard[index] = currentPlayer;
19 | setBoard(newBoard);
20 |
21 | checkWinner(newBoard);
22 | setCurrentPlayer(currentPlayer === "X" ? "O" : "X");
23 | };
24 |
25 | const checkWinner = (board) => {
26 | const winningConditions = [
27 | [0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6],
28 | [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6],
29 | ];
30 |
31 | for (let condition of winningConditions) {
32 | const [a, b, c] = condition;
33 | if (board[a] && board[a] === board[b] && board[a] === board[c]) {
34 | setWinner(board[a]);
35 | setWinningCells([a, b, c])
36 | return;
37 | }
38 | }
39 |
40 | if (board.every((cell) => cell !== null)) {
41 | setWinner("draw");
42 | }
43 | };
44 |
45 | const resetGame = () => {
46 | setBoard(initialBoard);
47 | setCurrentPlayer("X");
48 | setWinner(null);
49 | setWinningCells([])
50 | };
51 | return (
52 |
53 |
Tic-Tac-Toe
54 |
57 |
58 | )
59 | }
60 |
61 | export default TicTacToe
--------------------------------------------------------------------------------
/tic-tac-toe-app/src/components/TicTacToe/style.css:
--------------------------------------------------------------------------------
1 | h1.app-title {
2 | font-size: 36px;
3 | margin-bottom: 20px;
4 | color: #ff5722;
5 | text-align: center;
6 | }
7 |
8 | h1.app-title span {
9 | color: #2196f3;
10 | }
--------------------------------------------------------------------------------
/tic-tac-toe-app/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'));
7 | root.render(
8 |
9 |
10 |
11 | );
12 |
--------------------------------------------------------------------------------
/tic-tac-toe-app/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tip-calculator/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/tip-calculator/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `npm start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 |
14 | The page will reload when you make changes.\
15 | You may also see any lint errors in the console.
16 |
17 | ### `npm test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `npm run build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `npm run eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 |
36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 |
40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `npm run build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/tip-calculator/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tip-calculator",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.5",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.2.0",
10 | "react-dom": "^18.2.0",
11 | "react-scripts": "5.0.1",
12 | "web-vitals": "^2.1.4"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject"
19 | },
20 | "eslintConfig": {
21 | "extends": [
22 | "react-app",
23 | "react-app/jest"
24 | ]
25 | },
26 | "browserslist": {
27 | "production": [
28 | ">0.2%",
29 | "not dead",
30 | "not op_mini all"
31 | ],
32 | "development": [
33 | "last 1 chrome version",
34 | "last 1 firefox version",
35 | "last 1 safari version"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tip-calculator/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/tip-calculator/public/favicon.ico
--------------------------------------------------------------------------------
/tip-calculator/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 |
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/tip-calculator/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/tip-calculator/public/logo192.png
--------------------------------------------------------------------------------
/tip-calculator/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/tip-calculator/public/logo512.png
--------------------------------------------------------------------------------
/tip-calculator/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/tip-calculator/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/tip-calculator/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | min-height: 100vh;
3 | display: flex;
4 | align-items: center;
5 | justify-content: center;
6 | }
--------------------------------------------------------------------------------
/tip-calculator/src/App.js:
--------------------------------------------------------------------------------
1 | import logo from './logo.svg';
2 | import './App.css';
3 | import TipCalculator from './components/TipCalculator';
4 |
5 | function App() {
6 | return (
7 |
8 |
9 |
10 | );
11 | }
12 |
13 | export default App;
14 |
--------------------------------------------------------------------------------
/tip-calculator/src/components/TipCalculator/CalcForm.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const CalcForm = ({ state, handleChange, calculateTotalAmount }) => {
4 | const predefinedTipPercentages = [10, 15, 20, 25];
5 | return (
6 |
59 | );
60 | };
61 |
62 | export default CalcForm;
63 |
--------------------------------------------------------------------------------
/tip-calculator/src/components/TipCalculator/index.css:
--------------------------------------------------------------------------------
1 | .tip-calculator-containor {
2 | margin: 0 auto;
3 | border-radius: 5px;
4 | padding: 20px;
5 | color: #fff;
6 | background: rgba(255, 255, 255, 0.3);
7 | box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
8 | backdrop-filter: blur(4.5px);
9 | -webkit-backdrop-filter: blur(4.5px);
10 | border-radius: 10px;
11 | border: 1px solid rgba(255, 255, 255, 0.18);
12 | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
13 | }
14 |
15 | .tip-calculator {
16 | width: 425px;
17 | }
18 |
19 | .tip-calculator h1 {
20 | font-size: 24px;
21 | margin-bottom: 20px;
22 | text-align: center;
23 | }
24 |
25 | .tip-calculator label {
26 | font-weight: bold;
27 | display: block;
28 | margin-bottom: 5px;
29 | }
30 |
31 | .tip-calculator input,
32 | .tip-calculator select {
33 | padding: 10px;
34 | width: 100%;
35 | box-sizing: border-box;
36 | margin-bottom: 10px;
37 | color: #fff;
38 | border: none;
39 | border-radius: 5px;
40 | background-color: #ffffff4f;
41 | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
42 | transition: box-shadow 0.3s ease;
43 | }
44 |
45 | .tip-calculator option{
46 | color: #000;
47 | padding: 5px 0;
48 | }
49 |
50 | .tip-calculator input:focus,
51 | .tip-calculator select:focus {
52 | outline: none;
53 | box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
54 | }
55 |
56 | .tip-calculator button {
57 | width: 100%;
58 | font-size: 16px;
59 | font-weight: 600;
60 | color: #fff;
61 | cursor: pointer;
62 | margin-top: 10px;
63 | padding: 15px 0;
64 | text-align: center;
65 | border: none;
66 | background-size: 300% 100%;
67 | border-radius: 10px;
68 | background-image: linear-gradient(
69 | to right,
70 | #25aae1,
71 | #40e495,
72 | #30dd8a,
73 | #2bb673
74 | );
75 | box-shadow: 0 4px 15px 0 rgba(49, 196, 190, 0.75);
76 | -o-transition: all 0.4s ease-in-out;
77 | -webkit-transition: all 0.4s ease-in-out;
78 | transition: all 0.4s ease-in-out;
79 | }
80 |
81 | .tip-calculator button:hover {
82 | background-position: 100% 0;
83 | -o-transition: all 0.4s ease-in-out;
84 | -webkit-transition: all 0.4s ease-in-out;
85 | transition: all 0.4s ease-in-out;
86 | }
87 |
88 | .tip-calculator h2 {
89 | font-size: 18px;
90 | }
91 |
92 | .tip-calculator .form-group {
93 | margin-bottom: 15px;
94 | }
95 |
96 | .tip-calculator .checkbox-group {
97 | display: flex;
98 | align-items: center;
99 | gap: 10px;
100 | }
101 |
102 | .tip-calculator .checkbox-group label {
103 | margin-bottom: 0;
104 | }
105 |
106 | .tip-calculator .checkbox-group input[type="checkbox"] {
107 | width: auto;
108 | margin-right: 5px;
109 | }
110 |
111 | .tip-calculator .checkbox-group input[type="number"] {
112 | flex: 1;
113 | }
114 |
--------------------------------------------------------------------------------
/tip-calculator/src/components/TipCalculator/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 | import "./index.css";
3 | import CalcForm from "./CalcForm";
4 |
5 | function TipCalculator() {
6 | const [state, setState] = useState({
7 | billAmount: "",
8 | tipPercentage: "",
9 | customTipPercentage: "",
10 | totalAmount: 0,
11 | tipAmount: 0,
12 | splitCount: 1,
13 | splitAmount: 0,
14 | includeTax: false,
15 | taxPercentage: "",
16 | });
17 |
18 | const handleChange = (e) => {
19 | const { name, value, type, checked } = e.target;
20 | const newValue = type === 'checkbox' ? checked : value;
21 |
22 | setState((prevState) => ({
23 | ...prevState,
24 | [name]: newValue
25 | }));
26 | };
27 |
28 | const calculateTotalAmount = () => {
29 | let bill = parseFloat(state.billAmount);
30 | let tip = 0;
31 |
32 | if (state.includeTax && state.taxPercentage) {
33 | const tax = (bill * parseFloat(state.taxPercentage)) / 100;
34 | bill += tax;
35 | }
36 |
37 | if (state.tipPercentage) {
38 | tip = (bill * parseFloat(state.tipPercentage)) / 100;
39 | } else if (state.customTipPercentage) {
40 | tip = (bill * parseFloat(state.customTipPercentage)) / 100;
41 | }
42 |
43 | const total = bill + tip;
44 | const split = total / state.splitCount;
45 |
46 | setState({
47 | ...state,
48 | totalAmount: total.toFixed(2),
49 | tipAmount: tip.toFixed(2),
50 | splitAmount: split.toFixed(2),
51 | });
52 | };
53 |
54 | return (
55 |
56 |
61 |
62 | );
63 | }
64 |
65 | export default TipCalculator;
66 |
--------------------------------------------------------------------------------
/tip-calculator/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | background: rgb(2,0,36);
7 | background: -moz-linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%);
8 | background: -webkit-linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%);
9 | background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%);
10 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#020024",endColorstr="#00d4ff",GradientType=1);
11 | }
12 |
13 | code {
14 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
15 | monospace;
16 | }
17 |
--------------------------------------------------------------------------------
/tip-calculator/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'));
7 | root.render(
8 |
9 |
10 |
11 | );
12 |
--------------------------------------------------------------------------------
/tip-calculator/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/todo-app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/todo-app/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 | ### `npm start`
9 |
10 | Runs the app in the development mode.\
11 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
12 |
13 | The page will reload when you make changes.\
14 | You may also see any lint errors in the console.
15 |
16 | ### `npm test`
17 |
18 | Launches the test runner in the interactive watch mode.\
19 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
20 |
21 | ### `npm run build`
22 |
23 | Builds the app for production to the `build` folder.\
24 | It correctly bundles React in production mode and optimizes the build for the best performance.
25 |
26 | The build is minified and the filenames include the hashes.\
27 | Your app is ready to be deployed!
28 |
29 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
30 |
31 | ### `npm run eject`
32 |
33 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
34 |
35 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
36 |
37 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
38 |
39 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
40 |
41 | ## Learn More
42 |
43 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
44 |
45 | To learn React, check out the [React documentation](https://reactjs.org/).
46 |
47 | ### Code Splitting
48 |
49 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
50 |
51 | ### Analyzing the Bundle Size
52 |
53 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
54 |
55 | ### Making a Progressive Web App
56 |
57 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
58 |
59 | ### Advanced Configuration
60 |
61 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
62 |
63 | ### Deployment
64 |
65 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
66 |
67 | ### `npm run build` fails to minify
68 |
69 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
70 |
--------------------------------------------------------------------------------
/todo-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "todo-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.5",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.2.0",
10 | "react-dom": "^18.2.0",
11 | "react-icons": "^4.7.1",
12 | "react-scripts": "5.0.1",
13 | "react-switch": "^7.0.0",
14 | "web-vitals": "^2.1.4"
15 | },
16 | "scripts": {
17 | "start": "react-scripts start",
18 | "build": "react-scripts build",
19 | "test": "react-scripts test",
20 | "eject": "react-scripts eject"
21 | },
22 | "eslintConfig": {
23 | "extends": [
24 | "react-app",
25 | "react-app/jest"
26 | ]
27 | },
28 | "browserslist": {
29 | "production": [
30 | ">0.2%",
31 | "not dead",
32 | "not op_mini all"
33 | ],
34 | "development": [
35 | "last 1 chrome version",
36 | "last 1 firefox version",
37 | "last 1 safari version"
38 | ]
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/todo-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/todo-app/public/favicon.ico
--------------------------------------------------------------------------------
/todo-app/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 | ToDo App
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/todo-app/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/todo-app/public/logo192.png
--------------------------------------------------------------------------------
/todo-app/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imtiyazCode/reactMiniProjects/13907090f161b94d3682febc7f276f7a9d917c79/todo-app/public/logo512.png
--------------------------------------------------------------------------------
/todo-app/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/todo-app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/todo-app/src/App.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | padding: 0;
4 | box-sizing: border-box;
5 | }
6 |
7 | .App {
8 | text-align: center;
9 | width: 100vw;
10 | min-height: 100vh;
11 | padding-top: 55px;
12 | }
13 |
14 | .app-title-container{
15 | padding: 25px;
16 | margin-bottom: 15px;
17 | }
18 | .lightMode-app-title-container{
19 | background-color: #ffe4c4;
20 | }
21 | .darkMode-app-title-container{
22 | background-color: #444;
23 | }
24 | .app-title{
25 | font-weight: bold;
26 | }
27 | .darkMode-App {
28 | background-color: #333;
29 | color: #fff;
30 | }
31 |
32 | .lightMode-App {
33 | background-color: antiquewhite;
34 | }
35 |
36 | /* .tasks-container {
37 | width: 550px;
38 | max-width: 65vw;
39 | margin: auto;
40 | margin-top: 55px;
41 | padding: 15px;
42 | border-radius: 5px;
43 | } */
44 |
45 | .single-task {
46 | display: flex;
47 | justify-content: space-between;
48 | align-items: center;
49 | margin-bottom: 5px;
50 | padding: 5px 15px;
51 | background-color: #c7e5ee;
52 | border-radius: 3px;
53 | box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
54 | }
55 |
56 | .action-btn {
57 | padding: 15px;
58 | align-items: center;
59 | margin: 0 4px;
60 | border: none;
61 | border-radius: 3px;
62 | font-size: 20px;
63 | display: inline-flex;
64 | }
65 |
66 | .task-title {
67 | font-size: 20px;
68 | font-weight: 400;
69 | text-align: left;
70 | }
71 |
72 | .check-sun-btn,
73 | .check-moon-btn {
74 | padding-top: 4.5px;
75 | padding-left: 6px;
76 | }
--------------------------------------------------------------------------------
/todo-app/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import { useState, useEffect } from 'react';
3 | import Switch from "react-switch";
4 | import { BsSunFill, BsFillMoonStarsFill } from 'react-icons/bs'
5 | import TaskContainer from './Components/TaskContainer';
6 |
7 | function App() {
8 |
9 | const [tasks, setTasks] = useState([])
10 | const [dark, setDark] = useState(true);
11 |
12 | useEffect(() => {
13 | let myTodo = localStorage.getItem('myTodoTasks');
14 | if (myTodo) {
15 | setTasks(JSON.parse(myTodo))
16 | }
17 | }, [])
18 |
19 | return (
20 |
21 |
22 |
ToDo App
23 |
24 |
setDark(!dark)}
27 | uncheckedIcon={
}
28 | checkedIcon={
} />
29 |
30 |
31 |
32 | );
33 | }
34 |
35 | export default App;
36 |
--------------------------------------------------------------------------------
/todo-app/src/Components/Task/Task.css:
--------------------------------------------------------------------------------
1 | .box-tasks-container {
2 | display: flex;
3 | width: 900px;
4 | max-width: 92vw;
5 | flex-wrap: wrap;
6 | margin: auto;
7 | margin-top: 55px;
8 | padding: 15px;
9 | border-radius: 5px;
10 | }
11 |
12 | .box-task-container {
13 | display: flex;
14 | text-align: left;
15 | min-width: 250px;
16 | flex: 1 0 21%;
17 | margin: 5px;
18 | border-radius: 8px;
19 | justify-content: space-between;
20 | }
21 |
22 | .lightMode-task-container {
23 | background-color: #ffe4c4;
24 | }
25 |
26 | .darkMode-task-container {
27 | color: #fff;
28 | background-color: #444;
29 | }
30 |
31 | .box-task {
32 | padding: 15px 0;
33 | margin-left: 25px;
34 | }
35 |
36 | .box-task-title {
37 | font-size: 1.1rem;
38 | font-weight: bold;
39 | margin-bottom: 8px;
40 | text-transform: capitalize;
41 | }
42 |
43 | .darkMode-task-title {
44 | color: #ff9a00;
45 | }
46 |
47 | .box-task-action {
48 | padding: 15px 10px;
49 | display: flex;
50 | height: 100%;
51 | flex-direction: column;
52 | box-sizing: border-box;
53 | justify-content: space-around;
54 | border-left: 1px solid #8b8b8b;
55 | }
56 |
57 | .box-task-btn {
58 | display: flex;
59 | padding: 8px;
60 | align-items: center;
61 | margin: 0 4px;
62 | border: none;
63 | outline: none;
64 | border-radius: 3px;
65 | cursor: pointer;
66 | }
67 |
68 | .lightMode-task-completed {
69 | margin-bottom: 5px;
70 | color: #27ce4b;
71 | background-color: #fff;
72 | }
73 |
74 | .lightMode-task-completed:hover {
75 | background-color: #27ce4b;
76 | color: #fff;
77 | }
78 |
79 | .lightMode-task-remove {
80 | color: #ce2727;
81 | background-color: #fff;
82 | }
83 |
84 | .lightMode-task-remove:hover {
85 | color: #fff;
86 | background-color: #ce2727;
87 | }
88 |
89 | .darkMode-task-completed {
90 | margin-bottom: 5px;
91 | color: #00da12;
92 | background-color: #e0e0e09a;
93 | }
94 |
95 | .darkMode-task-completed:hover {
96 | background-color: #00da1275;
97 | color: #e0e0e0;
98 | }
99 |
100 | .darkMode-task-remove {
101 | color: #fc2222;
102 | background-color: #e0e0e09a;
103 | }
104 |
105 | .darkMode-task-remove:hover {
106 | color: #e0e0e0;
107 | background-color: #f8000085;
108 | }
109 |
110 | /* / Making responsive / */
111 | @media only screen and (max-width: 600px) {
112 | .box-tasks-container {
113 | margin-top: 24px;
114 | }
115 | }
116 |
117 | @media only screen and (max-width: 310px) {
118 | .box-task-container {
119 | min-width: 75vw;
120 | }
121 |
122 | .box-tasks-container {
123 | margin: auto auto;
124 | padding: 5px;
125 | }
126 | }
--------------------------------------------------------------------------------
/todo-app/src/Components/Task/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import './Task.css'
3 | import { MdCancel, MdDoneAll } from 'react-icons/md'
4 |
5 | const Task = ({ task, tasks, setTasks, index, dark }) => {
6 |
7 | const handleComplete = (e) => {
8 | e.preventDefault()
9 | let newTasks = [...tasks];
10 | newTasks[index].completed = !newTasks[index].completed;
11 | setTasks(newTasks);
12 | }
13 |
14 | const saveToLocal = (name, data) => {
15 | localStorage.setItem(name, JSON.stringify(data));
16 | }
17 | const handleRemove = (e) => {
18 | e.preventDefault()
19 | let newTasks = [...tasks];
20 | newTasks.splice(index, 1)
21 | setTasks(newTasks)
22 | saveToLocal("myTodoTask", newTasks);
23 | }
24 |
25 | return (
26 |
27 |
28 |
{task.title}
29 |
{task.description}
30 |
31 |
32 |
33 |
34 |
35 |
)
36 | }
37 |
38 | export default Task
--------------------------------------------------------------------------------
/todo-app/src/Components/TaskContainer/TaskContainer.css:
--------------------------------------------------------------------------------
1 | .add-btn {
2 | padding: 12px 25px;
3 | box-shadow: none;
4 | font-size: 16px;
5 | border: none;
6 | margin: 0 4px;
7 | border-radius: 3px;
8 | cursor: pointer;
9 | }
10 |
11 | .lightMode-add-btn {
12 | background-color: #49ff58;
13 | }
14 |
15 | .darkMode-add-btn {
16 | color: #fff;
17 | background-color: #07a714;
18 | }
19 |
20 | .add-btn:hover {
21 | background-color: #02b611;
22 | }
23 |
24 | .input-form {
25 | width: 850px;
26 | max-width: 85vw;
27 | margin: 30px auto;
28 | outline: none;
29 | display: flex;
30 | }
31 |
32 | .task-input {
33 | padding: 10px 20px;
34 | outline: none;
35 | border: none;
36 | font-size: 16px;
37 | border-radius: 5px;
38 | width: 70%;
39 | margin: 0 2px;
40 | }
41 |
42 | .task-done-btn {
43 | background: #a9fdb0;
44 | }
45 |
46 | .task-done-btn:hover {
47 | background: #01bd7e;
48 | }
49 |
50 | .task-remove-btn {
51 | background: #fda9a9;
52 | }
53 |
54 | .task-remove-btn:hover {
55 | background: #ff8181;
56 | }
57 |
58 | /* / Making responsive / */
59 | @media only screen and (max-width: 600px) {
60 | .input-form {
61 | flex-direction: column;
62 | justify-content: center;
63 | align-items: center;
64 | }
65 |
66 | .task-input {
67 | margin-bottom: 10px;
68 | }
69 |
70 | .task-input {
71 | width: 90%;
72 | }
73 | }
--------------------------------------------------------------------------------
/todo-app/src/Components/TaskContainer/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import Task from '../Task'
3 | import './TaskContainer.css'
4 |
5 | const TaskContainer = ({ tasks, setTasks, dark }) => {
6 |
7 | const [todo, setTodo] = useState({ completed: false, title: "", description: "" })
8 |
9 | const handleSubmit = (e) => {
10 | e.preventDefault();
11 | if (todo.title) {
12 | let newTask = { ...todo }
13 | let newTasks = [...tasks, newTask]
14 | setTasks(newTasks)
15 | setTodo({ title: '', description: '', completed: false })
16 | localStorage.setItem("myTodoTasks", JSON.stringify(newTasks));
17 | }
18 | }
19 |
20 | const handleChange = (e) => {
21 | setTodo({ ...todo, [e.target.name]: e.target.value })
22 | }
23 |
24 | return (
25 |
26 |
36 |
37 |
38 | {tasks?.map((task, i) => {
39 | return
40 | })}
41 |
42 |
43 | )
44 | }
45 |
46 | export default TaskContainer
--------------------------------------------------------------------------------
/todo-app/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/todo-app/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'));
7 | root.render(
8 |
9 |
10 |
11 | );
--------------------------------------------------------------------------------