Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

feat: integrate embla-carousel for dynamic badge display in FooterLaunchBadges component

VladSez69da0803bfcb
diff --git a/package.json b/package.json
index 59aafd2..c7fac69 100644
--- a/package.json
+++ b/package.json
@@ -69,6 +69,8 @@
"clsx": "2.1.1",
"cmdk": "1.0.0",
"dayjs": "1.11.13",
+ "embla-carousel-auto-scroll": "8.6.0",
+ "embla-carousel-react": "8.6.0",
"eslint-plugin-react-hooks": "5.2.0",
"file-saver": "2.0.5",
"googleapis": "148.0.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2f9e9ac..7d68764 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -101,6 +101,12 @@ importers:
dayjs:
specifier: 1.11.13
version: 1.11.13
+ embla-carousel-auto-scroll:
+ specifier: 8.6.0
+ version: 8.6.0([email protected])
+ embla-carousel-react:
+ specifier: 8.6.0
+ version: 8.6.0([email protected])
eslint-plugin-react-hooks:
specifier: 5.2.0
@@ -3808,6 +3814,24 @@ packages:
resolution: {integrity: sha512-3gl0S7zQd88kCAZRO/DnxtBKuhMO4h0EaQIN3YgZfV6+pW+5+bf2AdQeHNESCoaQqo/gjGVYEf2YM4O5HJQqpQ==}
+ resolution: {integrity: sha512-WT9fWhNXFpbQ6kP+aS07oF5IHYLZ1Dx4DkwgCY8Hv2ZyYd2KMCPfMV1q/cA3wFGuLO7GMgKiySLX90/pQkcOdQ==}
+ peerDependencies:
+ embla-carousel: 8.6.0
+
+ resolution: {integrity: sha512-0/PjqU7geVmo6F734pmPqpyHqiM99olvyecY7zdweCw+6tKEXnrE90pBiBbMMU8s5tICemzpQ3hi5EpxzGW+JA==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.1 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
+
+ resolution: {integrity: sha512-fMVUDUEx0/uIEDM0Mz3dHznDhfX+znCCDCeIophYb1QGVM7YThSWX+wz11zlYwWFOr74b4QLGg0hrGPJeG2s4A==}
+ peerDependencies:
+ embla-carousel: 8.6.0
+
+ resolution: {integrity: sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA==}
+
resolution: {integrity: sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==}
@@ -10876,6 +10900,22 @@ snapshots:
+ dependencies:
+ embla-carousel: 8.6.0
+
+ dependencies:
+ embla-carousel: 8.6.0
+ embla-carousel-reactive-utils: 8.6.0([email protected])
+ react: 18.3.1
+
+ dependencies:
+ embla-carousel: 8.6.0
+
+
diff --git a/src/app/(components)/footer-launch-badges.tsx b/src/app/(components)/footer-launch-badges.tsx
index 8f39482..01ff8fc 100644
--- a/src/app/(components)/footer-launch-badges.tsx
+++ b/src/app/(components)/footer-launch-badges.tsx
@@ -1,275 +1,335 @@
+"use client";
+
+import AutoScroll from "embla-carousel-auto-scroll";
+import { type ReactNode, useState } from "react";
+
+import {
+ Carousel,
+ CarouselContent,
+ CarouselItem,
+} from "@/components/ui/carousel";
+
/**
* FooterLaunchBadges
* Renders launch/featured badges in footer: Startup Fame, LaunchPanda, Tiny Startups, etc.
*/
export function FooterLaunchBadges() {
- return (
- <>
- {/* Badge for featured on Startup Fame */}
- <a
- href="https://startupfa.me/s/easyinvoicepdf?utm_source=easyinvoicepdf.com"
- target="_blank"
- >
- <img
- src="https://startupfa.me/badges/featured/light-rounded.webp"
- alt="EasyInvoicePDF - Featured on Startup Fame"
- width="171"
- height="54"
- />
- </a>
-
- {/* Badge for Launched on LaunchPanda */}
- <a
- href="https://launchpanda.dev/launches/productivity/easyinvoicepdf"
- target="_blank"
- rel="noopener"
- >
- <img
- src="https://launchpanda.dev/images/badges/launchpanda-badge.svg"
- alt="Launched on LaunchPanda"
- width="260"
- height="64"
- />
- </a>
+ const [autoScrollPlugin] = useState(() =>
+ AutoScroll({
+ playOnInit: true,
+ speed: 0.35,
+ stopOnInteraction: false,
+ }),
+ );
- {/* Badge for Verified DR */}
- <a
- href="https://verifieddr.com/website/easyinvoicepdf-com"
- target="_blank"
- >
- <img
- src="https://verifieddr.com/badge/easyinvoicepdf-com.svg?metric=truedr"
- alt="Verified DR - Verified Domain Rating for easyinvoicepdf.com"
- width="220"
- height="68"
- />
- </a>
+ return (
+ <Carousel
+ opts={{ loop: true, align: "start" }}
+ plugins={[autoScrollPlugin]}
+ className="w-full"
+ aria-label="Launch badges"
+ >
+ <CarouselContent className="-ml-3 items-center">
+ {/* Badge for featured on Startup Fame */}
+ <BadgeSlide>
+ <a
+ href="https://startupfa.me/s/easyinvoicepdf?utm_source=easyinvoicepdf.com"
+ target="_blank"
+ >
+ <img
+ src="https://startupfa.me/badges/featured/light-rounded.webp"
+ alt="EasyInvoicePDF - Featured on Startup Fame"
+ width="171"
+ height="54"
+ />
+ </a>
+ </BadgeSlide>
- {/* Badge for Featured on Nick Launches */}
- <a
- href="https://nicklaunches.com/products/easyinvoicepdf/?utm_source=easyinvoicepdf.com&utm_medium=badge&utm_campaign=featured"
- target="_blank"
- rel="noopener"
- >
- <img
- src="https://nicklaunches.com/badges/featured.png"
- alt="EasyInvoicePDF on Nick Launches"
- width="244"
- height="56"
- />
- </a>
+ {/* Badge for Launched on LaunchPanda */}
+ <BadgeSlide>
+ <a
+ href="https://launchpanda.dev/launches/productivity/easyinvoicepdf"
+ target="_blank"
+ rel="noopener"
+ >
+ <img
+ src="https://launchpanda.dev/images/badges/launchpanda-badge.svg"
+ alt="Launched on LaunchPanda"
+ width="260"
+ height="64"
+ />
+ </a>
+ </BadgeSlide>
- {/* Badge for Featured on Huzzler */}
- <a
- href="https://huzzler.so/products/WoT22LdqV0/easyinvoicepdf?utm_source=huzzler_product_website&utm_medium=badge&utm_campaign=free_listing"
- target="_blank"
- rel="noopener noreferrer"
- >
- <img
- alt="Huzzler Embed Badge"
- src="https://huzzler.so/assets/images/embeddable-badges/featured.png"
- width="159"
- height="55"
- />
- </a>
+ {/* Badge for Verified DR */}
+ <BadgeSlide>
+ <a
+ href="https://verifieddr.com/website/easyinvoicepdf-com"
+ target="_blank"
+ >
+ <img
+ src="https://verifieddr.com/badge/easyinvoicepdf-com.svg?metric=truedr"
+ alt="Verified DR - Verified Domain Rating for easyinvoicepdf.com"
+ width="220"
+ height="68"
+ />
+ </a>
+ </BadgeSlide>
- {/* Badge for Featured on EasyLaunch */}
- <a
- href="https://easylaunch.dev/finance/easyinvoicepdf"
- target="_blank"
- rel="noopener"
- >
- <img
- src="https://easylaunch.dev/badge/easylaunch-badge-light.svg"
- alt="Featured on EasyLaunch"
- width="188"
- height="56"
- />
- </a>
+ {/* Badge for Featured on Nick Launches */}
+ <BadgeSlide>
+ <a
+ href="https://nicklaunches.com/products/easyinvoicepdf/?utm_source=easyinvoicepdf.com&utm_medium=badge&utm_campaign=featured"
+ target="_blank"
+ rel="noopener"
+ >
+ <img
+ src="https://nicklaunches.com/badges/featured.png"
+ alt="EasyInvoicePDF on Nick Launches"
+ width="244"
+ height="56"
+ />
+ </a>
+ </BadgeSlide>
- {/* Badge for Featured on EasyDoFollow */}
- <a
- href="https://easydofollow.dev/finance/easyinvoicepdf"
- target="_blank"
- rel="noopener"
- >
- <img
- src="https://easydofollow.dev/badge/easydofollow-badge-light.svg"
- alt="Featured on EasyDoFollow"
- width="188"
- height="56"
- />
- </a>
+ {/* Badge for Featured on Huzzler */}
+ <BadgeSlide>
+ <a
+ href="https://huzzler.so/products/WoT22LdqV0/easyinvoicepdf?utm_source=huzzler_product_website&utm_medium=badge&utm_campaign=free_listing"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <img
+ alt="Huzzler Embed Badge"
+ src="https://huzzler.so/assets/images/embeddable-badges/featured.png"
+ width="159"
+ height="55"
+ />
+ </a>
+ </BadgeSlide>
- {/* Badge for Trending on BuildHop */}
- <a
- href="https://buildhop.io/discover/easyinvoicepdf-54735f67-1b04-4e01-a1ca-6ec6e716de5f"
- target="_blank"
- rel="noopener noreferrer"
- title="Trending on BuildHop: EasyInvoicePDF"
- >
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="208"
- height="60"
- viewBox="0 0 208 60"
- >
- <rect
- x="1.5"
- y="1.5"
- width="205"
- height="57"
- rx="12"
- fill="#FFFDF7"
- stroke="#78A7A2"
- strokeWidth="3"
- />
- <g transform="translate(13 9) scale(.104)">
- <path
- d="M328.7 93.9a50 50 0 0 0-37-33.4c-41.4-7.2-85.9 29.7-115 61.6a223 223 0 0 0-33-72.5c-19.1-27-49.9-56.2-86.1-48.3C32.5 7 16.9 30 9.5 52.7c-22 70.4-2.5 162.7 25.4 229 8.7 20.2 19 40 32 57.8 1 1.5 3.5.7 3.4-1.2a146 146 0 0 1 1-29l-.5-1c-22-45.4-33-96.3-35.5-146.6-1.2-32 .3-65.2 12-95a61 61 0 0 1 9.8-16.9q2.5-2.7 5.2-4.5c7.4-4.6 16.2 1.4 22.2 6.3 14.1 11.8 24 28.4 33.2 44.6q6.8 12 13.2 24.6a322 322 0 0 1 32 94.6c5.8 31.6 8 64 3.5 95.8a148 148 0 0 1-5 22q-2 6.3-4.8 12.3-3.6 7.5-9 13.3a24 24 0 0 1-12 7.2q-8.5 1.8-17.6-2.3-8.3-4.3-12.6-16c-11.2-34.6 6.8-83.3 22.2-115q9-17.8 19.6-34.8a3 3 0 0 0 .3-2.6q-3.6-9.7-7.4-17.2a3 3 0 0 0-5.1-.2C76 277.7 84 331.5 83.8 331.4c1.2 16.6 5.6 35.4 18.5 44.7h-.3c7.8 5.3 16.2 9 25 10a42 42 0 0 0 28.8-7 77 77 0 0 0 26.6-36.5q5.9-15.6 9-32.2c8.3-42.6 5-88.9-2-130.4a997 997 0 0 0-6-30.4 316 316 0 0 1 34-32.8c15-12 31.5-23.2 50-28.4q32.6-8.6 37.1 24.6c2 14.9 0 30.3-3.3 45.1-8 35.5-23.6 69.3-42.9 100.3a376 376 0 0 1-54.7 68.6c-5.6 15-12.4 27.2-18.8 36.6-1.1 1.7.9 3.8 2.7 2.8l.8-.6c37-24 66.7-57.5 91.1-93.8 21.8-33 40.2-69 49.5-107.5 5.2-23 7.8-47.9-.2-70.6"
- fill="#006C67"
+ {/* Badge for Featured on EasyLaunch */}
+ <BadgeSlide>
+ <a
+ href="https://easylaunch.dev/finance/easyinvoicepdf"
+ target="_blank"
+ rel="noopener"
+ >
+ <img
+ src="https://easylaunch.dev/badge/easylaunch-badge-light.svg"
+ alt="Featured on EasyLaunch"
+ width="188"
+ height="56"
/>
- </g>
- <text
- x="64"
- y="24"
- fill="#FFA100"
- fontSize="13"
- fontFamily="Avenir Next, Inter, ui-sans-serif, system-ui, sans-serif"
- fontWeight="700"
- letterSpacing=".08em"
+ </a>
+ </BadgeSlide>
+
+ {/* Badge for Featured on EasyDoFollow */}
+ <BadgeSlide>
+ <a
+ href="https://easydofollow.dev/finance/easyinvoicepdf"
+ target="_blank"
+ rel="noopener"
>
- TRENDING ON
- </text>
- <text
- x="64"
- y="43"
- fill="#053F43"
- fontSize="22"
- fontFamily="Avenir Next, Inter, ui-sans-serif, system-ui, sans-serif"
- fontWeight="800"
- letterSpacing=".06em"
+ <img
+ src="https://easydofollow.dev/badge/easydofollow-badge-light.svg"
+ alt="Featured on EasyDoFollow"
+ width="188"
+ height="56"
+ />
+ </a>
+ </BadgeSlide>
+
+ {/* Badge for Trending on BuildHop */}
+ <BadgeSlide>
+ <a
+ href="https://buildhop.io/discover/easyinvoicepdf-54735f67-1b04-4e01-a1ca-6ec6e716de5f"
+ target="_blank"
+ rel="noopener noreferrer"
+ title="Trending on BuildHop: EasyInvoicePDF"
>
- BuildHop
- </text>
- </svg>
- </a>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="208"
+ height="60"
+ viewBox="0 0 208 60"
+ >
+ <rect
+ x="1.5"
+ y="1.5"
+ width="205"
+ height="57"
+ rx="12"
+ fill="#FFFDF7"
+ stroke="#78A7A2"
+ strokeWidth="3"
+ />
+ <g transform="translate(13 9) scale(.104)">
+ <path
+ d="M328.7 93.9a50 50 0 0 0-37-33.4c-41.4-7.2-85.9 29.7-115 61.6a223 223 0 0 0-33-72.5c-19.1-27-49.9-56.2-86.1-48.3C32.5 7 16.9 30 9.5 52.7c-22 70.4-2.5 162.7 25.4 229 8.7 20.2 19 40 32 57.8 1 1.5 3.5.7 3.4-1.2a146 146 0 0 1 1-29l-.5-1c-22-45.4-33-96.3-35.5-146.6-1.2-32 .3-65.2 12-95a61 61 0 0 1 9.8-16.9q2.5-2.7 5.2-4.5c7.4-4.6 16.2 1.4 22.2 6.3 14.1 11.8 24 28.4 33.2 44.6q6.8 12 13.2 24.6a322 322 0 0 1 32 94.6c5.8 31.6 8 64 3.5 95.8a148 148 0 0 1-5 22q-2 6.3-4.8 12.3-3.6 7.5-9 13.3a24 24 0 0 1-12 7.2q-8.5 1.8-17.6-2.3-8.3-4.3-12.6-16c-11.2-34.6 6.8-83.3 22.2-115q9-17.8 19.6-34.8a3 3 0 0 0 .3-2.6q-3.6-9.7-7.4-17.2a3 3 0 0 0-5.1-.2C76 277.7 84 331.5 83.8 331.4c1.2 16.6 5.6 35.4 18.5 44.7h-.3c7.8 5.3 16.2 9 25 10a42 42 0 0 0 28.8-7 77 77 0 0 0 26.6-36.5q5.9-15.6 9-32.2c8.3-42.6 5-88.9-2-130.4a997 997 0 0 0-6-30.4 316 316 0 0 1 34-32.8c15-12 31.5-23.2 50-28.4q32.6-8.6 37.1 24.6c2 14.9 0 30.3-3.3 45.1-8 35.5-23.6 69.3-42.9 100.3a376 376 0 0 1-54.7 68.6c-5.6 15-12.4 27.2-18.8 36.6-1.1 1.7.9 3.8 2.7 2.8l.8-.6c37-24 66.7-57.5 91.1-93.8 21.8-33 40.2-69 49.5-107.5 5.2-23 7.8-47.9-.2-70.6"
+ fill="#006C67"
+ />
+ </g>
+ <text
+ x="64"
+ y="24"
+ fill="#FFA100"
+ fontSize="13"
+ fontFamily="Avenir Next, Inter, ui-sans-serif, system-ui, sans-serif"
+ fontWeight="700"
+ letterSpacing=".08em"
+ >
+ TRENDING ON
+ </text>
+ <text
+ x="64"
+ y="43"
+ fill="#053F43"
+ fontSize="22"
+ fontFamily="Avenir Next, Inter, ui-sans-serif, system-ui, sans-serif"
+ fontWeight="800"
+ letterSpacing=".06em"
+ >
+ BuildHop
+ </text>
+ </svg>
+ </a>
+ </BadgeSlide>
- {/* Badge for Launched on StartupBase */}
- <a
- href="https://startupbase.io/products/easyinvoicepdf?utm_source=startupbase&utm_medium=badge&utm_campaign=launch-badge-light"
- target="_blank"
- rel="noopener noreferrer"
- >
- <img
- src="https://statics.startupbase.io/site/badges/launched-on-sb.svg"
- alt="Launched on StartupBase"
- height="55"
- style={{ height: 55, width: "auto" }}
- />
- </a>
+ {/* Badge for Launched on StartupBase */}
+ <BadgeSlide>
+ <a
+ href="https://startupbase.io/products/easyinvoicepdf?utm_source=startupbase&utm_medium=badge&utm_campaign=launch-badge-light"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <img
+ src="https://statics.startupbase.io/site/badges/launched-on-sb.svg"
+ alt="Launched on StartupBase"
+ height="55"
+ style={{ height: 55, width: "auto" }}
+ />
+ </a>
+ </BadgeSlide>
- {/* Badge for Featured on Better Launch */}
- <a href="https://www.betterlaunch.co/product/easyinvoicepdf">
- <img
- src="https://www.betterlaunch.co/badge-launching-gradient.svg"
- alt="Featured on Better Launch"
- width="200"
- height="56"
- />
- </a>
+ {/* Badge for Featured on Better Launch */}
+ <BadgeSlide>
+ <a href="https://www.betterlaunch.co/product/easyinvoicepdf">
+ <img
+ src="https://www.betterlaunch.co/badge-launching-gradient.svg"
+ alt="Featured on Better Launch"
+ width="200"
+ height="56"
+ />
+ </a>
+ </BadgeSlide>
- {/* Badge for Featured on DodoDirectory */}
- <a href="https://dododirectory.com" target="_blank" rel="dofollow">
- <img
- src="https://dododirectory.com/badge-light.png"
- alt="Featured on DodoDirectory"
- width="200"
- height="54"
- />
- </a>
+ {/* Badge for Featured on DodoDirectory */}
+ <BadgeSlide>
+ <a href="https://dododirectory.com" target="_blank" rel="dofollow">
+ <img
+ src="https://dododirectory.com/badge-light.png"
+ alt="Featured on DodoDirectory"
+ width="200"
+ height="54"
+ />
+ </a>
+ </BadgeSlide>
- {/* Badge for Featured on DanielLaunches */}
- <a href="https://daniellaunches.com" target="_blank">
- <img
- src="https://daniellaunches.com/badge-light.svg"
- alt="Featured on DanielLaunches"
- width="220"
- height="48"
- />
- </a>
+ {/* Badge for Featured on DanielLaunches */}
+ <BadgeSlide>
+ <a href="https://daniellaunches.com" target="_blank">
+ <img
+ src="https://daniellaunches.com/badge-light.svg"
+ alt="Featured on DanielLaunches"
+ width="220"
+ height="48"
+ />
+ </a>
+ </BadgeSlide>
- {/* Badge for Launched on Tiny Startups */}
- <a
- href="https://www.tinystartups.com/startup/easyinvoicepdf"
- target="_blank"
- rel="noopener"
- style={{
- display: "inline-flex",
- alignItems: "center",
- gap: 14,
- padding: "14px 22px 14px 18px",
- borderRadius: 14,
- textDecoration: "none",
- fontFamily: "'Inter',system-ui,sans-serif",
- background:
- "linear-gradient(#fff,#fff) padding-box,linear-gradient(90deg,#3525E6,#D81FE0,#22B8F0) border-box",
- border: "2px solid transparent",
- color: "#0E0B1F",
- }}
- >
- <svg width="56" height="56" viewBox="0 0 100 100">
- <defs>
- <linearGradient id="tsg" x1=".1" y1="0" x2=".9" y2="1">
- <stop offset="0%" stopColor="#3525E6" />
- <stop offset="55%" stopColor="#D81FE0" />
- <stop offset="100%" stopColor="#22B8F0" />
- </linearGradient>
- </defs>
- <path
- d="M50 6C52 32 68 48 94 50C68 52 52 68 50 94C48 68 32 52 6 50C32 48 48 32 50 6Z"
- fill="url(#tsg)"
- />
- </svg>
- <span
- style={{
- display: "flex",
- flexDirection: "column",
- lineHeight: 1.15,
- }}
- >
- <span
- style={{
- fontFamily: "monospace",
- fontSize: 9,
- fontWeight: 600,
- letterSpacing: 0.18,
- textTransform: "uppercase",
- color: "#6A6585",
- }}
- >
- Launched on
- </span>
- <span
- style={{
- fontSize: 22,
- fontWeight: 800,
- letterSpacing: -0.025,
- }}
- >
- Tiny Startups
- </span>
- <span
+ {/* Badge for Launched on Tiny Startups */}
+ <BadgeSlide>
+ <a
+ href="https://www.tinystartups.com/startup/easyinvoicepdf"
+ target="_blank"
+ rel="noopener"
style={{
- fontSize: 11,
- color: "#6A6585",
- marginTop: 4,
+ display: "inline-flex",
+ alignItems: "center",
+ gap: 14,
+ padding: "14px 22px 14px 18px",
+ borderRadius: 14,
+ textDecoration: "none",
+ fontFamily: "'Inter',system-ui,sans-serif",
+ background:
+ "linear-gradient(#fff,#fff) padding-box,linear-gradient(90deg,#3525E6,#D81FE0,#22B8F0) border-box",
+ border: "2px solid transparent",
+ color: "#0E0B1F",
}}
>
- tinystartups.com
- </span>
- </span>
- </a>
- </>
+ <svg width="56" height="56" viewBox="0 0 100 100">
+ <defs>
+ <linearGradient id="tsg" x1=".1" y1="0" x2=".9" y2="1">
+ <stop offset="0%" stopColor="#3525E6" />
+ <stop offset="55%" stopColor="#D81FE0" />
+ <stop offset="100%" stopColor="#22B8F0" />
+ </linearGradient>
+ </defs>
+ <path
+ d="M50 6C52 32 68 48 94 50C68 52 52 68 50 94C48 68 32 52 6 50C32 48 48 32 50 6Z"
+ fill="url(#tsg)"
+ />
+ </svg>
+ <span
+ style={{
+ display: "flex",
+ flexDirection: "column",
+ lineHeight: 1.15,
+ }}
+ >
+ <span
+ style={{
+ fontFamily: "monospace",
+ fontSize: 9,
+ fontWeight: 600,
+ letterSpacing: 0.18,
+ textTransform: "uppercase",
+ color: "#6A6585",
+ }}
+ >
+ Launched on
+ </span>
+ <span
+ style={{
+ fontSize: 22,
+ fontWeight: 800,
+ letterSpacing: -0.025,
+ }}
+ >
+ Tiny Startups
+ </span>
+ <span
+ style={{
+ fontSize: 11,
+ color: "#6A6585",
+ marginTop: 4,
+ }}
+ >
+ tinystartups.com
+ </span>
+ </span>
+ </a>
+ </BadgeSlide>
+ </CarouselContent>
+ </Carousel>
+ );
+}
+
+function BadgeSlide({ children }: { children: ReactNode }) {
+ return (
+ <CarouselItem className="flex basis-auto items-center pl-3">
+ {children}
+ </CarouselItem>
);
}
diff --git a/src/components/ui/carousel.tsx b/src/components/ui/carousel.tsx
new file mode 100644
index 0000000..05d9230
--- /dev/null
+++ b/src/components/ui/carousel.tsx
@@ -0,0 +1,250 @@
+"use client";
+
+import { ArrowLeft, ArrowRight } from "lucide-react";
+import * as React from "react";
+import useEmblaCarousel, {
+ type UseEmblaCarouselType,
+} from "embla-carousel-react";
+
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+
+type CarouselApi = UseEmblaCarouselType[1];
+type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
+type CarouselOptions = UseCarouselParameters[0];
+type CarouselPlugin = UseCarouselParameters[1];
+
+type CarouselProps = {
+ opts?: CarouselOptions;
+ plugins?: CarouselPlugin;
+ orientation?: "horizontal" | "vertical";
+ setApi?: (api: CarouselApi) => void;
+};
+
+type CarouselContextProps = {
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0];
+ api: ReturnType<typeof useEmblaCarousel>[1];
+ scrollPrev: () => void;
+ scrollNext: () => void;
+ canScrollPrev: boolean;
+ canScrollNext: boolean;
+} & CarouselProps;
+
+const CarouselContext = React.createContext<CarouselContextProps | null>(null);
+
+function useCarousel() {
+ const context = React.useContext(CarouselContext);
+
+ if (!context) {
+ throw new Error("useCarousel must be used within a <Carousel />");
+ }
+
+ return context;
+}
+
+const Carousel = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement> & CarouselProps
+>(
+ (
+ {
+ orientation = "horizontal",
+ opts,
+ setApi,
+ plugins,
+ className,
+ children,
+ ...props
+ },
+ ref,
+ ) => {
+ const [carouselRef, api] = useEmblaCarousel(
+ {
+ ...opts,
+ axis: orientation === "horizontal" ? "x" : "y",
+ },
+ plugins,
+ );
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false);
+ const [canScrollNext, setCanScrollNext] = React.useState(false);
+
+ const onSelect = React.useCallback((carouselApi: CarouselApi) => {
+ if (!carouselApi) return;
+
+ setCanScrollPrev(carouselApi.canScrollPrev());
+ setCanScrollNext(carouselApi.canScrollNext());
+ }, []);
+
+ const scrollPrev = React.useCallback(() => api?.scrollPrev(), [api]);
+ const scrollNext = React.useCallback(() => api?.scrollNext(), [api]);
+
+ const handleKeyDown = React.useCallback(
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
+ if (event.key === "ArrowLeft") {
+ event.preventDefault();
+ scrollPrev();
+ } else if (event.key === "ArrowRight") {
+ event.preventDefault();
+ scrollNext();
+ }
+ },
+ [scrollPrev, scrollNext],
+ );
+
+ React.useEffect(() => {
+ if (!api || !setApi) return;
+ setApi(api);
+ }, [api, setApi]);
+
+ React.useEffect(() => {
+ if (!api) return;
+
+ onSelect(api);
+ api.on("reInit", onSelect);
+ api.on("select", onSelect);
+
+ return () => {
+ api.off("reInit", onSelect);
+ api.off("select", onSelect);
+ };
+ }, [api, onSelect]);
+
+ return (
+ <CarouselContext.Provider
+ value={{
+ carouselRef,
+ api,
+ opts,
+ orientation,
+ scrollPrev,
+ scrollNext,
+ canScrollPrev,
+ canScrollNext,
+ }}
+ >
+ <div
+ ref={ref}
+ onKeyDownCapture={handleKeyDown}
+ className={cn("relative", className)}
+ role="region"
+ aria-roledescription="carousel"
+ {...props}
+ >
+ {children}
+ </div>
+ </CarouselContext.Provider>
+ );
+ },
+);
+Carousel.displayName = "Carousel";
+
+const CarouselContent = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => {
+ const { carouselRef, orientation } = useCarousel();
+
+ return (
+ <div ref={carouselRef} className="overflow-hidden">
+ <div
+ ref={ref}
+ className={cn(
+ "flex",
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
+ className,
+ )}
+ {...props}
+ />
+ </div>
+ );
+});
+CarouselContent.displayName = "CarouselContent";
+
+const CarouselItem = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => {
+ const { orientation } = useCarousel();
+
+ return (
+ <div
+ ref={ref}
+ role="group"
+ aria-roledescription="slide"
+ className={cn(
+ "min-w-0 shrink-0 grow-0 basis-full",
+ orientation === "horizontal" ? "pl-4" : "pt-4",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+CarouselItem.displayName = "CarouselItem";
+
+const CarouselPrevious = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<typeof Button>
+>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
+
+ return (
+ <Button
+ ref={ref}
+ variant={variant}
+ size={size}
+ className={cn(
+ "absolute size-8 rounded-full",
+ orientation === "horizontal"
+ ? "-left-12 top-1/2 -translate-y-1/2"
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
+ className,
+ )}
+ disabled={!canScrollPrev}
+ onClick={scrollPrev}
+ {...props}
+ >
+ <ArrowLeft className="size-4" />
+ <span className="sr-only">Previous slide</span>
+ </Button>
+ );
+});
+CarouselPrevious.displayName = "CarouselPrevious";
+
+const CarouselNext = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<typeof Button>
+>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
+
+ return (
+ <Button
+ ref={ref}
+ variant={variant}
+ size={size}
+ className={cn(
+ "absolute size-8 rounded-full",
+ orientation === "horizontal"
+ ? "-right-12 top-1/2 -translate-y-1/2"
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
+ className,
+ )}
+ disabled={!canScrollNext}
+ onClick={scrollNext}
+ {...props}
+ >
+ <ArrowRight className="size-4" />
+ <span className="sr-only">Next slide</span>
+ </Button>
+ );
+});
+CarouselNext.displayName = "CarouselNext";
+
+export {
+ type CarouselApi,
+ Carousel,
+ CarouselContent,
+ CarouselItem,
+ CarouselPrevious,
+ CarouselNext,
+};