Compare commits
No commits in common. "27dbd26459d2139f0c1c7d76dbc28b27841bafca" and "269ab8c99f3740d85262dbe253ab71387398e3f7" have entirely different histories.
27dbd26459
...
269ab8c99f
3 changed files with 9 additions and 22 deletions
|
|
@ -4,7 +4,13 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000" />
|
||||||
<title>Personal Website</title>
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="Web site created using create-tsrouter-app"
|
||||||
|
/>
|
||||||
|
<link rel="apple-touch-icon" href="/logo192.png" />
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
|
<title>Create TanStack App - academic</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
|
|
@ -9,24 +9,6 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Card({ title, content, id, downloads }: Props) {
|
export default function Card({ title, content, id, downloads }: Props) {
|
||||||
function download(path: URL, fileName = 'file') {
|
|
||||||
fetch(path)
|
|
||||||
.then((response) => response.blob())
|
|
||||||
.then((blob) => {
|
|
||||||
const url = window.URL.createObjectURL(new Blob([blob]))
|
|
||||||
|
|
||||||
const link = document.createElement('a')
|
|
||||||
link.href = url
|
|
||||||
link.download = fileName
|
|
||||||
|
|
||||||
document.body.appendChild(link)
|
|
||||||
|
|
||||||
link.click()
|
|
||||||
|
|
||||||
link.parentNode?.removeChild(link)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-[#161718] w-lg p-5 flex flex-col gap-5 rounded-xl self-center">
|
<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()}>
|
<h1 className="text-white text-2xl font-bold" id={id?.toString()}>
|
||||||
|
|
@ -42,11 +24,10 @@ export default function Card({ title, content, id, downloads }: Props) {
|
||||||
{downloads.map((e, i) => (
|
{downloads.map((e, i) => (
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href={e.link.toString()}
|
href={e.link}
|
||||||
key={i}
|
key={i}
|
||||||
download={e.filename}
|
download={e.filename}
|
||||||
className="text-sky-600 underline"
|
className="text-sky-600 underline"
|
||||||
onClick={() => download(e.link, e.filename)}
|
|
||||||
>
|
>
|
||||||
{e.title}
|
{e.title}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
export type CardDownloadType = {
|
export type CardDownloadType = {
|
||||||
title: string
|
title: string
|
||||||
filename: string
|
filename: string
|
||||||
link: URL
|
link: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CardType = {
|
export type CardType = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue