ScheduleItem.js 2.29 KB
Newer Older
Kim, Subin's avatar
Kim, Subin committed
1
import { useState } from "react";
Kim, Subin's avatar
Kim, Subin committed
2
import { Link } from "react-router-dom";
Kim, Subin's avatar
Kim, Subin committed
3
import catchErrors from "../../utils/catchErrors.js";
Kim, Subin's avatar
Kim, Subin committed
4
5
6
import styles from "./schedule.module.scss";

const ScheduleItem = () => {
Kim, Subin's avatar
Kim, Subin committed
7
8
    const [error, setError] = useState("")

Kim, Subin's avatar
Kim, Subin committed
9
    async function delSchedule() {
Kim, Subin's avatar
Kim, Subin committed
10
11
12
13
14
15
16
17
18
        try {
            setError("")
            alert("해당 일정을 성공적으로 삭제하였습니다.")
            window.location.reload()
        } catch (error) {
            catchErrors(error, setError)
        }
    }

Kim, Subin's avatar
Kim, Subin committed
19
20
21
22
    return (
        <div className="accordion-item border-bottom-0">
            <button className={`d-flex flex-column align-items-start accordion-button collapsed bg-white shadow-none px-0 ${styles.activeBtn}`} type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne">
                <h5 className={`accordion-header ${styles.title}`} id="flush-headingOne">
Kim, Subin's avatar
Kim, Subin committed
23
                    Accordion0 Item#1 sadsadsadasdsadsadasa sadsadsadasdsadsada
Kim, Subin's avatar
Kim, Subin committed
24
                </h5>
Kim, Subin's avatar
Kim, Subin committed
25
26
                <p className={`text-secondary mb-0 ${styles.time}`}>sadsadsdsadsadsaf</p>
                <p className={`mb-0 ${styles.period}`}>2021.01.151 ~ 2021.09.35</p>
Kim, Subin's avatar
Kim, Subin committed
27
28
            </button>
            <div id="flush-collapseOne" className="accordion-collapse collapse" aria-labelledby="flush-headingOne" data-bs-parent="#scheduleList">
Kim, Subin's avatar
Kim, Subin committed
29
                <div className={`accordion-body px-0 pt-2 ${styles.textBox}`}>
Kim, Subin's avatar
Kim, Subin committed
30
31
32
33
34
35
                    <div className="d-flex align-items-start">
                        <i className="col bi bi-geo-alt fs-5"></i>
                        <div className="col-11">
                            sadsadsadsa
                        </div>
                    </div>
Kim, Subin's avatar
Kim, Subin committed
36
37
                    dlkasjflsajflasjflsakfjlsajflalsafjsask<br />fjlakdjflajflaksj  lksajdlksajs   dslkafjlsakflksjflasjflksjslakjflsakjflsajflsakjlasjflksajlfsja
                    <div className="d-flex justify-content-end mt-3">
Kim, Subin's avatar
Kim, Subin committed
38
                        <Link className="btn btn-white btn-sm border-dark" to="/schedule/edit">수정</Link>
Kim, Subin's avatar
Kim, Subin committed
39
                        <button type="button" className="btn btn-crimson btn-sm ms-2" onClick={delSchedule}>삭제</button>
Kim, Subin's avatar
Kim, Subin committed
40
41
42
43
44
45
46
47
                    </div>
                </div>
            </div>
        </div>
    )
}

export default ScheduleItem