-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
61 additions
and
469 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,66 @@ | ||
import React, { useState } from 'react'; | ||
import '../Styles/Input.css'; | ||
import Output from './Output'; | ||
import TitleName from './Title'; | ||
import Output from './Output'; | ||
import AlarmClock from './Alarm'; | ||
|
||
|
||
|
||
|
||
export default function Input() { | ||
|
||
const Input = () => { | ||
const [task, setTask] = useState("") | ||
const [data, setData] = useState([]) | ||
const [title,setTitle] = useState(""); | ||
const [titleData,setTitleData] = useState([]); | ||
|
||
|
||
const titleValue = (e) => { | ||
setTitle(e.target.value); | ||
} | ||
|
||
const titleHandler = (e) =>{ | ||
e.preventDefault(); | ||
setTitleData([title]); | ||
} | ||
const [alarm, setAlarm] = useState(''); | ||
|
||
const onChangeHandler = (e) => { | ||
setTask(e.target.value); | ||
setTitle('') | ||
|
||
} | ||
const onChangeHandler = (e) => setTask(e.target.value); | ||
|
||
const taskHandler = (e) => { | ||
e.preventDefault(); | ||
const newData = task; | ||
setData([newData,...data]) | ||
setTask(''); | ||
setData([{ task, alarm},...data]) | ||
setTask(''); | ||
setAlarm('') | ||
} | ||
|
||
const deleteItem = (a) => { | ||
const finalData = data.filter((curEle, index) => { | ||
return index!==a; | ||
}) | ||
const deleteItem = (index) => { | ||
const finalData = data.filter((_, i) => i !== index ) | ||
setData(finalData); | ||
} | ||
|
||
const setAlarmTimeHandler = (event) => { | ||
const inputAlarmTimeModified = event.target.value + ':00'; | ||
setAlarm(inputAlarmTimeModified); | ||
}; | ||
|
||
return ( | ||
<> | ||
|
||
<div className="form-div"> | ||
<form className='form'> | ||
<div className='title-div'> | ||
<input type="text" placeholder='Title' id="title-input" value={title} onChange={titleValue} /> | ||
<button id='title-button' onClick={titleHandler}>TITLE</button> | ||
</div> | ||
<div className='task-div'> | ||
<input id='task-input' type="text" placeholder='Type Here...' value={task} onChange={onChangeHandler} /> | ||
<button id="task-button" onClick={taskHandler}>ADD</button> | ||
</div> | ||
|
||
</form> | ||
|
||
|
||
</div> | ||
<div className="form-div"> | ||
<form className="form"> | ||
<div className="task-div"> | ||
<input | ||
id="task-input" | ||
type="text" | ||
placeholder="Type Here..." | ||
value={task} | ||
onChange={onChangeHandler} | ||
/> | ||
<input type="time" onChange={setAlarmTimeHandler} className="time" /> | ||
<button id="task-button" onClick={taskHandler}> | ||
ADD | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
<div className='container'> | ||
<div className='task-container'> | ||
{ | ||
titleData.map((value,index)=>( | ||
<TitleName | ||
id={index} | ||
key={index} | ||
title ={value} | ||
/> | ||
)) | ||
|
||
} | ||
|
||
|
||
{ | ||
data.map((value, index) => ( | ||
<Output | ||
id={index} | ||
key={index} | ||
|
||
task={value} | ||
onSelect={deleteItem} | ||
/> | ||
)) | ||
|
||
|
||
} | ||
|
||
|
||
|
||
{data.map((value, index) => ( | ||
<div className="task-alarm-pair" key={index}> | ||
<Output id={index} task={value.task} onSelect={deleteItem} /> | ||
<AlarmClock alarmTime={value.alarm} /> | ||
</div> | ||
<div className='alarm-container'> | ||
|
||
{ | ||
data.map((value, index) => ( | ||
<AlarmClock | ||
id={index} | ||
key={index} | ||
|
||
alarmTime={value} | ||
onSelect={deleteItem} | ||
/> | ||
)) | ||
|
||
} | ||
))} | ||
</div> | ||
|
||
|
||
</div> | ||
</> | ||
); | ||
} | ||
|
||
} | ||
|
||
export default Input; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,10 +33,6 @@ | |
width:100%; | ||
} | ||
|
||
.title-div{ | ||
@include flex; | ||
} | ||
|
||
.task-div{ | ||
@include flex; | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.