feature: edit task
This commit is contained in:
parent
6433c4c72a
commit
300f44503b
12 changed files with 253 additions and 151 deletions
|
|
@ -6,7 +6,7 @@ function DailyItem(props: any) {
|
|||
const [state, setState] = React.useState('view')
|
||||
const [title, setTitle] = React.useState('')
|
||||
const [notes, setNotes] = React.useState('')
|
||||
if (state == 'view') {
|
||||
if (state === 'view') {
|
||||
return (
|
||||
<div className="todo-item" id={props.id}>
|
||||
<input type="checkbox" className="checkbox" id={props.id} onChange={props.onChange} checked={props.completed} />
|
||||
|
|
@ -14,7 +14,7 @@ function DailyItem(props: any) {
|
|||
<p><Emoji text={props.daily_text}></Emoji></p>
|
||||
<ReactMarkdown children={props.daily_notes} />
|
||||
</div>
|
||||
<button className="task-operation" >
|
||||
<button className="task-operation">
|
||||
<span className="material-icons md-24" id={props.id} onClick={() => setState('edit')}>create</span>
|
||||
</button>
|
||||
<button className="task-operation">
|
||||
|
|
@ -24,11 +24,13 @@ function DailyItem(props: any) {
|
|||
)
|
||||
} else {
|
||||
return (
|
||||
<div className="edit-daily-item">
|
||||
<div className="edit-daily-item edit-item">
|
||||
<input type="text" onChange={event => setTitle(event.target.value)} defaultValue={props.daily_text}></input>
|
||||
<input type="text" onChange={event => setNotes(event.target.value)} defaultValue={props.daily_notes}></input>
|
||||
<button className="task-operation" ><span className="material-icons md-24" id={props.id} onClick={function (e) { props.onChange(e); setState('view') }} title="submit" data-title={title} data-notes={notes}>check</span></button>
|
||||
<button className="task-operation"><span className="material-icons md-24" id={props.id} onClick={() => setState('view')} title="cancel">clear</span></button>
|
||||
<div className="edit-daily-button edit-button">
|
||||
<button className="task-operation"><span className="material-icons md-24" id={props.id} onClick={function (e) { props.onChange(e); setState('view') }} title="submit" data-title={title} data-notes={notes}>check</span></button>
|
||||
<button className="task-operation"><span className="material-icons md-24" id={props.id} onClick={() => setState('view')} title="cancel">clear</span></button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue