The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
completed Features section
Steven Tey8098be633177
diff --git a/components/home/demo.tsx b/components/home/demo.tsxnew file mode 100644index 0000000000..6055e702e9--- /dev/null+++ b/components/home/demo.tsx@@ -0,0 +1,121 @@+import { useState } from "react";+import useLocalStorage from "@/lib/hooks/use-local-storage";+import LinkCard from "@/components/home/link-card";+import PlaceholderCard from "@/components/home/placeholder-card";+import { LoadingDots } from "@/components/shared/icons";+import { motion } from "framer-motion";+import { SimpleLinkProps } from "@/lib/types";+import Tooltip, { TooltipContent } from "@/components/shared/tooltip";+import { Toaster } from "react-hot-toast";++const Demo = () => {+ const [saving, setSaving] = useState(false);+ const [url, setUrl] = useState("");+ const [hashes, setHashes] = useLocalStorage<SimpleLinkProps[]>("hashes", []);++ return (+ <div className="max-w-md mx-auto sm:px-0 px-2.5">+ <Toaster />+ <form+ onSubmit={async (e) => {+ e.preventDefault();+ setSaving(true);+ fetch(`/api/edge/links?url=${url}&hostname=dub.sh`, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ }).then(async (response) => {+ setSaving(false);+ if (response.ok) {+ const json = await response.json();+ setHashes([...hashes, json]);+ setUrl("");+ }+ });+ }}+ >+ {hashes.length >= 3 ? (+ <Tooltip+ content={+ <TooltipContent+ title="Maximum number of links reached. Swipe to delete existing links or+ create a free account."+ cta="Start For Free"+ ctaLink="https://app.dub.sh/register"+ />+ }+ >+ <div className="relative flex items-center">+ <div className="shadow-sm bg-white border focus:border-black block w-full p-2 text-sm text-gray-400 border-gray-200 rounded-md pl-3 pr-12">+ Shorten your link+ </div>+ <div className="cursor-not-allowed absolute inset-y-0 right-0 w-10 flex justify-center items-center my-1.5 mr-1.5 border border-gray-200 rounded text-sm font-sans font-medium text-gray-400">+ <p>↵</p>+ </div>+ </div>+ </Tooltip>+ ) : (+ <div className="relative flex items-center">+ <input+ type="url"+ placeholder="Shorten your link"+ value={url}+ onInput={(e) => {+ setUrl((e.target as HTMLInputElement).value);+ }}+ required+ className="peer shadow-sm focus:outline-none focus:ring-0 bg-white border focus:border-black block w-full p-2 text-sm border-gray-200 rounded-md pl-3 pr-12"+ />+ <button+ type="submit"+ disabled={saving}+ className={`${+ saving+ ? "cursor-not-allowed"+ : "hover:border-gray-700 peer-focus:border-gray-700 hover:text-gray-700 peer-focus:text-gray-700"+ } absolute inset-y-0 right-0 w-10 flex justify-center items-center my-1.5 mr-1.5 border border-gray-200 rounded text-sm font-sans font-medium text-gray-400`}+ >+ {saving ? <LoadingDots color="#e5e7eb" /> : <p>↵</p>}+ </button>+ </div>+ )}+ </form>++ <motion.ul+ key={hashes.length + 1} // workaround for https://github.com/framer/motion/issues/776, add 1 to account for the demo GH link+ initial="hidden"+ animate="show"+ variants={{+ hidden: {},+ show: {+ transition: {+ staggerChildren: 0.1,+ },+ },+ }}+ className="grid gap-2 mt-3"+ >+ <LinkCard+ key="github"+ _key="github"+ url={"https://github.com/steven-tey/dub"}+ />+ {hashes.map(({ key, url }) => (+ <LinkCard+ key={key}+ _key={key}+ url={url}+ hashes={hashes}+ setHashes={setHashes}+ />+ ))}+ {Array.from({ length: 3 - hashes.length }).map((_, i) => (+ <PlaceholderCard key={i} />+ ))}+ </motion.ul>+ </div>+ );+};++export default Demo;diff --git a/components/home/features.module.css b/components/home/features.module.cssnew file mode 100644index 0000000000..c3554fadb3--- /dev/null+++ b/components/home/features.module.css@@ -0,0 +1,39 @@+.label {+ position: relative;+ display: flex;+ align-items: center;+ padding: 1rem;+ height: 2.5rem;+ border-radius: 0.375rem;+ background-color: rgb(31 41 55);+ border: solid 1px rgb(75 85 99);+ margin-left: 0.45rem;+}++.label:after {+ content: "";+ position: absolute;+ top: 15px;+ left: -10px;+ border-style: solid;+ border-width: 7px 7px 0;+ border-color: rgb(31 41 55) transparent;+ display: block;+ width: 0;+ z-index: 1;+ transform: rotate(90deg);+}++.label:before {+ content: "";+ position: absolute;+ top: 15px;+ left: -12px;+ border-style: solid;+ border-width: 8px 8px 0;+ border-color: rgb(75 85 99) transparent;+ display: block;+ width: 0;+ z-index: 0;+ transform: rotate(90deg);+}diff --git a/components/home/features.tsx b/components/home/features.tsxnew file mode 100644index 0000000000..13dd6d634b--- /dev/null+++ b/components/home/features.tsx@@ -0,0 +1,140 @@+import Link from "next/link";+import { Github, Chart, Airplay, UploadCloud } from "@/components/shared/icons";+import MaxWidthWrapper from "@/components/shared/max-width-wrapper";+import Image from "next/future/image";+import styles from "./features.module.css";+import CountingNumbers from "../shared/counting-numbers";++const Features = ({ stars }: { stars: number }) => {+ return (+ <div className="bg-white">+ <MaxWidthWrapper className="py-20">+ <div className="max-w-sm sm:max-w-md mx-auto text-center">+ <h2 className="text-4xl sm:text-5xl leading-tight sm:leading-tight font-display font-extrabold text-black">+ Fast.{" "}+ <span className="text-transparent bg-clip-text bg-gradient-to-r from-purple-600 to-pink-600">+ Powerful.+ </span>{" "}+ Open source.+ </h2>+ <p className="text-gray-600 sm:text-lg mt-5">+ With Dub, you get the best of both worlds: a powerful link shortener+ with built-in analytics, and the freedom to host it yourself.+ </p>+ </div>++ {/* Analytics */}+ <div className="flex lg:space-x-10 flex-col-reverse lg:flex-row items-center my-20">+ <div className="flex flex-col space-y-5 my-10 lg:my-0">+ <div className="flex items-center justify-center w-20 h-20 rounded-full bg-gradient-to-r from-purple-600 to-pink-600">+ <Chart className="w-7 h-7 text-white" />+ </div>+ <h3 className="text-3xl font-bold font-display text-black mt-5">+ Built-in analytics+ </h3>++ <p className="text-gray-500 mt-3">+ Dub provides powerful analytics for your links, including+ geolocation, device, and browser information.+ </p>+ <Link+ href={{ pathname: "/", query: { key: "github" } }}+ as="/stats/github"+ shallow+ scroll={false}+ >+ <a className="rounded-full px-4 py-1.5 bg-black text-white hover:bg-white hover:text-black text-sm border border-black block max-w-fit transition-all">+ View demo+ </a>+ </Link>+ </div>++ <Image+ src="/static/landing/analytics.png"+ alt="Built-in analytics"+ width={1120}+ height={919}+ className="w-full max-w-[700px]"+ />+ </div>++ {/* Custom Domains */}+ <div className="flex lg:space-x-16 flex-col lg:flex-row items-center my-20">+ <Image+ src="/static/landing/domains.png"+ alt="Custom domains"+ width={1084}+ height={646}+ className="w-full max-w-[600px] rounded-2xl border border-gray-200"+ />+ <div className="flex flex-col space-y-5 my-10 lg:my-0">+ <div className="flex items-center justify-center w-20 h-20 rounded-full bg-gradient-to-r from-purple-600 to-pink-600">+ <Airplay className="w-7 h-7 text-white" />+ </div>+ <h3 className="text-3xl font-bold font-display text-black mt-5">+ Free custom domains+ </h3>++ <p className="text-gray-500 mt-3">+ At Dub, we believe that you should be able to use your own domain+ when building your brand. That's why we offer free custom domains+ on all plans.+ </p>+ <Link href="https://app.dub.sh">+ <a className="rounded-full px-4 py-1.5 bg-black text-white hover:bg-white hover:text-black text-sm border border-black block max-w-fit transition-all">+ Create your project+ </a>+ </Link>+ </div>+ </div>++ {/* Open source */}+ <div className="flex lg:space-x-10 flex-col-reverse lg:flex-row items-center my-20">+ <div className="flex flex-col space-y-5 my-10 lg:my-0 max-w-md">+ <div className="flex items-center justify-center w-20 h-20 rounded-full bg-gradient-to-r from-purple-600 to-pink-600">+ <UploadCloud className="w-7 h-7 text-white" />+ </div>+ <h3 className="text-3xl font-bold font-display text-black mt-5">+ Proudly open source+ </h3>++ <p className="text-gray-500 mt-3">+ Our source code is available on GitHub – feel free to read,+ review, or contribute to it however you want!+ </p>+ <a+ href="https://dub.sh/github"+ target="_blank"+ rel="noreferrer"+ className="rounded-full px-4 py-1.5 bg-black text-white hover:bg-white hover:text-black text-sm border border-black block max-w-fit transition-all"+ >+ Star on GitHub+ </a>+ </div>++ <div className="flex items-center justify-center rounded-2xl w-full max-w-[700px] bg-gray-900 h-96">+ <div className="flex items-center">+ <a+ href="https://dub.sh/github"+ target="_blank"+ rel="noreferrer"+ className="flex items-center space-x-2 p-4 h-10 rounded-md bg-gray-800 border border-gray-600"+ >+ <Github className="text-white w-5 h-5" />+ <p className="text-white font-medium">Star</p>+ </a>+ <div className={styles.label}>+ <CountingNumbers+ value={stars}+ className="text-white font-medium font-display"+ />+ </div>+ </div>+ </div>+ </div>+ </MaxWidthWrapper>+ </div>+ );+};++export default Features;diff --git a/components/home/hero.tsx b/components/home/hero.tsxnew file mode 100644index 0000000000..ed848480bd--- /dev/null+++ b/components/home/hero.tsx@@ -0,0 +1,51 @@+import Link from "next/link";+import { Github, Twitter } from "@/components/shared/icons";++const Hero = () => {+ return (+ <div className="max-w-md sm:max-w-lg mt-20 mb-10 text-center mx-auto sm:px-0 px-2.5">+ <a+ href="https://dub.sh/twitter"+ target="_blank"+ rel="noreferrer"+ className="bg-blue-100 hover:bg-blue-200 flex justify-center items-center space-x-2 max-w-fit px-7 py-2 mx-auto rounded-full overflow-hidden transition-all"+ >+ <Twitter className="w-5 h-5 text-[#1d9bf0]" />+ <p className="text-[#1d9bf0] font-semibold text-sm">+ Introducing Dub.sh+ </p>+ </a>++ <h1 className="text-5xl sm:text-6xl leading-tight sm:leading-tight font-display font-extrabold text-black mt-5">+ Open Source+ <br />+ <span className="text-transparent bg-clip-text bg-gradient-to-r from-amber-500 via-orange-600 to-yellow-500">+ Bitly Alternative+ </span>+ </h1>+ <p className="text-gray-600 text-xl sm:text-2xl mt-5">+ Dub is an open-source link shortener with built-in analytics and free+ custom domains.+ </p>++ <div className="mt-10 flex space-x-4 max-w-fit mx-auto">+ <Link href="https://app.dub.sh/register">+ <a className="py-2 px-5 bg-black hover:bg-white rounded-full border border-black text-sm text-white hover:text-black transition-all">+ Start For Free+ </a>+ </Link>+ <a+ className="flex justify-center items-center space-x-2 py-2 px-5 bg-white rounded-full border border-gray-300 hover:border-gray-800 transition-all"+ href="https://dub.sh/github"+ target="_blank"+ rel="noreferrer"+ >+ <Github className="w-5 h-5 text-black" />+ <p className="text-sm">Star on GitHub</p>+ </a>+ </div>+ </div>+ );+};++export default Hero;diff --git a/components/home/pricing.tsx b/components/home/pricing.tsxnew file mode 100644index 0000000000..861d621445--- /dev/null+++ b/components/home/pricing.tsx@@ -0,0 +1,131 @@+import Link from "next/link";+import { CheckCircleFill } from "@/components/shared/icons";+import MaxWidthWrapper from "@/components/shared/max-width-wrapper";+import CountingNumbers from "@/components/shared/counting-numbers";++const pricingItems = [+ {+ plan: "Free",+ tagline: "For startups & side projects",+ price: 0,+ features: [+ "Free custom domains",+ "Unlimited links",+ "Up to 1K link clicks/month",+ ],+ cta: "Start for free",+ ctaLink: "https://app.dub.sh/register",+ },+ {+ plan: "Pro",+ tagline: "For larger teams with increased usage",+ isPopular: true,+ price: 99,+ features: [+ "Free custom domains",+ "Unlimited links",+ "Up to 1M link clicks/month",+ ],+ cta: "Get started",+ ctaLink: "https://app.dub.sh/register",+ },+ {+ plan: "Enterprise",+ tagline: "For businesses with custom needs",+ price: "Custom",+ features: [+ "Free custom domains",+ "Unlimited links",+ "Unlimited link clicks",+ ],+ cta: "Contact us",+ ctaLink: "mailto:[email protected]?subject=Interested%20in%20Dub%20Enterprise",+ },+];++const Pricing = () => {+ return (+ <MaxWidthWrapper className="my-20 text-center">+ <div className="max-w-sm sm:max-w-md mx-auto my-10">+ <h2 className="text-4xl sm:text-5xl font-display font-extrabold text-black">+ Simple,{" "}+ <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-cyan-600">+ affordable+ </span>{" "}+ pricing+ </h2>+ <p className="text-gray-600 sm:text-lg mt-5">+ Start for free, no credit card required. Upgrade anytime.+ </p>+ </div>+ <div className="grid grid-cols-1 lg:grid-cols-3 gap-10">+ {pricingItems.map(+ ({ plan, tagline, isPopular, price, features, cta, ctaLink }) => (+ <div+ key={plan}+ className={`relative bg-white rounded-2xl ${+ isPopular+ ? "border-2 border-blue-600 shadow-blue-200"+ : "border border-gray-200"+ } shadow-md`}+ >+ {isPopular && (+ <div className="absolute -top-5 left-0 right-0 mx-auto bg-gradient-to-r from-blue-600 to-cyan-600 text-white text-sm font-medium w-32 px-3 py-2 rounded-full">+ Popular+ </div>+ )}+ <div className="p-5">+ <h3 className="text-center text-3xl font-bold font-display my-3">+ {plan}+ </h3>+ <p className="text-gray-500">{tagline}</p>+ {typeof price === "number" ? (+ <div className="my-5 flex justify-center">+ <p className="text-6xl font-display font-semibold">$</p>+ <CountingNumbers+ value={price}+ reverse={true}+ className="text-6xl font-display font-semibold"+ />+ </div>+ ) : (+ <p className="my-5 text-6xl font-display font-semibold">+ {price}+ </p>+ )}+ <p className="text-gray-500">Monthly</p>+ </div>+ <div className="border-t border-gray-200" />+ <ul className="px-10 my-10 space-y-5">+ {features.map((feature) => (+ <li key={feature} className="flex space-x-5">+ <div className="flex-shrink-0">+ <CheckCircleFill className="w-6 h-6 text-green-500" />+ </div>+ <p className="text-gray-600">{feature}</p>+ </li>+ ))}+ </ul>+ <div className="border-t border-gray-200" />+ <div className="p-5">+ <Link href={ctaLink}>+ <a+ className={`${+ isPopular+ ? "bg-gradient-to-r from-blue-600 to-cyan-600 hover:bg-white text-white hover:text-transparent hover:bg-clip-text border border-transparent hover:border-blue-700"+ : "bg-black text-white hover:bg-white hover:text-black border border-gray-200 hover:border-black"+ } block w-full py-2 rounded-full font-medium transition-all`}+ >+ {cta}+ </a>+ </Link>+ </div>+ </div>+ )+ )}+ </div>+ </MaxWidthWrapper>+ );+};++export default Pricing;diff --git a/components/shared/counting-numbers.tsx b/components/shared/counting-numbers.tsxindex 62c6d84185..fa6c494713 100644--- a/components/shared/counting-numbers.tsx+++ b/components/shared/counting-numbers.tsx@@ -4,35 +4,52 @@ import { useEffect, useRef, useState } from "react";export default function CountingNumbers({value,className,- start = 1000,+ reverse = false,+ start = reverse ? 1000 : 0,interval = 10,duration = 800,}: {value: number;className: string;+ reverse?: boolean;start?: number;interval?: number;duration?: number;}) {const [number, setNumber] = useState(start);- const increment = Math.floor((start - value) / (duration / interval));+ const increment = Math.floor(Math.abs(start - value) / (duration / interval));const ref = useRef(null);const isInView = useInView(ref);useEffect(() => {if (isInView) {let timer = setInterval(() => {- if (number > value) {- setNumber((num) => {- let newValue = num - increment;- if (newValue < value) {- newValue = value;- if (timer) clearInterval(timer);- }- return newValue;- });- } else if (timer) {- clearInterval(timer);+ if (reverse) {+ if (number > value) {+ setNumber((num) => {+ let newValue = num - increment;+ if (newValue < value) {+ newValue = value;+ if (timer) clearInterval(timer);+ }+ return newValue;+ });+ } else if (timer) {+ clearInterval(timer);+ }+ } else {+ if (number < value) {+ setNumber((num) => {+ let newValue = num + increment;+ if (newValue > value) {+ newValue = value;+ if (timer) clearInterval(timer);+ }+ return newValue;+ });+ } else if (timer) {+ clearInterval(timer);+ }}}, interval);}@@ -40,7 +57,7 @@ export default function CountingNumbers({return (<p className={className} ref={ref}>- {number}+ {Intl.NumberFormat().format(number)}</p>);}diff --git a/components/shared/icons/airplay.tsx b/components/shared/icons/airplay.tsxnew file mode 100644index 0000000000..46c85de313--- /dev/null+++ b/components/shared/icons/airplay.tsx@@ -0,0 +1,19 @@+export default function Airplay({ className }: { className: string }) {+ return (+ <svg+ fill="none"+ shapeRendering="geometricPrecision"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ viewBox="0 0 24 24"+ width="24"+ height="24"+ className={className}+ >+ <path d="M5 17H4a2 2 0 01-2-2V5a2 2 0 012-2h16a2 2 0 012 2v10a2 2 0 01-2 2h-1" />+ <path d="M12 15l5 6H7l5-6z" />+ </svg>+ );+}diff --git a/components/shared/icons/index.tsx b/components/shared/icons/index.tsxindex ccf61b70a1..cd50d430e1 100644--- a/components/shared/icons/index.tsx+++ b/components/shared/icons/index.tsx@@ -22,3 +22,5 @@ export { default as PlusCircle } from "./plus-circle";export { default as Link } from "./link";export { default as Infinity } from "./infinity";export { default as Drag } from "./drag";+export { default as Airplay } from "./airplay";+export { default as UploadCloud } from "./upload-cloud";diff --git a/components/shared/icons/upload-cloud.tsx b/components/shared/icons/upload-cloud.tsxnew file mode 100644index 0000000000..d5ea4198c8--- /dev/null+++ b/components/shared/icons/upload-cloud.tsx@@ -0,0 +1,21 @@+export default function UploadCloud({ className }: { className: string }) {+ return (+ <svg+ fill="none"+ shapeRendering="geometricPrecision"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ viewBox="0 0 24 24"+ width="24"+ height="24"+ className={className}+ >+ <path d="M16 16l-4-4-4 4" />+ <path d="M12 12v9" />+ <path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3" />+ <path d="M16 16l-4-4-4 4" />+ </svg>+ );+}diff --git a/pages/index.tsx b/pages/index.tsxindex e70c7b410b..8d1705472b 100644--- a/pages/index.tsx+++ b/pages/index.tsx@@ -1,28 +1,15 @@import HomeLayout from "@/components/layout/home";-import { useCallback, useEffect, useState } from "react";-import Link from "next/link";+import { useCallback, useEffect } from "react";import { useRouter } from "next/router";-import useLocalStorage from "@/lib/hooks/use-local-storage";import { useStatsModal } from "@/components/stats/stats-modal";-import LinkCard from "@/components/home/link-card";-import PlaceholderCard from "@/components/home/placeholder-card";-import {- Github,- LoadingDots,- Twitter,- CheckCircleFill,- Chart,-} from "@/components/shared/icons";-import { motion } from "framer-motion";-import { SimpleLinkProps } from "@/lib/types";import MaxWidthWrapper from "@/components/shared/max-width-wrapper";+import Hero from "@/components/home/hero";+import Demo from "@/components/home/demo";import Globe from "@/components/home/globe";-import Tooltip, { TooltipContent } from "@/components/shared/tooltip";-import { Toaster } from "react-hot-toast";-import CountingNumbers from "@/components/shared/counting-numbers";-import Image from "next/future/image";+import Features from "@/components/home/features";+import Pricing from "@/components/home/pricing";-export default function Home() {+export default function Home({ stars }: { stars: number }) {const router = useRouter();const { key: stats } = router.query;const { setShowStatsModal, StatsModal } = useStatsModal();@@ -52,413 +39,13 @@ export default function Home() {<Hero /><Demo /><Globe />- <Features />+ <Features stars={stars} /><Pricing /><Footer /></HomeLayout>);}-const Hero = () => {- return (- <div className="max-w-md sm:max-w-lg mt-20 mb-10 text-center mx-auto sm:px-0 px-2.5">- <a- href="https://dub.sh/twitter"- target="_blank"- rel="noreferrer"- className="bg-blue-100 hover:bg-blue-200 flex justify-center items-center space-x-2 max-w-fit px-7 py-2 mx-auto rounded-full overflow-hidden transition-all"- >- <Twitter className="w-5 h-5 text-[#1d9bf0]" />- <p className="text-[#1d9bf0] font-semibold text-sm">- Announcing Dub.sh- </p>- </a>-- <h1 className="text-5xl sm:text-6xl leading-tight sm:leading-tight font-display font-extrabold text-black mt-5">- Open Source- <br />- <span className="text-transparent bg-clip-text bg-gradient-to-r from-amber-500 via-orange-600 to-yellow-500">- Bitly Alternative- </span>- </h1>- <p className="text-gray-600 text-xl sm:text-2xl mt-5">- Dub is an open-source link shortener with built-in analytics and free- custom domains.- </p>-- <div className="mt-10 flex space-x-4 max-w-fit mx-auto">- <Link href="https://app.dub.sh/register">- <a className="py-2 px-5 bg-black hover:bg-white rounded-full border border-black text-sm text-white hover:text-black transition-all">- Start For Free- </a>- </Link>- <a- className="flex justify-center items-center space-x-2 py-2 px-5 bg-white rounded-full border border-gray-300 hover:border-gray-800 transition-all"- href="https://dub.sh/github"- target="_blank"- rel="noreferrer"- >- <Github className="w-5 h-5 text-black" />- <p className="text-sm">Star on GitHub</p>- </a>- </div>- </div>- );-};--const Demo = () => {- const [saving, setSaving] = useState(false);- const [url, setUrl] = useState("");- const [hashes, setHashes] = useLocalStorage<SimpleLinkProps[]>("hashes", []);-- return (- <div className="max-w-md mx-auto sm:px-0 px-2.5">- <Toaster />- <form- onSubmit={async (e) => {- e.preventDefault();- setSaving(true);- fetch(`/api/edge/links?url=${url}&hostname=dub.sh`, {- method: "POST",- headers: {- "Content-Type": "application/json",- },- }).then(async (response) => {- setSaving(false);- if (response.ok) {- const json = await response.json();- setHashes([...hashes, json]);- setUrl("");- }- });- }}- >- {hashes.length >= 3 ? (- <Tooltip- content={- <TooltipContent- title="Maximum number of links reached. Swipe to delete existing links or- create a free account."- cta="Start For Free"- ctaLink="https://app.dub.sh/register"- />- }- >- <div className="relative flex items-center">- <div className="shadow-sm bg-white border focus:border-black block w-full p-2 text-sm text-gray-400 border-gray-200 rounded-md pl-3 pr-12">- Shorten your link- </div>- <div className="cursor-not-allowed absolute inset-y-0 right-0 w-10 flex justify-center items-center my-1.5 mr-1.5 border border-gray-200 rounded text-sm font-sans font-medium text-gray-400">- <p>↵</p>- </div>- </div>- </Tooltip>- ) : (- <div className="relative flex items-center">- <input- type="url"- placeholder="Shorten your link"- value={url}- onInput={(e) => {- setUrl((e.target as HTMLInputElement).value);- }}- required- className="peer shadow-sm focus:outline-none focus:ring-0 bg-white border focus:border-black block w-full p-2 text-sm border-gray-200 rounded-md pl-3 pr-12"- />- <button- type="submit"- disabled={saving}- className={`${- saving- ? "cursor-not-allowed"- : "hover:border-gray-700 peer-focus:border-gray-700 hover:text-gray-700 peer-focus:text-gray-700"- } absolute inset-y-0 right-0 w-10 flex justify-center items-center my-1.5 mr-1.5 border border-gray-200 rounded text-sm font-sans font-medium text-gray-400`}- >- {saving ? <LoadingDots color="#e5e7eb" /> : <p>↵</p>}- </button>- </div>- )}- </form>-- <motion.ul- key={hashes.length + 1} // workaround for https://github.com/framer/motion/issues/776, add 1 to account for the demo GH link- initial="hidden"- animate="show"- variants={{- hidden: {},- show: {- transition: {- staggerChildren: 0.1,- },- },- }}- className="grid gap-2 mt-3"- >- <LinkCard- key="github"- _key="github"- url={"https://github.com/steven-tey/dub"}- />- {hashes.map(({ key, url }) => (- <LinkCard- key={key}- _key={key}- url={url}- hashes={hashes}- setHashes={setHashes}- />- ))}- {Array.from({ length: 3 - hashes.length }).map((_, i) => (- <PlaceholderCard key={i} />- ))}- </motion.ul>- </div>- );-};--const Features = () => {- return (- <div className="bg-white">- <MaxWidthWrapper className="py-20">- <div className="max-w-sm sm:max-w-md mx-auto text-center">- <h2 className="text-4xl sm:text-5xl leading-tight sm:leading-tight font-display font-extrabold text-black">- Fast.{" "}- <span className="text-transparent bg-clip-text bg-gradient-to-r from-purple-600 to-pink-600">- Powerful.- </span>{" "}- Open source.- </h2>- <p className="text-gray-600 sm:text-lg mt-5">- With Dub, you get the best of both worlds: a powerful link shortener- with built-in analytics, and the freedom to host it yourself.- </p>- </div>-- {/* Analytics */}- <div className="flex lg:space-x-10 flex-col-reverse lg:flex-row items-center my-20">- <div className="flex flex-col space-y-5 my-10 lg:my-0">- <div className="flex items-center justify-center w-20 h-20 rounded-full bg-gradient-to-r from-purple-600 to-pink-600">- <Chart className="w-7 h-7 text-white" />- </div>- <h3 className="text-3xl font-bold font-display text-black mt-5">- Built-in analytics- </h3>-- <p className="text-gray-500 mt-3">- Dub provides powerful analytics for your links, including- geolocation, device, and browser information.- </p>- <Link- href={{ pathname: "/", query: { key: "github" } }}- as="/stats/github"- shallow- scroll={false}- >- <a className="rounded-full px-4 py-1.5 bg-black text-white hover:bg-white hover:text-black text-sm border border-black block max-w-fit transition-all">- View demo- </a>- </Link>- </div>-- <Image- src="/static/landing/analytics.png"- alt="Built-in analytics"- width={1120}- height={919}- className="w-full max-w-[700px]"- />- </div>-- {/* Custom Domains */}- <div className="flex lg:space-x-16 flex-col lg:flex-row items-center my-20">- <Image- src="/static/landing/domains.png"- alt="Custom domains"- width={1084}- height={646}- className="w-full max-w-[600px] rounded-2xl border border-gray-200"- />- <div className="flex flex-col space-y-5 my-10 lg:my-0">- <div className="flex items-center justify-center w-20 h-20 rounded-full bg-gradient-to-r from-purple-600 to-pink-600">- <Chart className="w-7 h-7 text-white" />- </div>- <h3 className="text-3xl font-bold font-display text-black mt-5">- Free custom domains- </h3>-- <p className="text-gray-500 mt-3">- At Dub, we believe that you should be able to use your own domain- when building your brand. That's why we offer free custom domains- on all plans.- </p>- <Link href="https://app.dub.sh">- <a className="rounded-full px-4 py-1.5 bg-black text-white hover:bg-white hover:text-black text-sm border border-black block max-w-fit transition-all">- Create your project- </a>- </Link>- </div>- </div>-- {/* Open source */}- <div className="flex lg:space-x-10 flex-col-reverse lg:flex-row items-center my-20">- <div className="flex flex-col space-y-5 my-10 lg:my-0 max-w-md">- <div className="flex items-center justify-center w-20 h-20 rounded-full bg-gradient-to-r from-purple-600 to-pink-600">- <Chart className="w-7 h-7 text-white" />- </div>- <h3 className="text-3xl font-bold font-display text-black mt-5">- Proudly open source- </h3>-- <p className="text-gray-500 mt-3">- Our source code is available on GitHub – feel free to read,- review, or contribute to it however you want!- </p>- <a- href="https://dub.sh/github"- target="_blank"- rel="noreferrer"- className="rounded-full px-4 py-1.5 bg-black text-white hover:bg-white hover:text-black text-sm border border-black block max-w-fit transition-all"- >- Star on GitHub- </a>- </div>-- <div className="flex items-center justify-center rounded-2xl w-full max-w-[700px] bg-gray-900 h-96">- <div className="flex items-center space-x-2 p-4 h-10 rounded-md bg-gray-800 border border-gray-600">- <Github className="text-white w-5 h-5" />- <p className="text-white font-medium">Star</p>- </div>- </div>- </div>- </MaxWidthWrapper>- </div>- );-};--const pricingItems = [- {- plan: "Free",- tagline: "For startups & side projects",- price: 0,- features: [- "Free custom domains",- "Unlimited links",- "Up to 1K link clicks/month",- ],- cta: "Start for free",- ctaLink: "https://app.dub.sh/register",- },- {- plan: "Pro",- tagline: "For larger teams with increased usage",- isPopular: true,- price: 99,- features: [- "Free custom domains",- "Unlimited links",- "Up to 1M link clicks/month",- ],- cta: "Get started",- ctaLink: "https://app.dub.sh/register",- },- {- plan: "Enterprise",- tagline: "For businesses with custom needs",- price: "Custom",- features: [- "Free custom domains",- "Unlimited links",- "Unlimited link clicks",- ],- cta: "Contact us",- ctaLink: "mailto:[email protected]?subject=Interested%20in%20Dub%20Enterprise",- },-];--const Pricing = () => {- return (- <MaxWidthWrapper className="my-20 text-center">- <div className="max-w-sm sm:max-w-md mx-auto my-10">- <h2 className="text-4xl sm:text-5xl font-display font-extrabold text-black">- Simple,{" "}- <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-cyan-600">- affordable- </span>{" "}- pricing- </h2>- <p className="text-gray-600 sm:text-lg mt-5">- Start for free, no credit card required. Upgrade anytime.- </p>- </div>- <div className="grid grid-cols-1 lg:grid-cols-3 gap-10">- {pricingItems.map(- ({ plan, tagline, isPopular, price, features, cta, ctaLink }) => (- <div- key={plan}- className={`relative bg-white rounded-2xl ${- isPopular- ? "border-2 border-blue-600 shadow-blue-200"- : "border border-gray-200"- } shadow-md`}- >- {isPopular && (- <div className="absolute -top-5 left-0 right-0 mx-auto bg-gradient-to-r from-blue-600 to-cyan-600 text-white text-sm font-medium w-32 px-3 py-2 rounded-full">- Popular- </div>- )}- <div className="p-5">- <h3 className="text-center text-3xl font-bold font-display my-3">- {plan}- </h3>- <p className="text-gray-500">{tagline}</p>- {typeof price === "number" ? (- <div className="my-5 flex justify-center">- <p className="text-6xl font-display font-semibold">$</p>- <CountingNumbers- value={price}- className="text-6xl font-display font-semibold"- />- </div>- ) : (- <p className="my-5 text-6xl font-display font-semibold">- {price}- </p>- )}- <p className="text-gray-500">Monthly</p>- </div>- <div className="border-t border-gray-200" />- <ul className="px-10 my-10 space-y-5">- {features.map((feature) => (- <li key={feature} className="flex space-x-5">- <div className="flex-shrink-0">- <CheckCircleFill className="w-6 h-6 text-green-500" />- </div>- <p className="text-gray-600">{feature}</p>- </li>- ))}- </ul>- <div className="border-t border-gray-200" />- <div className="p-5">- <Link href={ctaLink}>- <a- className={`${- isPopular- ? "bg-gradient-to-r from-blue-600 to-cyan-600 hover:bg-white text-white hover:text-transparent hover:bg-clip-text border border-transparent hover:border-blue-700"- : "bg-black text-white hover:bg-white hover:text-black border border-gray-200 hover:border-black"- } block w-full py-2 rounded-full font-medium transition-all`}- >- {cta}- </a>- </Link>- </div>- </div>- )- )}- </div>- </MaxWidthWrapper>- );-};-const Footer = () => {return (<div className="border-t border-gray-200 h-20">@@ -466,3 +53,16 @@ const Footer = () => {</div>);};++export async function getStaticProps() {+ const { stargazers_count: stars } = await fetch(+ "https://api.github.com/repos/steven-tey/dub"+ ).then((res) => res.json());++ return {+ props: {+ stars: stars || 420,+ },+ revalidate: 10,+ };+}