Skip to content

armgit / pdfcn

Public Imported from GitHub
0

Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.

feat: add SponsorLogo component and integrate sponsor logos with light/dark mode support

Aniket-508b263681f3447
diff --git a/app/(app)/sponsor/page.tsx b/app/(app)/sponsor/page.tsx
index 859be6b..5e1634c 100644
--- a/app/(app)/sponsor/page.tsx
+++ b/app/(app)/sponsor/page.tsx
@@ -8,9 +8,45 @@ import { Card, CardContent, CardHeader } from "@/components/ui/card";
import { LINK } from "@/constants/links";
import { ROUTES } from "@/constants/routes";
import { getStargazers } from "@/lib/github";
+import type { Sponsor } from "@/lib/sponsors";
import { tiers } from "@/lib/sponsors";
import { createPageMetadata } from "@/seo/metadata";
+const logoClassName =
+ "h-8 w-auto opacity-60 transition-opacity group-hover:opacity-100";
+
+const SponsorLogo = ({ sponsor }: { sponsor: Sponsor }) => {
+ if (sponsor.logoLight || sponsor.logoDark) {
+ return (
+ <>
+ {/* eslint-disable-next-line @next/next/no-img-element */}
+ <img
+ src={sponsor.logoLight ?? sponsor.logoDark}
+ alt={sponsor.name}
+ className={`${logoClassName} dark:hidden`}
+ />
+ {/* eslint-disable-next-line @next/next/no-img-element */}
+ <img
+ src={sponsor.logoDark ?? sponsor.logoLight}
+ alt={sponsor.name}
+ className={`hidden ${logoClassName} dark:block`}
+ />
+ </>
+ );
+ }
+
+ if (sponsor.logo) {
+ return (
+ // eslint-disable-next-line @next/next/no-img-element
+ <img src={sponsor.logo} alt={sponsor.name} className={logoClassName} />
+ );
+ }
+
+ return (
+ <span className="text-sm font-medium text-foreground">{sponsor.name}</span>
+ );
+};
+
export const metadata: Metadata = createPageMetadata({
description:
"Support pdfcn — beautiful PDF components for React. Sponsor tiers, stargazers, and how to contribute.",
@@ -117,18 +153,7 @@ const SponsorPage = async () => {
borderColor: tier.colors.slotBorder,
}}
>
- {sponsor.logo ? (
- // eslint-disable-next-line @next/next/no-img-element
- <img
- src={sponsor.logo}
- alt={sponsor.name}
- className="h-8 w-auto opacity-60 transition-opacity group-hover:opacity-100"
- />
- ) : (
- <span className="text-sm font-medium text-foreground">
- {sponsor.name}
- </span>
- )}
+ <SponsorLogo sponsor={sponsor} />
</a>
))}
diff --git a/constants/site.ts b/constants/site.ts
index 4d8cac4..6fc8e59 100644
--- a/constants/site.ts
+++ b/constants/site.ts
@@ -44,5 +44,7 @@ export const META_THEME_COLORS = {
};
export const UTM_PARAMS = {
+ utm_campaign: "sponsors_page",
+ utm_medium: "sponsor",
utm_source: new URL(baseUrl).hostname,
};
diff --git a/lib/sponsors.ts b/lib/sponsors.ts
index ec6620f..9367e87 100644
--- a/lib/sponsors.ts
+++ b/lib/sponsors.ts
@@ -1,9 +1,20 @@
-interface Sponsor {
+import { UTM_PARAMS } from "@/constants/site";
+import { addQueryParams } from "@/lib/url";
+
+export interface Sponsor {
name: string;
href: string;
logo?: string;
+ logoLight?: string;
+ logoDark?: string;
}
+const REACT_BITS_PRO: Sponsor = {
+ href: addQueryParams("https://pro.reactbits.dev", UTM_PARAMS),
+ logo: "/sponsors/reactbitpro.svg",
+ name: "React Bits Pro",
+};
+
export const tiers = [
{
colors: {
@@ -15,7 +26,7 @@ export const tiers = [
},
name: "Gold",
slots: 3,
- sponsors: [] as Sponsor[],
+ sponsors: [REACT_BITS_PRO] as Sponsor[],
},
{
colors: {
diff --git a/public/sponsors/reactbitpro.svg b/public/sponsors/reactbitpro.svg
new file mode 100644
index 0000000..4b8edc7
--- /dev/null
+++ b/public/sponsors/reactbitpro.svg
@@ -0,0 +1,8 @@
+<svg width="760" height="111" viewBox="0 0 760 111" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <style>
+ .logo{fill:#1a1a2e}.logo-stroke{stroke:#1a1a2e}@media(prefers-color-scheme:dark){.logo{fill:#ffffff}.logo-stroke{stroke:#ffffff}}
+ </style>
+ <path class="logo" d="M153.289 86.16V25.651h22.132q7.75 0 12.7 2.42t7.283 6.483q2.428 3.975 2.428 9.076 0 4.84-2.428 8.99-2.334 4.062-7.377 6.57-5.043 2.42-12.887 2.42h-12.513v24.548zm34.365 0-14.101-26.883h10.272l14.661 26.882zm-25.027-31.12h12.14q6.91 0 10.179-3.112 3.268-3.198 3.268-8.125 0-5.013-3.175-7.952t-10.272-2.94h-12.14zm60.621 32.157q-6.723 0-11.952-2.853-5.23-2.852-8.218-7.952-2.895-5.1-2.895-11.843 0-6.915 2.895-12.015 2.988-5.186 8.218-8.038 5.229-2.94 12.139-2.94t11.86 2.853 7.657 7.607q2.709 4.668 2.708 10.373 0 .864-.093 1.901 0 .95-.093 2.161H207v-6.137h29.322q-.28-5.445-3.922-8.471-3.642-3.112-9.058-3.112-3.829 0-7.004 1.642-3.175 1.557-5.136 4.668-1.868 3.025-1.868 7.693v2.42q0 4.842 1.868 8.212 1.96 3.285 5.136 5.014 3.175 1.642 6.91 1.642 4.483 0 7.378-1.815a11.04 11.04 0 0 0 4.295-4.927h9.339q-1.215 3.976-4.109 7.174-2.895 3.112-7.191 4.927-4.201 1.815-9.712 1.816m43.713 0q-5.79 0-9.618-1.816-3.83-1.815-5.697-4.84-1.867-3.112-1.867-6.656 0-4.321 2.428-7.347 2.428-3.113 6.91-4.755t10.739-1.642h12.233q0-3.803-1.214-6.31t-3.642-3.717q-2.334-1.296-5.976-1.296-4.203 0-7.191 1.901-2.988 1.815-3.735 5.446h-9.338q.56-4.582 3.361-7.78 2.895-3.284 7.378-5.013 4.482-1.815 9.525-1.815 6.63 0 11.112 2.16t6.724 6.138q2.334 3.89 2.334 9.335v26.97h-8.124l-.747-7.348a21 21 0 0 1-2.428 3.285q-1.4 1.555-3.362 2.68-1.868 1.123-4.389 1.728-2.427.692-5.416.692m1.774-7.002q2.988 0 5.417-1.124 2.427-1.123 4.108-3.025a13 13 0 0 0 2.615-4.409 16.2 16.2 0 0 0 1.027-5.1v-.259H270.79q-4.016 0-6.537.951-2.429.864-3.549 2.42t-1.12 3.63q0 2.161 1.027 3.718 1.12 1.47 3.175 2.334t4.949.864m51.701 7.002q-6.817 0-12.14-2.853-5.323-2.94-8.404-8.039-2.99-5.1-2.989-11.842 0-6.829 2.989-11.928 3.08-5.187 8.404-8.04 5.323-2.938 12.14-2.938 8.59 0 14.381 4.149 5.79 4.148 7.377 11.237h-9.712q-.933-3.804-4.295-5.878-3.268-2.075-7.845-2.075-3.735 0-6.91 1.816-3.176 1.728-5.136 5.186-1.868 3.37-1.868 8.385 0 3.717 1.121 6.655 1.12 2.853 2.988 4.841a13.4 13.4 0 0 0 4.483 3.025q2.52.951 5.322.951 3.082 0 5.51-.864 2.522-.951 4.202-2.766a9.5 9.5 0 0 0 2.428-4.322h9.712q-1.587 6.915-7.377 11.15-5.79 4.15-14.381 4.15m46.436-1.037q-4.482 0-7.751-1.297t-5.043-4.322-1.774-8.212V49.941h-8.124v-7.347h8.124l1.121-10.891h8.217v10.891h13.354v7.347h-13.354v22.474q0 3.717 1.681 5.1 1.681 1.297 5.79 1.297h5.416v7.347zm33.443 0V25.651h24.186q6.817 0 11.393 2.075 4.575 1.988 6.817 5.532 2.334 3.458 2.334 7.865 0 4.582-2.147 7.694-2.148 3.111-5.697 4.84-3.454 1.642-7.47 1.902l1.307-.865q4.296.087 7.844 2.161 3.55 1.989 5.603 5.36 2.055 3.37 2.055 7.433 0 4.668-2.428 8.471-2.429 3.718-7.191 5.878t-11.673 2.161zm9.338-7.175h14.381q6.163 0 9.525-2.593 3.456-2.68 3.456-7.52 0-4.755-3.549-7.607-3.455-2.853-9.618-2.853h-14.195zm0-27.228h13.821q5.883 0 8.965-2.507 3.081-2.594 3.081-7.088 0-4.322-3.081-6.829-3.082-2.593-9.245-2.593h-13.541zm43.541 34.403V42.593h9.338v43.565zm4.762-51.778q-2.707 0-4.482-1.556-1.681-1.555-1.681-3.976 0-2.334 1.681-3.803 1.775-1.556 4.482-1.556 2.615 0 4.389 1.556 1.775 1.47 1.775 3.803 0 2.422-1.775 3.976-1.774 1.556-4.389 1.556M490.64 86.16q-4.483 0-7.75-1.297-3.269-1.297-5.043-4.322t-1.774-8.212V49.941h-8.125v-7.347h8.125l1.12-10.891h8.218v10.891h13.354v7.347h-13.354v22.474q0 3.717 1.681 5.1 1.68 1.297 5.789 1.297h5.417v7.347zm31.963 1.037q-5.977 0-10.459-1.816-4.482-1.815-7.097-5.1t-3.175-7.693h9.525a9.8 9.8 0 0 0 1.774 3.804q1.401 1.728 3.735 2.766 2.428 1.037 5.697 1.037 3.081 0 5.042-.778 2.055-.864 2.989-2.247.933-1.47.933-3.112 0-2.421-1.307-3.63-1.214-1.297-3.735-1.989-2.429-.778-5.883-1.383a56 56 0 0 1-6.35-1.383q-2.989-.951-5.417-2.334-2.334-1.383-3.735-3.457-1.401-2.16-1.401-5.273 0-3.717 2.148-6.656 2.148-3.026 6.07-4.668 4.016-1.728 9.432-1.728 7.844 0 12.606 3.457 4.763 3.458 5.603 9.768h-9.058q-.374-2.94-2.801-4.495-2.428-1.642-6.444-1.642-4.015 0-6.163 1.47-2.148 1.468-2.148 3.889 0 1.556 1.214 2.766t3.549 2.074q2.427.78 5.883 1.47 4.95.865 8.871 2.16 3.923 1.298 6.257 3.804 2.334 2.507 2.334 7.175.095 4.063-2.241 7.174-2.241 3.112-6.443 4.84-4.109 1.73-9.805 1.73M33.057 1.233c4.92-2.508 10.412-.83 14.932 1.814l4.02 2.35-4.702 8.04-4.02-2.351c-3.675-2.15-5.423-1.85-6.002-1.554l-.003.001c-.476.243-1.444 1.096-2.014 3.963-.558 2.802-.553 6.77.199 11.756.388 2.575.964 5.353 1.724 8.287 3.024-.448 6.174-.81 9.423-1.08 5.438-8.789 11.254-16.266 16.858-21.786 4-3.941 8.087-7.077 12.03-8.897C79.265.041 83.63-.807 87.636 1.041l.386.187.01.004c2.956 1.512 4.83 4.131 5.933 7 1.09 2.835 1.535 6.156 1.553 9.666l.022 4.658-9.313.046-.024-4.658c-.014-2.84-.384-4.944-.931-6.369-.53-1.377-1.112-1.858-1.471-2.045l-.099-.046c-.541-.226-1.805-.4-4.296.75-2.596 1.198-5.803 3.534-9.397 7.075-3.849 3.79-7.922 8.742-11.93 14.6a175 175 0 0 1 2.462-.017c15.79 0 30.282 2.126 40.986 5.694 5.328 1.776 9.976 3.994 13.387 6.682 3.358 2.646 6.166 6.297 6.166 10.908 0 3.973-2.105 7.25-4.794 9.736-2.688 2.485-6.342 4.561-10.504 6.28l-4.304 1.776-3.554-8.609 4.305-1.777c3.599-1.486 6.155-3.05 7.735-4.51 1.579-1.459 1.802-2.436 1.803-2.896 0-.534-.321-1.783-2.618-3.593-2.244-1.769-5.782-3.566-10.567-5.161-9.522-3.174-22.973-5.217-38.041-5.217-2.875 0-5.692.075-8.434.218a163 163 0 0 0-4.02 7.412 164 164 0 0 0-3.059 6.33 163 163 0 0 0 2.431 5.089l.634 1.257v.002C54.933 74.943 62.86 86 70.01 93.044c3.593 3.54 6.8 5.875 9.395 7.072 2.651 1.222 3.912.944 4.39.701.426-.216 1.233-.898 1.818-3.109.584-2.204.777-5.37.388-9.459-.775-8.14-3.753-18.901-8.842-30.581l-1.86-4.269 8.539-3.72 1.86 4.27c5.343 12.262 8.679 24.004 9.575 33.418.445 4.688.313 9.063-.657 12.725-.967 3.653-2.94 7.163-6.589 9.023l-.003.001c-4.108 2.092-8.635 1.249-12.52-.542-3.943-1.819-8.03-4.954-12.03-8.894-7.847-7.73-16.108-19.3-23.164-32.939-2.409 6.732-4.036 12.982-4.845 18.356-.75 4.987-.755 8.955-.197 11.758.535 2.689 1.42 3.607 1.92 3.911l.095.052.004.002c.735.375 3.145.599 8.043-2.874l3.799-2.693 5.387 7.598-3.8 2.693c-5.258 3.729-11.854 6.537-17.663 3.572v-.001c-4.106-2.093-6.086-6.25-6.92-10.443-.848-4.26-.714-9.409.122-14.962 1.256-8.346 4.192-18.213 8.594-28.544a150 150 0 0 1-4.187-10.969c-2.958.655-5.692 1.402-8.162 2.225-4.785 1.595-8.322 3.392-10.567 5.161-2.297 1.81-2.617 3.06-2.618 3.593 0 .83.903 3.09 6.22 5.87l4.126 2.16-4.317 8.252-4.126-2.16C5.495 66.307 0 61.698 0 55.177c0-4.61 2.808-8.262 6.167-10.908 3.411-2.689 8.059-4.906 13.387-6.682a90 90 0 0 1 8.46-2.34 90 90 0 0 1-1.757-8.607c-.837-5.553-.971-10.7-.124-14.96.834-4.195 2.814-8.353 6.924-10.446m7.29 36.592a4.99 4.99 0 1 0 0 9.98 4.99 4.99 0 0 0 0-9.98"/>
+ <rect class="logo-stroke" x="575.674" y="7.103" width="181.278" height="100.861" rx="32.465" stroke-width="4.651"/>
+ <mask id="a" maskUnits="userSpaceOnUse" x="621.942" y="30.333" width="91" height="50" fill="#fff"><path d="M622.971 78.333v-47.42h15.987q4.741 0 8.332 1.965 3.659 1.897 5.69 5.352 2.1 3.387 2.1 7.926 0 4.403-1.896 7.858-1.897 3.455-5.284 5.42-3.32 1.964-7.655 1.964h-10.636v16.935zm6.638-23.1h10.568q3.59 0 5.894-2.506 2.303-2.574 2.303-6.571 0-4.133-2.71-6.639-2.641-2.505-6.774-2.506h-9.281zm29.199 23.1v-33.87h6.436v6.096q2.032-3.183 5.216-4.674 3.252-1.558 6.774-1.558v6.097q-3.048 0-5.826.948-2.709.88-4.471 2.98-1.693 2.033-1.693 5.555v18.426zm36.895.813q-5.08 0-8.942-2.235-3.861-2.304-6.097-6.3-2.168-3.998-2.168-9.213 0-5.217 2.168-9.213 2.168-3.997 6.029-6.232 3.861-2.304 8.874-2.304t8.874 2.304q3.862 2.235 6.03 6.232 2.167 3.996 2.167 9.213 0 5.215-2.167 9.213-2.168 3.996-6.03 6.3-3.793 2.235-8.738 2.235m0-5.893q3.048 0 5.419-1.49 2.371-1.56 3.658-4.2 1.355-2.643 1.355-6.165t-1.355-6.165q-1.287-2.642-3.726-4.132-2.437-1.558-5.487-1.558-3.115 0-5.487 1.558-2.37 1.49-3.726 4.132Q685 57.875 685 61.398q0 3.522 1.354 6.164 1.356 2.643 3.794 4.2 2.438 1.49 5.555 1.49"/></mask><path class="logo" d="M622.971 78.333v-47.42h15.987q4.741 0 8.332 1.965 3.659 1.897 5.69 5.352 2.1 3.387 2.1 7.926 0 4.403-1.896 7.858-1.897 3.455-5.284 5.42-3.32 1.964-7.655 1.964h-10.636v16.935zm6.638-23.1h10.568q3.59 0 5.894-2.506 2.303-2.574 2.303-6.571 0-4.133-2.71-6.639-2.641-2.505-6.774-2.506h-9.281zm29.199 23.1v-33.87h6.436v6.096q2.032-3.183 5.216-4.674 3.252-1.558 6.774-1.558v6.097q-3.048 0-5.826.948-2.709.88-4.471 2.98-1.693 2.033-1.693 5.555v18.426zm36.895.813q-5.08 0-8.942-2.235-3.861-2.304-6.097-6.3-2.168-3.998-2.168-9.213 0-5.217 2.168-9.213 2.168-3.997 6.029-6.232 3.861-2.304 8.874-2.304t8.874 2.304q3.862 2.235 6.03 6.232 2.167 3.996 2.167 9.213 0 5.215-2.167 9.213-2.168 3.996-6.03 6.3-3.793 2.235-8.738 2.235m0-5.893q3.048 0 5.419-1.49 2.371-1.56 3.658-4.2 1.355-2.643 1.355-6.165t-1.355-6.165q-1.287-2.642-3.726-4.132-2.437-1.558-5.487-1.558-3.115 0-5.487 1.558-2.37 1.49-3.726 4.132Q685 57.875 685 61.398q0 3.522 1.354 6.164 1.356 2.643 3.794 4.2 2.438 1.49 5.555 1.49" mask="url(#a)"/>
+</svg>