(feat) add description field web services in learn components
This commit is contained in:
@@ -5,6 +5,7 @@ import Alert from "../../../../components/alert/Alert";
|
|||||||
import { MdErrorOutline } from "react-icons/md";
|
import { MdErrorOutline } from "react-icons/md";
|
||||||
import Button from "../../../../components/button";
|
import Button from "../../../../components/button";
|
||||||
import { saveAs } from "file-saver";
|
import { saveAs } from "file-saver";
|
||||||
|
import { Fragment } from "react/jsx-runtime";
|
||||||
|
|
||||||
const getMediaType = (url: string) => {
|
const getMediaType = (url: string) => {
|
||||||
const extension = url.split(".").pop()?.toLowerCase();
|
const extension = url.split(".").pop()?.toLowerCase();
|
||||||
@@ -73,16 +74,38 @@ const Learn = ({ activeTutorial }: LearnProps) => {
|
|||||||
data?.data?.result?.files.length > 0 && (
|
data?.data?.result?.files.length > 0 && (
|
||||||
<div className="w-full h-full p-3 mb-3 flex flex-col justify-center items-center gap-2 bg-gray-900 rounded-md shadow-xl">
|
<div className="w-full h-full p-3 mb-3 flex flex-col justify-center items-center gap-2 bg-gray-900 rounded-md shadow-xl">
|
||||||
{data.data.result.files.map(
|
{data.data.result.files.map(
|
||||||
(file: { id: number; title: string; file: string }) => (
|
(file: {
|
||||||
<div
|
id: number;
|
||||||
className="w-full h-full flex justify-between gap-4 items-center"
|
title: string;
|
||||||
key={file.id}
|
file: string;
|
||||||
>
|
description: string;
|
||||||
<p className="text-xs md:text-sm">{file.title}</p>
|
}) => (
|
||||||
<Button extra="!py-1" onClick={() => saveAs(file.file)}>
|
<Fragment key={file.id}>
|
||||||
دانلود
|
{file?.description ? (
|
||||||
</Button>
|
<div className="w-full h-full flex flex-col gap-1 justify-center items-center p-3 border-2 border-secondTheme rounded-md">
|
||||||
</div>
|
<div className="w-full h-full flex justify-between gap-4 items-center">
|
||||||
|
<p className="text-xs md:text-sm">{file.title}</p>
|
||||||
|
<Button
|
||||||
|
extra="!py-1"
|
||||||
|
onClick={() => saveAs(file.file)}
|
||||||
|
>
|
||||||
|
دانلود
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<p className="w-full h-full text-xs md:text-sm text-gray-300"> <span className="w-auto h-auto px-1 bg-secondTheme text-gray-800 rounded-md">توضیحات</span> : {file?.description}</p>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="w-full h-full flex justify-between gap-4 items-center">
|
||||||
|
<p className="text-xs md:text-sm">{file.title}</p>
|
||||||
|
<Button
|
||||||
|
extra="!py-1"
|
||||||
|
onClick={() => saveAs(file.file)}
|
||||||
|
>
|
||||||
|
دانلود
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user