diff --git a/src/components/Card.tsx b/src/components/Card.tsx index 82f7615..bdffc76 100644 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -1,6 +1,5 @@ import type { CardDownloadType } from '@/types/cards' import Mdown from './Mdown' -import { useState } from 'react' interface Props { title: string @@ -10,41 +9,7 @@ interface Props { } export default function Card({ title, content, id, downloads }: Props) { - return ( -
-

- {title} -

-
- {content} -
- {downloads != null ? ( -
- Téléchargments -
    - {downloads.map((e, i) => ( - - ))} -
-
- ) : null} -
- ) -} - -interface DownloadProps { - e: CardDownloadType - i: number -} - -function Download({ e, i }: DownloadProps) { - const [isDownloading, setIsDownloading] = useState(false) - function download(path: URL, fileName = 'file') { - if (isDownloading) { - return - } - setIsDownloading(true) fetch(path) .then((response) => response.blob()) .then((blob) => { @@ -59,25 +24,37 @@ function Download({ e, i }: DownloadProps) { link.click() link.parentNode?.removeChild(link) - - setIsDownloading(false) }) } return ( -
  • - download(e.link, e.filename)} - > - {isDownloading ? '[Téléchargement en cours ...] ' : null}{' '} - {e.title} - -
  • +
    +

    + {title} +

    +
    + {content} +
    + {downloads != null ? ( +
    + Téléchargments +
      + {downloads.map((e, i) => ( +
    1. + download(e.link, e.filename)} + > + {e.title} + +
    2. + ))} +
    +
    + ) : null} +
    ) } diff --git a/src/components/Mdown.tsx b/src/components/Mdown.tsx index 8dd4979..cab339a 100644 --- a/src/components/Mdown.tsx +++ b/src/components/Mdown.tsx @@ -22,22 +22,9 @@ export default function Mdown({ children }: Props) { const { node, ...rest } = props return
  • }, - p(props) { - const { node, ...rest } = props - return

    - }, - code(props) { - const { node, ...rest } = props - return ( - - ) - }, a(props) { const { node, ...rest } = props - const classes = 'text-sky-700 underline' + const classes = 'text-sky-600 underline' if (rest.href?.startsWith('dl:')) { let parts = rest.href.split('/') return ( diff --git a/src/routes/index.tsx b/src/routes/index.tsx index d720a17..e93f99c 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -31,7 +31,7 @@ function App() { return (

    -
    +

    {data.title}

    diff --git a/src/routes/lessons/$lessonName.tsx b/src/routes/lessons/$lessonName.tsx index efabaaf..41ec497 100644 --- a/src/routes/lessons/$lessonName.tsx +++ b/src/routes/lessons/$lessonName.tsx @@ -44,7 +44,7 @@ export default function Projects() { return (
    -
    +

    {data.title}

    diff --git a/src/routes/lessons/index.tsx b/src/routes/lessons/index.tsx index 2baf91a..0eb6a72 100644 --- a/src/routes/lessons/index.tsx +++ b/src/routes/lessons/index.tsx @@ -31,7 +31,7 @@ export default function Projects() { return (
    -
    +

    {data.title}

    diff --git a/src/routes/projects/index.tsx b/src/routes/projects/index.tsx index c34a702..941e840 100644 --- a/src/routes/projects/index.tsx +++ b/src/routes/projects/index.tsx @@ -31,7 +31,7 @@ export default function Projects() { return (
    -
    +

    {data.title}