Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Featured programs

Tim Wilsone4ca1b30df76
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-programs.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-programs.tsx
index 53017c66fb..05a1abd103 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-programs.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-programs.tsx
@@ -1,5 +1,14 @@
+"use client";
+
import { NetworkProgramProps } from "@/lib/types";
-import { fetcher } from "@dub/utils";
+import {
+ Carousel,
+ CarouselContent,
+ CarouselItem,
+ CarouselNavBar,
+} from "@dub/ui";
+import { cn, fetcher } from "@dub/utils";
+import { ComponentProps } from "react";
import useSWR from "swr";
import { FeaturedProgramCard } from "./program-card";
@@ -15,18 +24,38 @@ export function FeaturedPrograms() {
<h2 className="text-content-emphasis text-base font-semibold">
Featured programs
</h2>
- <div className="@3xl/page:grid-cols-2 mt-4 grid grid-cols-1 gap-4">
- {programs ? (
- programs.map((program) => (
- <FeaturedProgramCard key={program.id} program={program} />
- ))
- ) : (
- <>
- <FeaturedProgramCard />
- <FeaturedProgramCard />
- </>
- )}
+ <div className="mt-4">
+ <Carousel autoplay={{ delay: 5000 }} opts={{ loop: true }}>
+ <CarouselContent className="items-stretch">
+ {programs ? (
+ programs.map((program) => (
+ <CarouselCard key={program.id} program={program} />
+ ))
+ ) : (
+ <>
+ <CarouselCard />
+ <CarouselCard />
+ </>
+ )}
+ </CarouselContent>
+ <div
+ className={cn(
+ "mt-2",
+ (!programs || programs.length <= 2) && "@2xl/page:hidden",
+ )}
+ >
+ <CarouselNavBar />
+ </div>
+ </Carousel>
</div>
</div>
);
}
+
+const CarouselCard = (props: ComponentProps<typeof FeaturedProgramCard>) => {
+ return (
+ <CarouselItem className="@2xl/page:basis-1/2 basis-full">
+ <FeaturedProgramCard {...props} />
+ </CarouselItem>
+ );
+};
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx
index b4b43d2cf3..ca654cf411 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx
@@ -207,7 +207,7 @@ export function FeaturedProgramCard({
return (
<div
className={cn(
- "border-border-subtle relative overflow-hidden rounded-xl border p-6",
+ "border-border-subtle relative h-full overflow-hidden rounded-xl border p-6",
program?.id &&
"cursor-pointer border-transparent bg-black hover:drop-shadow-sm",
)}