Commit 634590c3 by Manivasagam S

style changed

parent 341f0210
import React from "react"; import React from "react";
import styles from "../styles/TodoForm.module.css"; import styles from "./TodoForm.module.css";
const TodoForm = ({ input, error, handleInputChange, handleSubmit }) => { const TodoForm = ({ input, error, handleInputChange, handleSubmit }) => {
return ( return (
<div>
<form className={styles.form} onSubmit={handleSubmit}> <form className={styles.form} onSubmit={handleSubmit}>
<div className={styles['input-wrapper']}> <div className={styles['input-wrapper']}>
<input <input
...@@ -17,7 +17,7 @@ const TodoForm = ({ input, error, handleInputChange, handleSubmit }) => { ...@@ -17,7 +17,7 @@ const TodoForm = ({ input, error, handleInputChange, handleSubmit }) => {
</div> </div>
<button type="submit" className={styles.button}>Submit</button> <button type="submit" className={styles.button}>Submit</button>
</form> </form>
</div>
); );
}; };
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
flex-wrap: wrap; flex-wrap: wrap;
gap: 15px; gap: 15px;
padding: 1rem; padding: 1rem;
position: sticky;
bottom: 0;
background-color:white
} }
.input-wrapper { .input-wrapper {
......
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { TiDelete } from "react-icons/ti"; import { TiDelete } from "react-icons/ti";
import styles from "../styles/TodoItem.module.css"; import styles from "./TodoItem.module.css";
const TodoItem = ({ item, handleToggleComplete, handleUpdate, handleDelete, error }) => { const TodoItem = ({ item, handleToggleComplete, handleUpdate, handleDelete, error }) => {
const [showConfirm, setShowConfirm] = useState(false); const [showConfirm, setShowConfirm] = useState(false);
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
z-index: 1000;
} }
.modal { .modal {
...@@ -91,7 +92,9 @@ ...@@ -91,7 +92,9 @@
border-radius: 8px; border-radius: 8px;
text-align: center; text-align: center;
max-width: auto; max-width: auto;
margin:0 20px margin:0 20px;
position: relative;
z-index: 1001;
} }
.modalButtons { .modalButtons {
......
import React from "react"; import React from "react";
import TodoItem from "./TodoItem"; import TodoItem from "../TodoItem/TodoItem";
import styles from "../Styles/TodoList.module.css"; import styles from "./TodoList.module.css";
const TodoList = ({ todos, handleToggleComplete, handleUpdate, handleDelete, updateErrors }) => ( const TodoList = ({ todos, handleToggleComplete, handleUpdate, handleDelete, updateErrors }) => (
<ul className={styles.task}> <ul className={styles.task}>
......
...@@ -2,7 +2,5 @@ ...@@ -2,7 +2,5 @@
ul { ul {
margin: 0; margin: 0;
padding: 0; padding: 0;
max-height: 84vh; /* max-height: 84vh; */
overflow-y: auto;
scroll-behavior: smooth;
} }
{ {
"todos": [ "todos": [
{ {
"id": "f87f", "id": "4a27",
"text": "vjbdcbdxcvfdvdvfvfxvfrgrv", "text": "Buy Groceries tommorrow",
"completed": false "completed": false
}, },
{ {
"id": "ed2b", "id": "1aa1",
"text": " bbbzdfbdfff", "text": "Travel to head office",
"completed": false "completed": false
}, },
{ {
"id": "d7e7", "id": "274c",
"text": "sdfgdsfg", "text": "hsdfds",
"completed": false "completed": false
}, },
{ {
"id": "2ccd", "id": "e40e",
"text": "dfhgfhdfh", "text": "rege",
"completed": false "completed": false
}, },
{ {
"id": "9b94", "id": "a146",
"text": "dfghdfgh", "text": "gergr",
"completed": false
},
{
"id": "4dc6",
"text": "cbvcbv",
"completed": false
},
{
"id": "c6d8",
"text": "ngnn",
"completed": false
},
{
"id": "6838",
"text": "gnfgn",
"completed": false
},
{
"id": "fe38",
"text": "gngfn",
"completed": false
},
{
"id": "02d1",
"text": "ngfng",
"completed": false
},
{
"id": "78c1",
"text": "gngfn",
"completed": false
},
{
"id": "7a0c",
"text": "gngfn",
"completed": false
},
{
"id": "0698",
"text": "gngn",
"completed": false
},
{
"id": "81af",
"text": "fgnfgn",
"completed": false
},
{
"id": "9219",
"text": "gngn",
"completed": false
},
{
"id": "24d0",
"text": "gngn",
"completed": false
},
{
"id": "8053",
"text": "ngn",
"completed": false "completed": false
} }
] ]
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import {getTodos,addTodo,deleteTodo,updateTodo} from "../api/todo"; import {getTodos,addTodo,deleteTodo,updateTodo} from "../api/todo";
import TodoList from "../component/TodoList"; import TodoList from "../component/TodoList/TodoList.jsx";
import TodoForm from "../component/TodoForm"; import TodoForm from "../component/TodoForm/TodoForm.jsx";
import styles from "../Styles/Todo.module.css"; import styles from "./Todo.module.css";
function Todo() { function Todo() {
const [todos, setTodos] = useState([]); const [todos, setTodos] = useState([]);
...@@ -83,9 +83,12 @@ const handleSubmit = async (e) => { ...@@ -83,9 +83,12 @@ const handleSubmit = async (e) => {
return ( return (
<div className={styles.wrapper}> <div className={styles.wrapper}>
<div className={styles.container}> <div className={styles.container}>
<h1 className={styles.title}> <div className={styles.wrap}>
<h1 className={styles.title}>
You have {todos.length} {todos.length === 1 ? "Todo" : "Todos"} You have {todos.length} {todos.length === 1 ? "Todo" : "Todos"}
</h1> </h1>
</div>
{todos.length === 0 ? ( {todos.length === 0 ? (
<p className={styles.message}>No task</p> <p className={styles.message}>No task</p>
) : ( ) : (
......
...@@ -7,10 +7,14 @@ ...@@ -7,10 +7,14 @@
background-color: #f5f5f5; background-color: #f5f5f5;
background-image: radial-gradient(#ccc 0.5px, transparent 1px); background-image: radial-gradient(#ccc 0.5px, transparent 1px);
background-size: 10px 10px; background-size: 10px 10px;
}
.wrap{
position: sticky;
top:0;
} }
.wrapper { .wrapper {
height: 100vh; min-height: 100vh;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
...@@ -34,6 +38,9 @@ ...@@ -34,6 +38,9 @@
font-family: system-ui; font-family: system-ui;
padding: 1rem; padding: 1rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
position: sticky;
top: 0;
background-color:white;
} }
.message { .message {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment