-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
77 lines (64 loc) · 2.18 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React, { useState, useEffect } from "react"
import './App.css'
import axios from "axios"
import DateTimePicker from "react-datetime-picker"
function App() {
const [ reminderMsg, setReminderMsg ] = useState("")
const [ remindAt, setRemindAt ] = useState()
const [ reminderList, setReminderList ] = useState([])
useEffect(() => {
axios.get("http://localhost:9000/getAllReminder").then( res => setReminderList(res.data))
}, [])
const addReminder = () => {
axios.post("http://localhost:9000/addReminder", { reminderMsg, remindAt })
.then( res => setReminderList(res.data))
setReminderMsg("")
setRemindAt()
}
const deleteReminder = (id) => {
axios.post("http://localhost:9000/deleteReminder", { id })
.then( res => setReminderList(res.data))
}
return (
<div className="App">
<div className="homepage">
<div className="homepage_header">
<h1>Remind Me 🙋♂️</h1>
<input type="text" placeholder="Reminder notes here..." value={reminderMsg} onChange={e => setReminderMsg(e.target.value)} />
<DateTimePicker
value={remindAt}
onChange={setRemindAt}
minDate={new Date()}
minutePlaceholder="mm"
hourPlaceholder="hh"
dayPlaceholder="DD"
monthPlaceholder="MM"
yearPlaceholder="YYYY"
/>
<div className="button" onClick={addReminder}>Add Reminder</div>
</div>
<div className="homepage_body">
<div className="reminder_card">
<h2>Reminder Note</h2>
<h3>Remind me at</h3>
<p>26/03/2023 @ 2AM</p>
<div className="button">Delete</div>
</div>
<div className="reminder_card">
<h2>Reminder Note</h2>
<h3>Remind me at</h3>
<p>26/03/2023 @ 2AM</p>
<div className="button">Delete</div>
</div>
<div className="reminder_card">
<h2>Reminder Note</h2>
<h3>Remind me at</h3>
<p>26/03/2023 @ 2AM</p>
<div className="button">Delete</div>
</div>
</div>
</div>
</div>
)
}
export default App;