Skip to content

Commit

Permalink
Merge pull request #725 from saketh-05/fixes
Browse files Browse the repository at this point in the history
Implementation of ToDoList Project
  • Loading branch information
SUGAM-ARORA authored Aug 10, 2024
2 parents 8a8ced8 + a9b9179 commit ad320ba
Show file tree
Hide file tree
Showing 17 changed files with 452 additions and 239 deletions.
313 changes: 161 additions & 152 deletions src/Components/CardMain.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Components/Cardcontainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const Cardcontainer = ({features}) => {
<div className="stat">
<div>
<p>
Developer<span>X</span>
Developer<span>{project.dev}</span>
</p>
</div>
<div>
Expand All @@ -98,7 +98,7 @@ const Cardcontainer = ({features}) => {
<Link to={`/readmore/${project.id}`} className="button btn">
Read More
</Link>
<a href="#" className="button2 btn">
<a href={project.github} className="button2 btn">
Source Code
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Delicious/Delicious.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import homeIcon from '../../img/homeicon.png';
import Card1 from "../../img/card1.jpg";
import Card2 from "../../img/card2.jpg";
import Card3 from "../../img/card3.jpg";
import Card4 from "../../img/card4.jpg";
import Card4 from "../../img/card4.png";
import Card5 from "../../img/card5.jpg";
import Card6 from "../../img/card6.jpg";
import {ThemeContext} from "../../App";
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Readmore.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Readmore = () => {
<div className='dtex'>{feature.text}</div>
</div>
<div className="developer">
Developer-X
Developer-{feature.dev}
</div>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/TopContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import women from "../img/women.jpg";
import Card1 from "./projects/card1.jpg";
import Card2 from "./projects/card2.jpg";
import Card3 from "./projects/card3.jpg";
import Card4 from "./projects/card4.jpg";
import Card4 from "./projects/card4.png";
import Card5 from "./projects/card5.jpg";
import Card6 from "./projects/card6.jpg";
import Card7 from "./projects/card7.png";
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Trending/Trending.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import homeIcon from '../../img/homeicon.png';
import Card1 from "../../img/card1.jpg";
import Card2 from "../../img/card2.jpg";
import Card3 from "../../img/card3.jpg";
import Card4 from "../../img/card4.jpg";
import Card4 from "../../img/card4.png";
import Card5 from "../../img/card5.jpg";
import Card6 from "../../img/card6.jpg";
import './Trending.css';
Expand Down
2 changes: 1 addition & 1 deletion src/Components/cart/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import carticon from './12.png';
import Card1 from "../../img/card1.jpg";
import Card2 from "../../img/card2.jpg";
import Card3 from "../../img/card3.jpg";
import Card4 from "../../img/card4.jpg";
import Card4 from "../../img/card4.png";
import Card5 from "../../img/card5.jpg";
import Card6 from "../../img/card6.jpg";

Expand Down
Binary file removed src/Components/projects/card4.jpg
Binary file not shown.
Binary file added src/Components/projects/card4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
161 changes: 81 additions & 80 deletions src/Components/projects/index.js

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/Projects/ToDoList/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
}
13 changes: 13 additions & 0 deletions src/Projects/ToDoList/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import ToDoList from './ToDoList';
import './App.css'

function App() {

return (
<>
<ToDoList/>
</>
)
}

export default App
70 changes: 70 additions & 0 deletions src/Projects/ToDoList/ToDoList.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { useState } from "react";

function ToDoList(){

const [tasks, setTasks] = useState([]);
const [newTask, setNewTask] = useState("");

function handleInputChange(event){
setNewTask(event.target.value);

};

function addTask(){
if(newTask.trim() != ""){
setTasks(t => [...t, newTask]);
setNewTask("");
}
}

function deleteTask(index){
const updateTasks = tasks.filter((_, i) => i != index);
setTasks(updateTasks);
}

function moveTaskUp(index){
if(index > 0){
const updatedTasks = [...tasks];
[updatedTasks[index], updatedTasks[index - 1]] =
[updatedTasks[index - 1], updatedTasks[index]];
setTasks(updatedTasks);
}
}

function moveTaskDown(index){
if(index < tasks.length - 1){
const updatedTasks = [...tasks];
[updatedTasks[index], updatedTasks[index + 1]] =
[updatedTasks[index + 1], updatedTasks[index]];
setTasks(updatedTasks);
}
}

return(<>
<div className="to-do-list">
<h2> TO - DO - LIST</h2>

<div>
<input type="text"
placeholder="Enter a task..."
value={newTask}
onChange={handleInputChange}
/>
<button className="add-button" onClick={addTask}>ADD</button>
</div>

<ol>
{tasks.map((task, index) => {
<li key={index}>
<span className="text">{task}</span>
<button className="delete-button" onClick={() => deleteTask(index)}>Delete</button>
<button className="move-button" onClick={() => moveTaskUp(index)}>Up👆</button>
<button className="move-button" onClick={() => moveTaskDown(index)}>Down👇</button>
</li>
})}
</ol>
</div>
</>);
};

export default ToDoList
69 changes: 69 additions & 0 deletions src/Projects/ToDoList/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
body{
background-color: rgb(43, 37, 37);
}
.to-do-list{
font-family: Arial, Helvetica, sans-serif;
text-align: center;
margin-top: 10%;
}
h2{
font-size: 4rem;
}
button{
font-size: 1.7rem;
color: aliceblue;
padding: 10px 20px;
cursor: pointer;
border: none;
border-radius: 5px;
transition: background-color 0.5s ease;

}
.add-button{
background-color: rgb(11, 201, 37);
}
.add-button:hover{
background-color: rgb(10, 151, 38)
}
.delete-button{
background-color: rgb(230, 14, 14);
}
.delete-button:hover{
background-color: rgb(137, 8, 8)
}
.move-button{
background-color: rgb(2, 124, 254);
}
.move-button:hover{
background-color: rgb(6, 6, 165);
}

input[type="text"]{
font-size: 1.6rem;
padding: 10px;
}
ol{
padding: 0;
}
li{
font-size: 2rem;
padding: 15px;
background-color: antiquewhite;
font-weight: bold;
border-radius:5px;
display: flex;
align-items: center;

}
.text{
flex: 1;
/* flex-grow: 1;
flex-shrink: 1;
flex-basis: 0%; */
}

.delete-button, .move-button{
padding: 8px 12px;
margin-left: 10px;
font-size: 1.3rem;
}
9 changes: 9 additions & 0 deletions src/Projects/ToDoList/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App.jsx'

createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>,
)
Binary file removed src/img/card4.jpg
Binary file not shown.
Binary file added src/img/card4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ad320ba

Please sign in to comment.