Commit 6836290e authored by Kim, Subin's avatar Kim, Subin
Browse files

Link 해결

parent f07adc61
...@@ -2,19 +2,19 @@ import { Link } from "react-router-dom"; ...@@ -2,19 +2,19 @@ import { Link } from "react-router-dom";
import styles from "./studyplan.module.scss"; import styles from "./studyplan.module.scss";
const PlanLineList = ({ subjectId, planList = [] }) => { const PlanLineList = ({ subjectId, planList = [] }) => {
return ( return (
<Link to={`/studyplan/${subjectId}`}> <>
{planList.length !== 0 ? planList.map(plan => <div className="d-flex justify-content-between"> {planList.length !== 0 ? planList.map(plan => <div className="d-flex justify-content-between">
<p className={`card-text mb-1 ${styles.text}`}>- {plan.title}</p> <Link to={`/studyplan/${subjectId}`} className={`col-11 card-text text-decoration-none link-dark mb-1 ${styles.text}`}>- {plan.title}</Link>
<input className={`form-check-input shadow-none ${styles.checkBox}`} type="checkbox" /> <div className="col d-flex justify-content-end">
</div>) : <Link className="text-decoration-none link-dark" to={`/studyplan/submit/${subjectId}`}> <input className={`form-check-input shadow-none ${styles.checkBox}`} type="checkbox" onClick={() => console.log("checkbox clicke")} />
<div className="d-flex"> </div>
<i className="bi bi-plus"></i> </div>) : <Link className="d-flex text-decoration-none link-dark" to={`/studyplan/submit/${subjectId}`}>
<p className="card-text mb-1">새로운 계획 추가하기</p> <i className="bi bi-plus"></i>
</div> <p className="card-text mb-1">새로운 계획 추가하기</p>
</Link>} </Link>}
</Link> </>
) )
} }
export default PlanLineList export default PlanLineList
\ No newline at end of file
...@@ -4,20 +4,20 @@ import PlanLineList from "./PlanLineList"; ...@@ -4,20 +4,20 @@ import PlanLineList from "./PlanLineList";
const StudyPlanCard = ({ renList, handleClick }) => { const StudyPlanCard = ({ renList, handleClick }) => {
return ( return (
<div className="card text-decoration-none link-dark mb-3" style={{ width: "20rem" }} > <Link className="card text-decoration-none link-dark mb-3" to={`/studyplan/${renList.id}`} style={{ width: "20rem" }} >
<div className="card-body"> <div className="card-body">
<div className="d-flex"> <div className="d-flex">
<h5 className="card-title col-10 text-nowrap" style={{ overflow: "hidden", textOverflow: "ellipsis" }}>{renList.name}</h5> <h5 className="card-title col-10 text-nowrap" style={{ overflow: "hidden", textOverflow: "ellipsis" }}>{renList.name}</h5>
<div className="col-2 d-flex justify-content-end"> <div className="col-2 d-flex justify-content-end">
<Link className="text-decoration-none link-dark" to={`/subject/edit/${renList.id}`}><i className="bi bi-pencil-square pe-2"></i></Link> <Link className="text-decoration-none link-dark" to={`/subject/edit/${renList.id}`}><i className="bi bi-pencil-square pe-2"></i></Link>
<i className="bi bi-trash" onClick={() => handleClick(renList.id)}> <i className="bi bi-trash" onClick={(e) => handleClick(e, renList.id)}>
</i> </i>
</div> </div>
</div> </div>
<p className="card-subtitle ms-1 mb-2 text-muted">{renList.prof && renList.room ? renList.prof + ' - ' + renList.room : (renList.prof || renList.room)}</p> <p className="card-subtitle ms-1 mb-2 text-muted">{renList.prof && renList.room ? renList.prof + ' - ' + renList.room : (renList.prof || renList.room)}</p>
<PlanLineList subjectId={renList.id} planList={renList.planList} /> <PlanLineList subjectId={renList.id} planList={renList.planList} />
</div> </div>
</div> </Link>
) )
} }
......
...@@ -27,7 +27,8 @@ const StudyPlanList = () => { ...@@ -27,7 +27,8 @@ const StudyPlanList = () => {
} }
} }
async function delSubject(subjectId) { async function delSubject(e, subjectId) {
e.preventDefault()
try { try {
setError("") setError("")
await subjectApi.removeSubject(subjectId, user.id) await subjectApi.removeSubject(subjectId, user.id)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment