feat: 메인페이지 이미지 url 추가

This commit is contained in:
정기영 2024-08-05 11:00:57 +09:00
parent 3ef118ca0f
commit 5512f2f596
4 changed files with 12 additions and 2 deletions

View File

@ -1,13 +1,17 @@
import { Link } from 'react-router-dom';
import styles from './ClassCard.module.css';
export default function ClassCard({ path, children }) {
export default function ClassCard({ img, path, children }) {
return (
<Link
to={path}
className={styles.card}
>
<div className={styles.thumbnail} />
<img
src={'img'}
alt="강의 이미지"
className={styles.thumbnail}
/>
<div>{children}</div>
</Link>
);

View File

@ -6,6 +6,7 @@ import { useLectures } from '../../hooks/api/useLectures';
export default function StudentHomePage() {
const { data: allLectures } = useLectures();
const allClasses = allLectures?.data ?? [];
console.log(allClasses);
return (
<MaxWidthLayout>
@ -14,6 +15,7 @@ export default function StudentHomePage() {
<ClassCard
key={lecture.id}
path={`/lecture/${lecture.id}/info`}
img={lecture.image}
>
{lecture.title}
</ClassCard>

View File

@ -19,6 +19,7 @@ export default function StudentHomePage() {
<ClassCard
key={lecture.id}
path={`/lecture/${lecture.id}`}
img={lecture.image}
>
{lecture.title}
</ClassCard>
@ -29,6 +30,7 @@ export default function StudentHomePage() {
<ClassCard
key={lecture.id}
path={`/lecture/${lecture.id}/info`}
img={lecture.image}
>
{lecture.title}
</ClassCard>

View File

@ -6,6 +6,7 @@ import { useMyLectures } from '../../hooks/api/useMyLectures';
export default function TeacherHomePage() {
const { data: myLectures } = useMyLectures();
const onGoingClasses = myLectures?.data ?? [];
console.log(onGoingClasses);
// TODO: ,
return (
<MaxWidthLayout>
@ -14,6 +15,7 @@ export default function TeacherHomePage() {
<ClassCard
key={lecture.id}
path={`/lecture/${lecture.id}`}
img={lecture.image}
>
{lecture.title}
</ClassCard>