Commit 5a52d8a6 by Madhankumar

design and font change

parent 9d1a0e79
{ {
"task": [ "task": [
{ {
"title": "rhrhrhrytyty", "title": "Travel to head office",
"isCompleted": false, "isCompleted": false,
"id": 1 "id": 1
},
{
"title": "Buy food",
"isCompleted": true,
"id": 2
} }
] ]
} }
\ No newline at end of file
.container { .container {
min-height: 50vh; min-height: 40vh;
width: min(100dvw - 5rem);
height: auto;
margin-inline: auto; margin-inline: auto;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
background: white; background: white;
position: relative; position: relative;
} }
.container h2 { .container h2 {
box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px; box-shadow: rgba(0, 0, 0, 0.04) 0px 3px 5px;
border: 1px solid #ccc; border: none;
text-align: center; text-align: center;
padding: 1.3rem 0px; padding: 1.3rem 0px;
margin: 0; margin: 0;
font-weight: 800px; position: relative;
background: white; z-index: 1;
} }
h3 { h3 {
margin-left: 1rem; margin-left: 1rem;
......
.form-section { .form-section {
width: calc(100% - 2.5rem);
padding: 1rem; padding: 1rem;
background: white; background: white;
} }
......
...@@ -23,7 +23,7 @@ function Task({ id = 1, title, isCompleted, onChange, onDelete }) { ...@@ -23,7 +23,7 @@ function Task({ id = 1, title, isCompleted, onChange, onDelete }) {
// (useCallback)---> to avoid calling the checkbox component without any action applied on checkbox // (useCallback)---> to avoid calling the checkbox component without any action applied on checkbox
const handleChange = useCallback(() => { const handleChange = useCallback(() => {
setIsCheck(!ischeck); setIsCheck(!ischeck);
onChange({ id, isCompleted: !ischeck }); onChange({ id, title, isCompleted: !ischeck });
toast.success( toast.success(
`${!ischeck ? "Task completed" : "Task not completed"}`, `${!ischeck ? "Task completed" : "Task not completed"}`,
"success" "success"
...@@ -49,7 +49,7 @@ function Task({ id = 1, title, isCompleted, onChange, onDelete }) { ...@@ -49,7 +49,7 @@ function Task({ id = 1, title, isCompleted, onChange, onDelete }) {
//after 2 second it will execute //after 2 second it will execute
const handler = setTimeout(() => { const handler = setTimeout(() => {
if (textarea_ref.current.value !== title) { if (textarea_ref.current.value !== title) {
onChange({ id, title: debouncetitle }); onChange({ id, title: debouncetitle, isCompleted: !ischeck });
toast.success("Task updated"); toast.success("Task updated");
} }
}, 2000); }, 2000);
......
.task-section { .task-section {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0.5rem 0.8rem; padding: 0.3rem 0.8rem;
justify-content: space-between; justify-content: space-between;
background: white; border-top: 1px solid #ccc;
box-shadow: rgba(0, 0, 0, 0.06) 0px 2px 4px 0px inset; /* box-shadow: rgba(0, 0, 0, 0.06) 0px 2px 4px 0px inset; */
clip-path: inset(0 -100vmax); clip-path: inset(0 -100vmax);
} }
.task-section:first-child {
border-top: none;
}
.task-section > div { .task-section > div {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -30,10 +33,12 @@ input:focus { ...@@ -30,10 +33,12 @@ input:focus {
width: 100%; width: 100%;
resize: none; resize: none;
border: none; border: none;
border-bottom: 1px solid #ccc;
outline: none; outline: none;
margin: 0.3rem; margin: 20px 0px 0px 5px;
padding: 0; padding: 0;
font-size: 17px;
color: #8e8d8d;
font-family: "Open Sans", sans-serif;
} }
.task-section textarea::-webkit-scrollbar { .task-section textarea::-webkit-scrollbar {
......
@import url('https://fonts.googleapis.com/css2?family=PT+Sans:wght@600&family=Poppins:wght@600&display=swap'); /* @import url("https://fonts.googleapis.com/css2?family=PT+Sans:wght@600&family=Poppins:wght@600&display=swap"); */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans&family=PT+Sans&display=swap");
body { body {
margin: 0; margin: 0;
font-family: "Open Sans", sans-serif;
font-family: "PT Sans", sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
background-image: -webkit-linear-gradient( background-image: -webkit-linear-gradient(
......
...@@ -15,12 +15,12 @@ export async function addTodo({ title, isCompleted }) { ...@@ -15,12 +15,12 @@ export async function addTodo({ title, isCompleted }) {
} }
} }
//PATCH METHOD //PATCH METHOD
export async function updateTodo({ id, ...item }) { export async function updateTodo({ id, title, isCompleted }) {
try { try {
await fetch(url + `/${id}`, { await fetch(url + `/${id}`, {
method: "PATCH", method: "PATCH",
headers: { "Content-type": "application/json" }, headers: { "Content-type": "application/json" },
body: JSON.stringify({ ...item }), body: JSON.stringify({ title, isCompleted }),
}); });
const response = await getTodos(); const response = await getTodos();
return response; return response;
......
...@@ -11,7 +11,7 @@ export default function Pages() { ...@@ -11,7 +11,7 @@ export default function Pages() {
getTodos(); getTodos();
}, []); }, []);
return ( return (
<div> <>
<Layout count={todo?.filter((e) => !e.isCompleted).length}> <Layout count={todo?.filter((e) => !e.isCompleted).length}>
{todo?.length > 0 ? ( {todo?.length > 0 ? (
<Tasks tasks={todo} onChange={updateTodo} onDelete={deleteTodo} /> <Tasks tasks={todo} onChange={updateTodo} onDelete={deleteTodo} />
...@@ -20,6 +20,6 @@ export default function Pages() { ...@@ -20,6 +20,6 @@ export default function Pages() {
)} )}
<Form onSubmit={addTodo} /> <Form onSubmit={addTodo} />
</Layout> </Layout>
</div> </>
); );
} }
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