-
{ClassName}
- {disableLink ? null : (
+
{classData.ClassName}
+ {classData.disableLink ? null : (
<>
- {FavoriteChecked ? (
+ {classData.FavoriteChecked ? (
- {ClassContent}
+ {classData.ClassContent}
>
);
+
return (
<>
- {disableLink ? (
+ {classData.disableLink ? (
cardContent
) : (
-
{cardContent}
+
+ {cardContent}
+
)}
>
);
diff --git a/src/app/components/card/CardList.tsx b/src/app/components/card/CardList.tsx
new file mode 100644
index 0000000..b4b7d36
--- /dev/null
+++ b/src/app/components/card/CardList.tsx
@@ -0,0 +1,26 @@
+import {Card} from '../card';
+import {ClassProps} from '@/src/interfaces/_class';
+
+const CardList = ({classes}: ClassProps) => {
+ return (
+ <>
+ {classes.map(classItem => {
+ const classData = {
+ ImageSrc: classItem.image,
+ ClassName: classItem.name,
+ ClassContent: classItem.description,
+ FavoriteChecked: classItem.is_favorite,
+ ClassId: classItem.id,
+ };
+
+ return (
+
+
+
+ );
+ })}
+ >
+ );
+};
+
+export default CardList;
diff --git a/src/app/components/card/index.ts b/src/app/components/card/index.ts
index 7710b5d..829bea2 100644
--- a/src/app/components/card/index.ts
+++ b/src/app/components/card/index.ts
@@ -1,4 +1,5 @@
import Card from './Card';
+import CardList from './CardList';
import Invitation from './Invitation';
-export {Card, Invitation};
+export {Card, CardList, Invitation};
diff --git a/src/interfaces/_class/cardProps.ts b/src/interfaces/_class/cardProps.ts
index 4a6b699..2d3d76b 100644
--- a/src/interfaces/_class/cardProps.ts
+++ b/src/interfaces/_class/cardProps.ts
@@ -4,6 +4,11 @@ interface CardProps {
ClassContent: string;
FavoriteChecked?: boolean;
disableLink?: boolean;
+ ClassId?: number;
}
-export default CardProps;
+interface CardItemProps {
+ classData: CardProps;
+}
+
+export default CardItemProps;
diff --git a/src/interfaces/_class/index.ts b/src/interfaces/_class/index.ts
index b689caa..bae84ad 100644
--- a/src/interfaces/_class/index.ts
+++ b/src/interfaces/_class/index.ts
@@ -1,5 +1,5 @@
import InvitationProps from './invitationProps';
-import CardProps from './cardProps';
+import CardItemProps from './cardProps';
import DropdownProps from './dropdownProps';
import ScheduleCardProps from './scheduleCardProps';
import PostCardProps from './postCardProps';
@@ -9,7 +9,7 @@ import ClassProps from './classProps';
export type {
InvitationProps,
- CardProps,
+ CardItemProps,
DropdownProps,
ScheduleCardProps,
PostCardProps,
diff --git a/src/interfaces/_class/inviteProps.ts b/src/interfaces/_class/inviteProps.ts
index aa6dbfc..b757029 100644
--- a/src/interfaces/_class/inviteProps.ts
+++ b/src/interfaces/_class/inviteProps.ts
@@ -1,5 +1,7 @@
-interface InviteProps {
+import ClassProps from './classProps';
+interface InviteProps extends ClassProps {
onInvitationClick: () => void;
+ classes: ClassProps['classes'];
}
export default InviteProps;