design: 수강신청 관리 디자인 추가

This commit is contained in:
jhynsoo 2024-08-07 10:41:32 +09:00
parent aab6ea4633
commit aa434d5ea6
3 changed files with 67 additions and 17 deletions

View File

@ -8,21 +8,39 @@ export default function LectureEnroll({ userName, enrollid, onDelete }) {
const handleAccept = async (e) => {
e.preventDefault();
if (!confirm('수강신청을 승인하시겠습니까?')) {
return;
}
await lectureEnrollAccept(enrollid);
onDelete(enrollid);
};
const handleCancel = async (e) => {
e.preventDefault();
if (!confirm('수강신청을 거절하시겠습니까?')) {
return;
}
await lectureEnrollCancel(enrollid);
onDelete(enrollid);
};
return (
<div className={styles.enrollLink}>
<p>{userName}</p>
<button onClick={handleAccept}>등록</button>
<button onClick={handleCancel}>삭제</button>
<span>{userName}</span>
<div className={styles.buttonWrapper}>
<button
onClick={handleAccept}
className={styles.accept}
>
등록
</button>
<button
onClick={handleCancel}
className={styles.reject}
>
삭제
</button>
</div>
</div>
);
}

View File

@ -1,13 +1,44 @@
.enrollLink {
border-radius: 8px;
width: 100%;
display: flex;
justify-content: space-between;
box-sizing: border-box;
align-items: center;
border-radius: 8px;
width: 100%;
padding: 16px 20px;
transition: background-color 0.25s;
box-sizing: border-box;
}
.enrollLink:hover {
background-color: var(--background-secondary);
.buttonWrapper {
display: flex;
gap: 8px;
}
.accept,
.reject {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
padding: 8px 16px;
border-radius: 8px;
border: 1px solid var(--border-color);
background-color: var(--background);
font-size: 14px;
font-weight: 500;
line-height: 1.4;
cursor: pointer;
transition:
border-color 0.1s,
color 0.1s;
}
.accept:hover {
border-color: var(--info-color);
color: var(--info-color);
}
.reject:hover {
border-color: var(--error-color);
color: var(--error-color);
}

View File

@ -24,14 +24,15 @@ export default function QuestionListPage() {
title="수강신청관리"
canCreate={false}
>
{lectures.map?.((lecture) => (
<LectureEnroll
key={`${lecture.id}`}
enrollid={lecture.id}
userName={lecture.userName}
onDelete={handleDelete}
/>
))}
{lectures.length &&
lectures.map?.((lecture) => (
<LectureEnroll
key={`${lecture.id}`}
enrollid={lecture.id}
userName={lecture.userName}
onDelete={handleDelete}
/>
))}
</ArticleBoard>
);
}