Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
Todos-uptd
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sujeeth AV
Todos-uptd
Commits
71920d0b
Commit
71920d0b
authored
May 12, 2025
by
Sujeeth AV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated components, styles, and added new Checkbox component
parent
6f351ccd
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
458 additions
and
84 deletions
+458
-84
package-lock.json
todo/package-lock.json
+11
-1
package.json
todo/package.json
+2
-1
App.css
todo/src/App.css
+0
-0
Checkbox.jsx
todo/src/Components/Checkbox.jsx
+18
-0
Input.css
todo/src/Components/Input.css
+231
-16
Input.jsx
todo/src/Components/Input.jsx
+90
-39
Header.jsx
todo/src/Header/Header.jsx
+2
-1
Main.css
todo/src/Main/Main.css
+104
-22
Main.jsx
todo/src/Main/Main.jsx
+0
-4
No files found.
todo/package-lock.json
View file @
71920d0b
...
...
@@ -9,7 +9,8 @@
"version"
:
"0.0.0"
,
"dependencies"
:
{
"react"
:
"^19.1.0"
,
"react-dom"
:
"^19.1.0"
"react-dom"
:
"^19.1.0"
,
"react-icons"
:
"^5.5.0"
},
"devDependencies"
:
{
"@eslint/js"
:
"^9.25.0"
,
...
...
@@ -3159,6 +3160,15 @@
"react"
:
"^19.1.0"
}
},
"node_modules/react-icons"
:
{
"version"
:
"5.5.0"
,
"resolved"
:
"https://registry.npmjs.org/react-icons/-/react-icons-5.5.0.tgz"
,
"integrity"
:
"sha512-MEFcXdkP3dLo8uumGI5xN3lDFNsRtrjbOEKDLD7yv76v4wpnEq2Lt2qeHaQOr34I/wPN3s3+N08WkQ+CW37Xiw=="
,
"license"
:
"MIT"
,
"peerDependencies"
:
{
"react"
:
"*"
}
},
"node_modules/react-refresh"
:
{
"version"
:
"0.17.0"
,
"resolved"
:
"https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz"
,
...
...
todo/package.json
View file @
71920d0b
...
...
@@ -11,7 +11,8 @@
},
"dependencies"
:
{
"react"
:
"^19.1.0"
,
"react-dom"
:
"^19.1.0"
"react-dom"
:
"^19.1.0"
,
"react-icons"
:
"^5.5.0"
},
"devDependencies"
:
{
"@eslint/js"
:
"^9.25.0"
,
...
...
todo/src/App.css
deleted
100644 → 0
View file @
6f351ccd
todo/src/Components/Checkbox.jsx
0 → 100644
View file @
71920d0b
import
React
from
'react'
;
export
const
Checkbox
=
({
checked
,
onChange
})
=>
{
const
handleChange
=
(
e
)
=>
{
console
.
log
(
'Checkbox clicked, checked:'
,
e
.
target
.
checked
);
if
(
onChange
)
{
onChange
(
e
);
}
};
return
(
<
input
type=
"checkbox"
checked=
{
checked
}
onChange=
{
handleChange
}
/>
);
};
\ No newline at end of file
todo/src/Components/Input.css
View file @
71920d0b
input
{
height
:
2rem
;
width
:
20rem
;
/* h2,
ul,
li,
form,
.merge {
margin: 0;
padding: 0;
}
input,
button {
height: 2rem;
max-width: 18.5rem;
box-sizing: border-box;
}
.input
.button
button
{
height
:
2rem
;
width
:
5rem
;
text-align
:
center
;
border
:
2px
solid
black
;
padding
:
2px
;
button {
height: 2rem;
text-align: center;
padding: 2px;
}
.button
{
margin-top
:
2rem
;
.delete {
border: none;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
max-width: 1.5rem;
padding: 0;
background-color: #fff;
border: none;
transition: background-color 0.2s ease;
}
ul
{
.delete svg {
height: 1.5rem !important;
width: 1.5rem !important;
color: #ccc;
}
ul {
list-style: none;
word-break: break-word;
width: 100%;
max-width: 340px;
padding: 0;
margin: 0;
}
li {
width: 100%;
box-shadow: 0 1px rgb(120, 120, 120);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.25rem 0;
}
.merge {
display: flex;
justify-content: space-between;
gap: 0.5rem;
margin-top: 1rem;
}
[contenteditable]:focus {
outline: none;
border: none;
}
span[contenteditable] {
border-bottom: 1px dashed #ccc;
cursor: text;
}
.todo {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.6rem;
box-shadow: 0 1px rgb(120, 120, 120);
}
.check {
display: flex;
align-items: center;
gap: 1rem;
flex: 1;
overflow-wrap: anywhere;
}
.task {
cursor: pointer;
outline: none;
width: 100%;
}
li.todo {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.6rem;
box-shadow: 0 1px rgb(120, 120, 120);
}
.check {
display: flex;
align-items: center;
gap: 1rem;
flex: 1;
}
word-break
:
break-words
;
min-width
:
340px
;
.task {
cursor: pointer;
outline: none;
width: auto;
}
.delete {
border: none;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
max-width: 1.5rem;
padding: 0;
background-color: #fff;
transition: background-color 0.2s ease;
}
@media (min-width: 720px) {
input,
button {
width: 14.5rem;
width: 100vw;
}
} */
h2
,
ul
,
li
,
form
,
.merge
{
margin
:
0
;
padding
:
0
;
}
input
,
button
{
height
:
2rem
;
max-width
:
18.5rem
;
box-sizing
:
border-box
;
}
button
{
height
:
2rem
;
text-align
:
center
;
padding
:
2px
;
}
.delete
{
border
:
none
;
border-radius
:
50%
;
cursor
:
pointer
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
max-width
:
1.5rem
;
padding
:
0
;
background-color
:
#fff
;
transition
:
background-color
0.2s
ease
;
}
.delete
svg
{
height
:
1.5rem
!important
;
width
:
1.5rem
!important
;
color
:
#ccc
;
}
ul
{
list-style
:
none
;
word-break
:
break-word
;
width
:
100%
;
max-width
:
340px
;
padding
:
0
;
margin
:
0
;
}
li
{
width
:
100%
;
box-shadow
:
0
1px
rgb
(
120
,
120
,
120
);
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
padding-top
:
1.5rem
;
align-items
:
center
;
padding
:
0.25rem
0
;
max-height
:
80vh
;
}
.merge
{
display
:
flex
;
justify-content
:
space-between
;
gap
:
0.5rem
;
margin-top
:
1rem
;
}
[
contenteditable
]
:focus
{
outline
:
none
;
border
:
none
;
}
span
[
contenteditable
]
{
border-bottom
:
1px
dashed
#ccc
;
cursor
:
text
;
}
.todo
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
0.6rem
;
box-shadow
:
0
1px
rgb
(
120
,
120
,
120
);
}
.check
{
display
:
flex
;
align-items
:
center
;
gap
:
1rem
;
flex
:
1
;
}
.task
{
cursor
:
pointer
;
outline
:
none
;
width
:
auto
;
}
@media
(
min-width
:
720px
)
{
input
,
button
{
width
:
14.5rem
;
width
:
100vw
;
}
.check
input
{
height
:
1.5rem
;
width
:
1.5rem
;
}
}
todo/src/Components/Input.jsx
View file @
71920d0b
import
React
,
{
createContext
,
useState
}
from
'react'
import
'./Input.css'
import
React
,
{
createContext
,
useState
}
from
'react'
;
import
'./Input.css'
;
import
{
MdCancel
}
from
"react-icons/md"
;
import
{
Header
}
from
'../Header/Header'
;
import
{
Checkbox
}
from
'./Checkbox'
;
export
const
MyTask
=
createContext
();
export
const
Input
=
()
=>
{
const
[
task
,
setTask
]
=
useState
(
""
);
const
[
store
,
setStore
]
=
useState
([]);
const
[
editIndex
,
setEditIndex
]
=
useState
(
null
);
const
[
editedTask
,
setEditedTask
]
=
useState
(
""
);
const
Change
=
(
e
)
=>
{
setTask
(
e
.
target
.
value
);
};
const
Add
=
()
=>
{
if
(
task
.
trim
()
===
''
)
return
;
setStore
([...
store
,
task
]);
setTask
(
""
);
};
const
Delete
=
(
id
)
=>
{
const
updated
=
store
.
filter
((
_
,
index
)
=>
index
!==
id
);
setStore
(
updated
);
};
const
startEdit
=
(
index
)
=>
{
setEditIndex
(
index
);
setEditedTask
(
store
[
index
]);
};
const
saveEdit
=
(
index
)
=>
{
if
(
editedTask
.
trim
()
===
''
)
return
;
const
updated
=
[...
store
];
updated
[
index
]
=
editedTask
;
setStore
(
updated
);
setEditIndex
(
null
);
};
export
const
MyTask
=
createContext
();
export
const
Input
=
()
=>
{
const
[
task
,
setTask
]
=
useState
(
""
);
const
[
store
,
setStore
]
=
useState
([]);
const
Change
=
(
e
)
=>
{
setTask
(
e
.
target
.
value
);
}
const
Add
=
()
=>
{
if
(
task
.
trim
()
===
''
)
return
;
setStore
([...
store
,
task
]);
setTask
(
""
);
}
const
Delete
=
(
id
)
=>
{
const
Deleted
=
store
.
filter
((
_
,
index
)
=>
id
!==
index
);
setStore
(
Deleted
);
}
return
(
<
MyTask
.
Provider
value=
{
{
store
,
setStore
}
}
>
<>
<
ul
>
{
store
.
map
((
task
,
index
)
=>
(
<
li
key=
{
index
}
><
span
>
{
task
}
</
span
>
<
button
className=
'delete'
onClick=
{
()
=>
Delete
(
index
)
}
>
Delete
</
button
>
<
MyTask
.
Provider
value=
{
{
store
,
setStore
}
}
>
<>
<
Header
/>
<
ul
>
{
store
.
map
((
item
,
index
)
=>
(
<
li
key=
{
index
}
className=
"todo"
>
<
div
className=
"check"
>
<
Checkbox
/>
{
editIndex
===
index
?
(
<
span
contentEditable
suppressContentEditableWarning
autoFocus
onBlur=
{
()
=>
saveEdit
(
index
)
}
onInput=
{
(
e
)
=>
setEditedTask
(
e
.
currentTarget
.
textContent
)
}
onKeyDown=
{
(
e
)
=>
{
if
(
e
.
key
===
'Enter'
)
{
e
.
preventDefault
();
e
.
currentTarget
.
blur
();
}
}
}
className=
"task"
>
{
editedTask
}
</
span
>
)
:
(
<
span
className=
"task"
onClick=
{
()
=>
startEdit
(
index
)
}
>
{
item
}
</
span
>
)
}
</
div
>
<
button
className=
"delete"
onClick=
{
()
=>
Delete
(
index
)
}
>
<
MdCancel
/>
</
button
>
</
li
>
))
}
</
ul
>
<
form
>
<
div
className=
'input'
>
<
input
type=
'text'
placeholder=
'Enter Items'
value=
{
task
}
onChange=
{
Change
}
/>
</
div
></
form
>
<
div
className=
'button'
>
<
button
onClick=
{
Add
}
>
Submit
</
button
>
</
div
>
<
Header
/>
</>
</
MyTask
.
Provider
>
)
}
))
}
</
ul
>
<
form
onSubmit=
{
(
e
)
=>
e
.
preventDefault
()
}
>
<
div
className=
"merge"
>
<
input
type=
"text"
className=
"input"
placeholder=
"Enter Items"
value=
{
task
}
onChange=
{
Change
}
/>
<
button
onClick=
{
Add
}
className=
"button"
>
Submit
</
button
>
</
div
>
</
form
>
</>
</
MyTask
.
Provider
>
);
};
todo/src/Header/Header.jsx
View file @
71920d0b
...
...
@@ -4,8 +4,9 @@ import { MyTask } from '../Components/Input'
export
const
Header
=
()
=>
{
const
{
store
}
=
useContext
(
MyTask
);
console
.
log
(
'store:'
,
store
)
return
(
<
header
>
<
header
className=
'head'
>
<
h2
>
You have
{
store
.
length
}
Todos
</
h2
>
</
header
>
)
...
...
todo/src/Main/Main.css
View file @
71920d0b
*
{
box-sizing
:
border-box
;
}
body
{
margin
:
0
;
font-family
:
'Segoe UI'
,
Tahoma
,
Geneva
,
Verdana
,
sans-serif
;
font-family
:
"Segoe UI"
,
Tahoma
,
Geneva
,
Verdana
,
sans-serif
;
background
:
#ffffff
;
min-height
:
100vh
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
height
:
100vh
;
width
:
100%
;
background-image
:
radial-gradient
(
#ccc
0.5px
,
transparent
1px
)
;
background-size
:
10px
10px
;
}
.container
{
min-height
:
50
svh
;
width
:
100%
;
/* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
box-shadow
:
0
1px
2px
black
;
display
:
flex
;
flex-direction
:
column
;
flex-shrink
:
1
;
}
.wrapper
{
background-color
:
#ffffff
;
width
:
320px
;
padding
:
20px
;
.container
{
width
:
100vw
;
max-width
:
300px
;
min-height
:
20
svh
;
margin
:
0
auto
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
flex-shrink
:
1
;
}
.head
{
background-color
:
#ffffff
;
width
:
100%
;
background-color
:
#ffffff
;
font-weight
:
bold
;
font-size
:
1
8
px
;
box-shadow
:
0
1px
2px
black
;
font-size
:
1
3
px
;
box-shadow
:
0
1px
black
;
color
:
#000
;
text-align
:
center
;
margin-bottom
:
1rem
;
padding
:
0
;
}
.wrapper
{
width
:
100%
;
max-width
:
300px
;
margin
:
0
auto
;
background-color
:
#ffffff
;
display
:
flex
;
padding
:
2px
;
flex-direction
:
column
;
justify-content
:
center
;
box-shadow
:
0
1px
2px
black
;
}
input
{
max-width
:
18.5rem
;
padding
:
0.4rem
;
font-size
:
1rem
;
margin-bottom
:
0.5rem
;
}
.button
button
{
height
:
1rem
;
width
:
18.5rem
;
text-align
:
center
;
border
:
2px
solid
rgb
(
120
,
120
,
120
);
padding
:
1px
;
cursor
:
pointer
;
background-color
:
#f0f0f0
;
}
ul
{
list-style
:
none
;
word-break
:
break-word
;
width
:
100%
;
max-width
:
100%
;
padding
:
0
;
margin
:
0
;
}
li
{
width
:
100%
;
box-shadow
:
0
1px
rgb
(
120
,
120
,
120
);
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
0.5rem
;
}
.merge
{
display
:
flex
;
flex-direction
:
column
;
width
:
100%
;
}
@media
(
min-width
:
768px
)
{
.wrapper
{
display
:
flex
;
justify-content
:
space-between
;
max-width
:
650px
;
min-height
:
15
svh
;
align-items
:
unset
;
padding
:
1rem
;
}
.container
{
max-width
:
750px
;
min-height
:
25
svh
;
}
input
{
width
:
75%
;
max-width
:
unset
;
margin-top
:
0.5rem
;
}
.check
input
{
width
:
10%
;
}
button
{
height
:
2rem
;
margin-top
:
0.47rem
;
width
:
15%
;
}
.merge
{
flex-direction
:
row
;
width
:
98.5%
;
}
.check
{
gap
:
0
;
}
}
todo/src/Main/Main.jsx
View file @
71920d0b
import
React
from
'react'
import
{
Header
}
from
'../Header/Header'
import
{
Input
}
from
'../Components/Input'
import
'./Main.css'
export
const
Main
=
()
=>
{
return
(
<>
<
div
className=
'container'
>
<
header
className=
'head'
>
<
Header
/>
</
header
>
<
div
className=
'wrapper'
>
<
Input
/>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment