From 90440e8e06964831cb16da9600490c0759320cdf Mon Sep 17 00:00:00 2001 From: Adam Matthiesen Date: Wed, 16 Oct 2024 20:37:49 -0700 Subject: [PATCH] Refactor to use dynamic sponsor links --- www/docs/src/components/Sponsors.astro | 3 ++- .../content/docs/start-here/getting-started.mdx | 5 +++-- www/docs/src/share-link.ts | 7 +++++++ www/docs/src/util/SponsorLink.astro | 8 ++++++++ www/shared-config/sponsors.ts | 16 ++++++++++++++++ www/web/src/pages/index.astro | 3 ++- www/web/src/share-link.ts | 5 +++++ 7 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 www/docs/src/share-link.ts create mode 100644 www/docs/src/util/SponsorLink.astro create mode 100644 www/shared-config/sponsors.ts create mode 100644 www/web/src/share-link.ts diff --git a/www/docs/src/components/Sponsors.astro b/www/docs/src/components/Sponsors.astro index 22c5668aa..1c2b52832 100644 --- a/www/docs/src/components/Sponsors.astro +++ b/www/docs/src/components/Sponsors.astro @@ -1,10 +1,11 @@ --- +import s from '~/share-link'; ---
Sponsored By -1. Install the [Turso CLI](https://docs.turso.tech/cli/installation) -2. [Login or signup](https://docs.turso.tech/cli/authentication) to Turso. +1. Install the +2. to Turso. 3. Create a new database. 4. Get and Set `ASTRO_DB_REMOTE_URL` diff --git a/www/docs/src/share-link.ts b/www/docs/src/share-link.ts new file mode 100644 index 000000000..61160e098 --- /dev/null +++ b/www/docs/src/share-link.ts @@ -0,0 +1,7 @@ +import sponsors from '../../shared-config/sponsors'; + +export { default as SponsorLink } from './util/SponsorLink.astro'; + +export { sponsors }; + +export default sponsors; diff --git a/www/docs/src/util/SponsorLink.astro b/www/docs/src/util/SponsorLink.astro new file mode 100644 index 000000000..630a0c244 --- /dev/null +++ b/www/docs/src/util/SponsorLink.astro @@ -0,0 +1,8 @@ +--- +interface Props { + text: string; + href: string | URL; +} +const { text, href } = Astro.props; +--- +{text} ⤴ \ No newline at end of file diff --git a/www/shared-config/sponsors.ts b/www/shared-config/sponsors.ts new file mode 100644 index 000000000..fba473576 --- /dev/null +++ b/www/shared-config/sponsors.ts @@ -0,0 +1,16 @@ +// This file is used to define the sponsors and their respective urls. +export const sponsors = { + turso: { + docs: { + sidebarSponsorLink: 'https://turso.tech', + installCLILink: 'https://docs.turso.tech/cli/installation', + loginsignupLink: 'https://docs.turso.tech/cli/authentication', + }, + web: { + sponsorLink: 'https://turso.tech', + }, + // TODO: Add Turso specific links when they are provided to us. + // Also, switch to utilizing these new links within the websites. + }, +}; +export default sponsors; diff --git a/www/web/src/pages/index.astro b/www/web/src/pages/index.astro index 97b3b08bd..1e9f3accf 100644 --- a/www/web/src/pages/index.astro +++ b/www/web/src/pages/index.astro @@ -9,6 +9,7 @@ import Separator from '../components/Separator.astro'; // import TestimonialCard from '../components/TestimonialCard.astro'; import { GITHUB_URL, SPONSOR_URL } from '../constants'; import BaseLayout from '../layouts/BaseLayout.astro'; +import sponsors from '../share-link'; const features = (await getCollection('features')).sort( ({ data: { sortOrder: a } }, { data: { sortOrder: b } }) => a - b @@ -35,7 +36,7 @@ const features = (await getCollection('features')).sort(

Sponsored by

- + {'Turso diff --git a/www/web/src/share-link.ts b/www/web/src/share-link.ts new file mode 100644 index 000000000..b1172db64 --- /dev/null +++ b/www/web/src/share-link.ts @@ -0,0 +1,5 @@ +import sponsors from '../../shared-config/sponsors'; + +export { sponsors }; + +export default sponsors;