From 5dea009304ea20ef371ce8424504c4cc0e21b94b Mon Sep 17 00:00:00 2001 From: ExampleWasTaken <58574351+ExampleWasTaken@users.noreply.github.com> Date: Sat, 9 Nov 2024 23:59:35 +0100 Subject: [PATCH 1/2] add alert component --- src/components/Alert/Alert.tsx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/components/Alert/Alert.tsx diff --git a/src/components/Alert/Alert.tsx b/src/components/Alert/Alert.tsx new file mode 100644 index 00000000..36306c4b --- /dev/null +++ b/src/components/Alert/Alert.tsx @@ -0,0 +1,33 @@ +import { ReactNode } from 'react'; +import { twMerge } from 'tailwind-merge'; + +interface AlertProps { + type: 'note' | 'caution' | 'danger'; + className?: string; + children: ReactNode; +} + +export const Alert = ({ type, className, children }: AlertProps) => { + let borderColor: string; + switch (type) { + default: + case 'note': { + borderColor = 'border-l-cyan'; + break; + } + case 'caution': { + borderColor = 'border-l-utility-amber'; + break; + } + case 'danger': { + borderColor = 'border-l-red'; + break; + } + } + + return ( +
+ {children} +
+ ); +}; From 35105d4465066111bb8e3862a868848d3bfa1f13 Mon Sep 17 00:00:00 2001 From: ExampleWasTaken <58574351+ExampleWasTaken@users.noreply.github.com> Date: Sun, 10 Nov 2024 01:28:34 +0100 Subject: [PATCH 2/2] add support for multi-part downloads --- src/components/Downloads/DownloadLinks.tsx | 51 ++++++++++++---------- src/pages/downloads/index.tsx | 34 +++++++++++++-- 2 files changed, 59 insertions(+), 26 deletions(-) diff --git a/src/components/Downloads/DownloadLinks.tsx b/src/components/Downloads/DownloadLinks.tsx index e000ef8f..2ffb4aaa 100644 --- a/src/components/Downloads/DownloadLinks.tsx +++ b/src/components/Downloads/DownloadLinks.tsx @@ -1,31 +1,38 @@ import Link from 'next/link'; -import Button from '../Button/Button'; +import { Alert } from '../Alert/Alert'; + +interface Version { + name: string; + links: string[]; +} type DownloadProps = { - stableLink?: string, - devLink?: string, aircraft: string, - + note?: string; + versions: Version[]; } -const downloadLinks = ({ stableLink, devLink, aircraft }: DownloadProps) => ( - +const DownloadLinks = ({ versions, note, aircraft }: DownloadProps) => ( +

{aircraft}

- {stableLink && devLink ? ( - <> - - - - - - - - - - ) : ( -

Use our installer to download.

- )} - +
+ {note && {note}} + +
+ {versions.map((version) => ( +
    + {version.links.map((link, i) => ( +
  • + {`${version.name} - Part ${i + 1} of ${version.links.length}`} +
  • + ))} +
+ ))} +
+
+
); -export default downloadLinks; +export default DownloadLinks; diff --git a/src/pages/downloads/index.tsx b/src/pages/downloads/index.tsx index 4ab2681f..6d73461f 100644 --- a/src/pages/downloads/index.tsx +++ b/src/pages/downloads/index.tsx @@ -35,13 +35,39 @@ const Downloads: NextPage = () => (

Direct Download

If you prefer a direct download, the following links are available.

-
+
+ + -