diff --git a/apps/website/src/components/DownloadButton.tsx b/apps/website/src/components/DownloadButton.tsx index 7aac0c1e5..8ed8cf18a 100644 --- a/apps/website/src/components/DownloadButton.tsx +++ b/apps/website/src/components/DownloadButton.tsx @@ -1,16 +1,18 @@ -import { getRecommendedDownload } from "../download-helper.js"; +import { getRecommendedDownload, RecommendedDownload } from "../download-helper.js"; import "./DownloadButton.css"; import Button from "./Button.js"; import downloadIcon from "../assets/boxicons/bx-arrow-in-down-square-half.svg?raw"; import packageJson from "../../../../package.json" with { type: "json" }; +import { useEffect, useState } from "preact/hooks"; interface DownloadButtonProps { big?: boolean; } -const recommendedDownload = getRecommendedDownload(); - export default function DownloadButton({ big }: DownloadButtonProps) { + const [ recommendedDownload, setRecommendedDownload ] = useState(); + useEffect(() => setRecommendedDownload(getRecommendedDownload()), []); + return (recommendedDownload &&