fix: download not working
This commit is contained in:
parent
ce1751c871
commit
05f0f80600
1 changed files with 42 additions and 33 deletions
|
|
@ -10,6 +10,34 @@ interface Props {
|
|||
}
|
||||
|
||||
export default function Card({ title, content, id, downloads }: Props) {
|
||||
return (
|
||||
<div className="bg-[#161718] w-lg p-5 flex flex-col gap-5 rounded-xl self-center">
|
||||
<h1 className="text-white text-2xl font-bold" id={id?.toString()}>
|
||||
<Mdown>{title}</Mdown>
|
||||
</h1>
|
||||
<div className=" flex flex-col space-y-1 text-[#9e9b97]">
|
||||
<Mdown>{content}</Mdown>
|
||||
</div>
|
||||
{downloads != null ? (
|
||||
<details className="text-[#9e9b97]">
|
||||
<summary>Téléchargments</summary>
|
||||
<ol className="list-disc list-inside pl-5">
|
||||
{downloads.map((e, i) => (
|
||||
<Download e={e} i={i} />
|
||||
))}
|
||||
</ol>
|
||||
</details>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
interface DownloadProps {
|
||||
e: CardDownloadType
|
||||
i: number
|
||||
}
|
||||
|
||||
function Download({ e, i }: DownloadProps) {
|
||||
const [isDownloading, setIsDownloading] = useState(false)
|
||||
|
||||
function download(path: URL, fileName = 'file') {
|
||||
|
|
@ -37,18 +65,6 @@ export default function Card({ title, content, id, downloads }: Props) {
|
|||
}
|
||||
|
||||
return (
|
||||
<div className="bg-[#161718] w-lg p-5 flex flex-col gap-5 rounded-xl self-center">
|
||||
<h1 className="text-white text-2xl font-bold" id={id?.toString()}>
|
||||
<Mdown>{title}</Mdown>
|
||||
</h1>
|
||||
<div className=" flex flex-col space-y-1 text-[#9e9b97]">
|
||||
<Mdown>{content}</Mdown>
|
||||
</div>
|
||||
{downloads != null ? (
|
||||
<details className="text-[#9e9b97]">
|
||||
<summary>Téléchargments</summary>
|
||||
<ol className="list-disc list-inside pl-5">
|
||||
{downloads.map((e, i) => (
|
||||
<li>
|
||||
<a
|
||||
key={i}
|
||||
|
|
@ -59,16 +75,9 @@ export default function Card({ title, content, id, downloads }: Props) {
|
|||
}
|
||||
onClick={() => download(e.link, e.filename)}
|
||||
>
|
||||
{isDownloading
|
||||
? '[Téléchargement en cours ...] '
|
||||
: null}{' '}
|
||||
{isDownloading ? '[Téléchargement en cours ...] ' : null}{' '}
|
||||
{e.title}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</details>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue