Jelajahi Sumber

add preview to Image

visuddhinanda 2 tahun lalu
induk
melakukan
63ad3dfa1e
1 mengubah file dengan 6 tambahan dan 2 penghapusan
  1. 6 2
      dashboard/src/components/course/CourseHead.tsx

+ 6 - 2
dashboard/src/components/course/CourseHead.tsx

@@ -17,7 +17,7 @@ interface IWidget {
   id?: string;
   id?: string;
   title?: string;
   title?: string;
   subtitle?: string;
   subtitle?: string;
-  coverUrl?: string;
+  coverUrl?: string[];
   startAt?: string;
   startAt?: string;
   endAt?: string;
   endAt?: string;
   teacher?: IUser;
   teacher?: IUser;
@@ -58,7 +58,11 @@ const CourseHeadWidget = ({
               <Image
               <Image
                 width={200}
                 width={200}
                 style={{ borderRadius: 12 }}
                 style={{ borderRadius: 12 }}
-                src={API_HOST + "/" + coverUrl}
+                src={coverUrl && coverUrl.length > 1 ? coverUrl[1] : undefined}
+                preview={{
+                  src:
+                    coverUrl && coverUrl.length > 0 ? coverUrl[0] : undefined,
+                }}
                 fallback={`${API_HOST}/app/course/img/default.jpg`}
                 fallback={`${API_HOST}/app/course/img/default.jpg`}
               />
               />
               <Space direction="vertical">
               <Space direction="vertical">