Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: open sponsor slots, equal-size docs logos

kapishdima627477069fac
diff --git a/README.md b/README.md
index 6705eb6e..23ad3931 100644
--- a/README.md
+++ b/README.md
@@ -57,11 +57,6 @@ remocn is free and MIT-licensed. These sponsors keep the registry growing and th
<tr>
<td colspan="15" width="850" align="center"><a href="https://neon.com/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://remocn.dev/sponsors/neon-dark.svg" /><img src="https://remocn.dev/sponsors/neon.svg" alt="Neon" height="48" align="middle" /></picture></a></td>
</tr>
- <tr>
- <td colspan="5" width="283" align="center"><a href="https://www.launchfa.st/"><img src="https://remocn.dev/sponsors/launchfast.png" alt="LaunchFast" height="40" align="middle" /> <b>LaunchFast</b></a></td>
- <td colspan="5" width="283" align="center"><a href="https://ui.aceternity.com/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://remocn.dev/sponsors/aceternity-dark.svg" /><img src="https://remocn.dev/sponsors/aceternity.svg" alt="Aceternity UI" height="40" align="middle" /></picture> <b>Aceternity UI</b></a></td>
- <td colspan="5" width="283" align="center"><a href="https://vidrush.ai/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://remocn.dev/sponsors/vidrush-dark.png" /><img src="https://remocn.dev/sponsors/vidrush.png" alt="VidRush" height="40" align="middle" /></picture></a></td>
- </tr>
<tr>
<td colspan="3" width="170" align="center"><a href="https://21st.dev/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://remocn.dev/sponsors/21st-dark.svg" /><img src="https://remocn.dev/sponsors/21st.svg" alt="21st.dev" height="32" align="middle" /></picture></a></td>
<td colspan="3" width="170" align="center"><a href="https://pro.reactbits.dev/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://remocn.dev/sponsors/reactbits-dark.svg" /><img src="https://remocn.dev/sponsors/reactbits.svg" alt="React Bits" height="32" align="middle" /></picture></a></td>
diff --git a/app/(home)/components/landing/sections/sponsors-strip.tsx b/app/(home)/components/landing/sections/sponsors-strip.tsx
index dc904601..4815dd7e 100644
--- a/app/(home)/components/landing/sections/sponsors-strip.tsx
+++ b/app/(home)/components/landing/sections/sponsors-strip.tsx
@@ -1,15 +1,34 @@
-import { activeSponsors, getLandingSponsors } from "@/config/sponsors";
+import {
+ activeSponsors,
+ getLandingSponsors,
+ openSponsorSlots,
+} from "@/config/sponsors";
import { cn } from "@/lib/utils";
-import { SponsorCarousel } from "./sponsors-strip/sponsor-carousel";
+import {
+ type CarouselItem,
+ SponsorCarousel,
+} from "./sponsors-strip/sponsor-carousel";
import {
PinnedSponsorCell,
SponsorButton,
} from "./sponsors-strip/sponsor-cells";
const pinned = activeSponsors.find((sponsor) => sponsor.tier === "legendary");
-const rotating = getLandingSponsors().filter(
- (sponsor) => sponsor.id !== pinned?.id,
+const rotating = withOpenSlots(
+ getLandingSponsors().filter((sponsor) => sponsor.id !== pinned?.id),
);
+/**
+ * Spreads the open slots through the rotation (positions 3, 5, 7) so each
+ * carousel column gets one and they don't all show at the same step.
+ */
+function withOpenSlots(sponsors: CarouselItem[]): CarouselItem[] {
+ const items = [...sponsors];
+ openSponsorSlots().forEach((slot, index) => {
+ items.splice(Math.min(3 + index * 2, items.length), 0, slot);
+ });
+ return items;
+}
+
const teamCount = activeSponsors.length;
const MOBILE_CELLS = [
@@ -72,7 +91,7 @@ export function SponsorsStrip() {
className="mt-4 flex h-20 overflow-x-auto border-y border-secondary [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
>
{pinned && <PinnedSponsorCell sponsor={pinned} />}
- <SponsorCarousel sponsors={rotating} cellClassNames={MOBILE_CELLS} />
+ <SponsorCarousel items={rotating} cellClassNames={MOBILE_CELLS} />
</div>
</div>
@@ -83,7 +102,7 @@ export function SponsorsStrip() {
>
<StripLead />
{pinned && <PinnedSponsorCell sponsor={pinned} />}
- <SponsorCarousel sponsors={rotating} cellClassNames={DESKTOP_CELLS} />
+ <SponsorCarousel items={rotating} cellClassNames={DESKTOP_CELLS} />
<div className="ml-4 shrink-0">
<SponsorButton />
</div>
diff --git a/app/(home)/components/landing/sections/sponsors-strip/sponsor-carousel.tsx b/app/(home)/components/landing/sections/sponsors-strip/sponsor-carousel.tsx
index 767a6edc..065439f3 100644
--- a/app/(home)/components/landing/sections/sponsors-strip/sponsor-carousel.tsx
+++ b/app/(home)/components/landing/sections/sponsors-strip/sponsor-carousel.tsx
@@ -3,7 +3,7 @@
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
import Link from "next/link";
import { useEffect, useRef, useState } from "react";
-import type { Sponsor } from "@/config/sponsors";
+import type { OpenSponsorSlot, Sponsor } from "@/config/sponsors";
import { cn } from "@/lib/utils";
import { CELL } from "./sponsor-cells";
import { SponsorLogo } from "./sponsor-logo";
@@ -25,20 +25,31 @@ const FADE = {
exit: { opacity: 0 },
};
-function dealColumns(sponsors: Sponsor[], count: number) {
+export type CarouselItem = Sponsor | OpenSponsorSlot;
+
+function dealColumns(items: CarouselItem[], count: number) {
return Array.from({ length: count }, (_, column) =>
- sponsors.filter((_, index) => index % count === column),
+ items.filter((_, index) => index % count === column),
+ );
+}
+
+/** An unsold slot: links to /sponsors in the same cell a logo would fill. */
+function OpenSlot() {
+ return (
+ <span className="text-small whitespace-nowrap text-muted-foreground lg:text-ui">
+ Your logo here
+ </span>
);
}
export function SponsorCarousel({
- sponsors,
+ items,
cellClassNames,
}: {
- sponsors: Sponsor[];
+ items: CarouselItem[];
cellClassNames: string[];
}) {
- const columns = dealColumns(sponsors, cellClassNames.length);
+ const columns = dealColumns(items, cellClassNames.length);
const [step, setStep] = useState(0);
const [held, setHeld] = useState(false);
const [inView, setInView] = useState(false);
@@ -72,14 +83,15 @@ export function SponsorCarousel({
}, [held, inView, pageVisible]);
return columns.map((column, index) => {
- const sponsor = column[step % column.length];
+ const item = column[step % column.length];
+ const open = "open" in item;
return (
<Link
key={column[0].id}
ref={index === 0 ? firstCell : undefined}
- href={sponsor.website}
- target="_blank"
- rel="noreferrer"
+ href={open ? "/sponsors" : item.website}
+ target={open ? undefined : "_blank"}
+ rel={open ? undefined : "noreferrer"}
onPointerEnter={() => setHeld(true)}
onPointerLeave={() => setHeld(false)}
onFocus={() => setHeld(true)}
@@ -92,12 +104,12 @@ export function SponsorCarousel({
>
<AnimatePresence initial={false} mode="popLayout">
<motion.span
- key={sponsor.id}
+ key={item.id}
{...motionSet}
transition={{ duration: 0.5, ease: EASE, delay: index * WAVE_S }}
className="flex items-center justify-center"
>
- <SponsorLogo sponsor={sponsor} />
+ {open ? <OpenSlot /> : <SponsorLogo sponsor={item} />}
</motion.span>
</AnimatePresence>
</Link>
diff --git a/components/docs/shell/sponsors-card.tsx b/components/docs/shell/sponsors-card.tsx
index 749a6c6f..c03f3abe 100644
--- a/components/docs/shell/sponsors-card.tsx
+++ b/components/docs/shell/sponsors-card.tsx
@@ -6,29 +6,33 @@ import { getDocsSponsors, type Sponsor } from "@/config/sponsors";
import { cn } from "@/lib/utils";
import { ArrowIcon } from "./docs-icons";
-/** Wordmark heights (px) from the rail artboard; the rest sit at 16px. */
-const WORDMARK_HEIGHT: Record<string, number> = {
- neon: 22,
- vidrush: 14,
-};
-
/**
- * Width of a local logo drawn `height` px tall, from the SVG viewBox or the
- * PNG header, so the image's size attributes match what's drawn (next/image
- * warns otherwise).
+ * Every logo is fit into the same box: as tall as the box allows, unless that
+ * would run past its width. Long wordmarks fill the width, compact marks the
+ * height, and none reads larger than the box.
*/
-function widthAt(src: string, height: number): number {
+const LOGO_BOX = { width: 100, height: 20 };
+
+/** Width/height of a local logo, from the SVG viewBox or the PNG header. */
+function aspectOf(src: string): number {
if (src.startsWith("/") && src.endsWith(".png")) {
const png = readFileSync(path.join(process.cwd(), "public", src));
- return Math.round((height * png.readUInt32BE(16)) / png.readUInt32BE(20));
+ return png.readUInt32BE(16) / png.readUInt32BE(20);
}
if (src.startsWith("/") && src.endsWith(".svg")) {
const svg = readFileSync(path.join(process.cwd(), "public", src), "utf8");
const box =
/viewBox="[\d.-]+[\s,]+[\d.-]+[\s,]+([\d.]+)[\s,]+([\d.]+)"/.exec(svg);
- if (box) return Math.round((height * Number(box[1])) / Number(box[2]));
+ if (box) return Number(box[1]) / Number(box[2]);
}
- return height * 5;
+ return 5;
+}
+
+/** Drawn size of a logo fit into the shared box; attributes match it. */
+function logoSize(src: string): { width: number; height: number } {
+ const aspect = aspectOf(src);
+ const height = Math.min(LOGO_BOX.height, LOGO_BOX.width / aspect);
+ return { width: Math.round(height * aspect), height: Math.round(height) };
}
/** The card is always dark: prefer a `-dark` logo, else whiten the light one. */
@@ -47,8 +51,9 @@ function darkLogo(sponsor: Sponsor): { src: string; invert: boolean } {
function SponsorLogo({ sponsor }: { sponsor: Sponsor }) {
const logo = darkLogo(sponsor);
const mark = sponsor.displayName && sponsor.layout === "row";
- const height = mark ? 15 : (WORDMARK_HEIGHT[sponsor.id] ?? 16);
- const width = mark ? 15 : widthAt(logo.src, height);
+ const { width, height } = mark
+ ? { width: 15, height: 15 }
+ : logoSize(logo.src);
return (
<a
href={sponsor.website}
diff --git a/config/sponsors.ts b/config/sponsors.ts
index d46e7b27..dfbe7d69 100644
--- a/config/sponsors.ts
+++ b/config/sponsors.ts
@@ -58,6 +58,7 @@ export const sponsors: Sponsor[] = (
customStyles: "opacity-100 grayscale-0 dark:[filter:invert(1)]",
isPaste: false,
layout: "row",
+ placements: [],
},
{
id: "aceternity",
@@ -70,6 +71,7 @@ export const sponsors: Sponsor[] = (
customStyles: "opacity-90",
isPaste: false,
layout: "row",
+ placements: [],
},
{
id: "vidrush",
@@ -80,6 +82,7 @@ export const sponsors: Sponsor[] = (
tier: "featured",
customStyles: "opacity-90 max-w-full",
isPaste: false,
+ placements: [],
},
{
id: "21st",
@@ -269,6 +272,18 @@ function getSponsorsFor(placement: SponsorPlacement): Sponsor[] {
.sort((a, b) => TIER_RANK[a.tier] - TIER_RANK[b.tier]);
}
+/** Empty "Your logo here" slots in the landing carousel, linking to /sponsors. */
+export const OPEN_SPONSOR_SLOTS = 3;
+
+export type OpenSponsorSlot = { id: string; open: true };
+
+export function openSponsorSlots(): OpenSponsorSlot[] {
+ return Array.from({ length: OPEN_SPONSOR_SLOTS }, (_, index) => ({
+ id: `open-slot-${index + 1}`,
+ open: true,
+ }));
+}
+
export function getLandingSponsors(): Sponsor[] {
return getSponsorsFor("landing");
}