Skip to content

Commit 58d9638

Browse files
committed
feat: delete button working, not styled
1 parent 3484a0a commit 58d9638

2 files changed

Lines changed: 28 additions & 17 deletions

File tree

client/src/Components/ClassView/DeleteBtn.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const btnStyle = {
1313
};
1414

1515
const alertStyle =
16-
'text-black flex flex-col items-center justify-evenly h-56 w-56 fixed inset-1/2';
16+
'text-white text-center flex flex-col items-center justify-evenly h-56 w-96 fixed top-2/3 inset-x-1/2 bg-black p-12';
17+
18+
const alertBtnStyle = 'hover:bg-white hover:text-black border-white p-4';
1719

1820
const DeleteBtn: React.FC<{ courseId: number }> = ({ courseId }) => {
1921
const navigate = useNavigate();
@@ -44,14 +46,11 @@ const DeleteBtn: React.FC<{ courseId: number }> = ({ courseId }) => {
4446
};
4547

4648
const handleClick = () => {
47-
console.log('delete button clicked');
4849
// ask if sure!!!
4950
setAskIfSure(true);
5051
};
5152

52-
useEffect(() => {
53-
console.log('askIfSure: ', askIfSure);
54-
}, [askIfSure]);
53+
// TODO: success message??
5554

5655
return (
5756
<div className={btnStyle.box}>
@@ -61,9 +60,19 @@ const DeleteBtn: React.FC<{ courseId: number }> = ({ courseId }) => {
6160
{askIfSure && (
6261
<div className={alertStyle}>
6362
<h2>Are you sure you want to delete this course?</h2>
64-
<div>
65-
<button onClick={() => handleDelete(courseId)}>YES</button>
66-
<button onClick={() => setAskIfSure(false)}>CANCEL</button>
63+
<div className="flex flex-row justify-evenly w-full mt-4">
64+
<button
65+
onClick={() => handleDelete(courseId)}
66+
className={alertBtnStyle}
67+
>
68+
YES
69+
</button>
70+
<button
71+
onClick={() => setAskIfSure(false)}
72+
className={alertBtnStyle}
73+
>
74+
CANCEL
75+
</button>
6776
</div>
6877
</div>
6978
)}

client/src/Components/TeacherDashboard/CourseList.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,18 @@ const CourseList: React.FC = () => {
4040

4141
return (
4242
<div className={listStyle}>
43-
{coursesState!.map((course) => {
43+
{
4444
// useredux state here instead of DB response
45-
return (
46-
<article key={course?.id}>
47-
<Link to={`/homepage/classes/${course?.id}`}>
48-
{!!course && <Course course={course} />}
49-
</Link>
50-
</article>
51-
);
52-
})}
45+
coursesState!.map((course) => {
46+
return (
47+
<article key={course?.id}>
48+
<Link to={`/homepage/classes/${course?.id}`}>
49+
{!!course && <Course course={course} />}
50+
</Link>
51+
</article>
52+
);
53+
})
54+
}
5355
</div>
5456
);
5557
};

0 commit comments

Comments
 (0)