Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(website): improve download button with icon and platform title
Elian Doran7a73af029902
diff --git a/apps/website/src/assets/boxicons/bx-arrow-in-down-square-half.svg b/apps/website/src/assets/boxicons/bx-arrow-in-down-square-half.svgnew file mode 100644index 0000000000..6f4f20ac74--- /dev/null+++ b/apps/website/src/assets/boxicons/bx-arrow-in-down-square-half.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><!--Boxicons v3.0 https://boxicons.com | License https://docs.boxicons.com/free--><path d="M11 3v7H7l5 6 5-6h-4V3z"/><path d="M19 19H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2z"/></svg>\ No newline at end of filediff --git a/apps/website/src/components/Button.css b/apps/website/src/components/Button.cssindex 8c3355fcf1..d79e17ec01 100644--- a/apps/website/src/components/Button.css+++ b/apps/website/src/components/Button.css@@ -6,4 +6,5 @@ a.button {color: var(--brand-foreground-color);text-decoration: none;text-align: center;+ box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);}\ No newline at end of filediff --git a/apps/website/src/components/Button.tsx b/apps/website/src/components/Button.tsxindex 9874e8aeec..6c1e8a4222 100644--- a/apps/website/src/components/Button.tsx+++ b/apps/website/src/components/Button.tsx@@ -7,12 +7,13 @@ interface ButtonProps {iconSvg?: string;text: ComponentChildren;openExternally?: boolean;+ className?: string;}-export default function Button({ href, iconSvg, openExternally, text }: ButtonProps) {+export default function Button({ href, iconSvg, openExternally, text, className }: ButtonProps) {return (<a- className="button"+ className={`button ${className}`}href={href}target={openExternally ? "_blank" : undefined}>diff --git a/apps/website/src/components/DownloadButton.css b/apps/website/src/components/DownloadButton.cssindex c67f84b04d..864088dc6d 100644--- a/apps/website/src/components/DownloadButton.css+++ b/apps/website/src/components/DownloadButton.css@@ -1,10 +1,4 @@.download-button {- text-decoration: none;- background: var(--brand-1);- padding: 0.5em 1em;- border-radius: 6px;- color: white;- box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);display: none;}diff --git a/apps/website/src/components/DownloadButton.tsx b/apps/website/src/components/DownloadButton.tsxindex 0c19c7d55f..18e150026f 100644--- a/apps/website/src/components/DownloadButton.tsx+++ b/apps/website/src/components/DownloadButton.tsx@@ -1,17 +1,24 @@import { getRecommendedDownload } from "../download-helper";import "./DownloadButton.css";+import Button from "./Button";+import downloadIcon from "../assets/boxicons/bx-arrow-in-down-square-half.svg?raw";interface DownloadButtonProps {big?: boolean;}-const { architecture, platform, url } = getRecommendedDownload();+const { name, url } = getRecommendedDownload();export default function DownloadButton({ big }: DownloadButtonProps) {return (- <a className={`download-button ${big ? "big" : ""}`} href={url}>- Download now{" "}- <span class="platform">{platform} {architecture}</span>- </a>+ <Button+ className={`download-button ${big ? "big" : ""}`}+ href={url}+ iconSvg={downloadIcon}+ text={<>+ Download now{" "}+ <span class="platform">for {name}</span>+ </>}+ />)}diff --git a/apps/website/src/download-helper.ts b/apps/website/src/download-helper.tsindex 40887c9462..cc9874331d 100644--- a/apps/website/src/download-helper.ts+++ b/apps/website/src/download-helper.ts@@ -187,9 +187,13 @@ export function getRecommendedDownload() {const format = recommendedDownload?.[0];const url = buildDownloadUrl("desktop", platform, format || 'zip', architecture);+ const platformTitle = downloadMatrix.desktop[platform].title;+ const name = typeof platformTitle === "string" ? platformTitle : platformTitle[architecture];+return {architecture,platform,- url+ url,+ name}}