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.

Update embed UI

Tim Wilsonee33510bdae8
diff --git a/apps/web/app/app.dub.co/embed/inline/hero-background.tsx b/apps/web/app/app.dub.co/embed/inline/hero-background.tsx
index 6dd53cd59d..a1712cb33e 100644
--- a/apps/web/app/app.dub.co/embed/inline/hero-background.tsx
+++ b/apps/web/app/app.dub.co/embed/inline/hero-background.tsx
@@ -1,7 +1,8 @@
"use client";
import { BlurImage } from "@dub/ui";
-import { useId } from "react";
+import { cn } from "@dub/utils";
+import { CSSProperties, useId } from "react";
export function HeroBackground({
logo,
@@ -12,20 +13,22 @@ export function HeroBackground({
}) {
const id = useId();
- const backgroundColor = color || "#737373";
-
return (
- <div className="absolute inset-0 -z-[1]" style={{ color: backgroundColor }}>
- <div className="absolute inset-0 -z-[1] bg-current opacity-10" />
-
- <div className="absolute right-4 top-4 block size-6 min-[300px]:size-10 md:hidden">
- {logo && (
- <BlurImage
- src={logo}
- alt="Program Logo"
- fill
- className="absolute object-cover object-center"
- />
+ <div
+ className="absolute inset-0 isolate -z-[1] overflow-hidden bg-neutral-50 [container-type:size]"
+ style={
+ {
+ color: color || "#737373",
+ "--brand": color || "#737373",
+ "--brand-dark": "oklch(from var(--brand) 0.38 min(c, 0.17) h)",
+ } as CSSProperties
+ }
+ >
+ <div className="absolute inset-0 [mask-image:linear-gradient(90deg,transparent_40%,black)]">
+ {color ? (
+ <div className="absolute inset-0 bg-current opacity-10" />
+ ) : (
+ <RainbowGradient className="opacity-15" />
)}
</div>
@@ -35,7 +38,7 @@ export function HeroBackground({
height="258"
fill="none"
viewBox="0 0 718 258"
- className="absolute right-0 top-0 hidden h-full w-auto md:block"
+ className="pointer-events-none absolute right-0 top-0 hidden h-full w-auto md:block"
>
<mask
id={`${id}-grid-mask`}
@@ -55,16 +58,6 @@ export function HeroBackground({
height="100%"
/>
<g clipPath={`url(#${id}-a)`}>
- <g filter={`url(#${id}-b)`} opacity="0.1">
- <circle
- cx="450"
- cy="450"
- r="450"
- fill="currentColor"
- opacity="0.5"
- transform="matrix(-1 0 0 1 1228 -445)"
- />
- </g>
<g filter={`url(#${id}-d)`}>
<path
fill={`url(#${id}-e)`}
@@ -77,16 +70,6 @@ export function HeroBackground({
strokeWidth="0.75"
d="M478 65c0-8.837 7.163-16 16-16h128c8.837 0 16 7.163 16 16v128c0 8.837-7.163 16-16 16H494c-8.837 0-16-7.163-16-16z"
/>
- <g filter={`url(#${id}-f)`}>
- <rect
- width="80"
- height="80"
- x="518"
- y="87"
- fill={`url(#${id}-logo)`}
- rx="40"
- />
- </g>
<mask
id={`${id}-h`}
width="319"
@@ -162,26 +145,6 @@ export function HeroBackground({
</g>
</g>
<defs>
- <filter
- id={`${id}-b`}
- width="1140"
- height="1140"
- x="208"
- y="-565"
- colorInterpolationFilters="sRGB"
- filterUnits="userSpaceOnUse"
- >
- <feFlood floodOpacity="0" result="BackgroundImageFix" />
- <feBlend
- in="SourceGraphic"
- in2="BackgroundImageFix"
- result="shape"
- />
- <feGaussianBlur
- result="effect1_foregroundBlur_21_5513"
- stdDeviation="60"
- />
- </filter>
<filter
id={`${id}-d`}
width="160.75"
@@ -208,34 +171,6 @@ export function HeroBackground({
<feColorMatrix values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0" />
<feBlend in2="shape" result="effect1_innerShadow_21_5513" />
</filter>
- <filter
- id={`${id}-f`}
- width="100"
- height="100"
- x="508"
- y="77"
- colorInterpolationFilters="sRGB"
- filterUnits="userSpaceOnUse"
- >
- <feFlood floodOpacity="0" result="BackgroundImageFix" />
- <feColorMatrix
- in="SourceAlpha"
- result="hardAlpha"
- values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
- />
- <feOffset />
- <feGaussianBlur stdDeviation="5" />
- <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0" />
- <feBlend
- in2="BackgroundImageFix"
- result="effect1_dropShadow_21_5513"
- />
- <feBlend
- in="SourceGraphic"
- in2="effect1_dropShadow_21_5513"
- result="shape"
- />
- </filter>
<filter
id={`${id}-i`}
width="40.75"
@@ -355,22 +290,44 @@ export function HeroBackground({
strokeWidth={1}
/>
</pattern>
- <pattern
- id={`${id}-logo`}
- patternContentUnits="objectBoundingBox"
- width="1"
- height="1"
- >
- <use xlinkHref={`#${id}-logo-image`} transform="scale(0.0025)" />
- </pattern>
- <image
- id={`${id}-logo-image`}
- width="400"
- height="400"
- xlinkHref={logo || ""}
- />
</defs>
</svg>
+
+ <div className="absolute inset-0 mix-blend-soft-light [mask-image:linear-gradient(90deg,transparent_40%,black)]">
+ {color ? (
+ <div className="absolute inset-0 bg-current" />
+ ) : (
+ <RainbowGradient />
+ )}
+ </div>
+
+ <div
+ className={cn(
+ "absolute right-4 top-4 block size-6 min-[300px]:size-8",
+
+ // Position based on cqh to adjust for container height
+ "md:right-[62cqh] md:top-1/2 md:size-[32cqh] md:-translate-y-1/2 md:translate-x-1/2",
+
+ "drop-shadow-[0_0_15px_rgb(from_var(--brand-dark,#000)_r_g_b/0.4)]",
+ )}
+ >
+ {logo && (
+ <BlurImage
+ src={logo}
+ alt="Program Logo"
+ fill
+ className="absolute object-cover object-center"
+ />
+ )}
+ </div>
+ </div>
+ );
+}
+
+function RainbowGradient({ className }: { className?: string }) {
+ return (
+ <div className={cn("absolute inset-0 saturate-[1.5]", className)}>
+ <div className="absolute right-[62cqh] top-1/2 aspect-square h-[200%] -translate-y-1/2 translate-x-1/2 rounded-full bg-[conic-gradient(from_-66deg_at_50%_50%,#855AFC_-32deg,#f00_63deg,#EAB308_158deg,#5CFF80_240deg,#855AFC_328deg,#f00_423deg)] blur-[50px]" />
</div>
);
}
diff --git a/apps/web/app/app.dub.co/embed/inline/loading.tsx b/apps/web/app/app.dub.co/embed/inline/loading.tsx
index 8f104c89d6..58ca3ab031 100644
--- a/apps/web/app/app.dub.co/embed/inline/loading.tsx
+++ b/apps/web/app/app.dub.co/embed/inline/loading.tsx
@@ -1,4 +1,4 @@
-import { Button, Copy, MoneyBill2, Wordmark } from "@dub/ui";
+import { Button, Copy, MoneyBill, Wordmark } from "@dub/ui";
import { HeroBackground } from "./hero-background";
export default function EmbedInlineLoading() {
@@ -9,7 +9,7 @@ export default function EmbedInlineLoading() {
<div className="relative flex flex-col overflow-hidden rounded-lg border border-neutral-300 p-4 md:p-6">
<HeroBackground />
<span className="flex items-center gap-2 text-sm text-neutral-500">
- <MoneyBill2 className="size-4" />
+ <MoneyBill className="size-4" />
Refer and earn
</span>
<div className="relative mt-16 flex flex-col gap-2">
diff --git a/apps/web/app/app.dub.co/embed/inline/page-client.tsx b/apps/web/app/app.dub.co/embed/inline/page-client.tsx
index 7b48265503..cec06334bf 100644
--- a/apps/web/app/app.dub.co/embed/inline/page-client.tsx
+++ b/apps/web/app/app.dub.co/embed/inline/page-client.tsx
@@ -7,7 +7,7 @@ import {
Button,
Check,
Copy,
- MoneyBill2,
+ MoneyBill,
ToggleGroup,
useCopyToClipboard,
Wordmark,
@@ -60,7 +60,7 @@ export function EmbedInlinePageClient({
<div className="relative flex flex-col overflow-hidden rounded-lg border border-neutral-300 p-4 md:p-6">
<HeroBackground logo={program.logo} color={program.brandColor} />
<span className="flex items-center gap-2 text-sm text-neutral-500">
- <MoneyBill2 className="size-4" />
+ <MoneyBill className="size-4" />
Refer and earn
</span>
<div className="relative mt-16 text-lg text-neutral-900 sm:max-w-[50%]">
@@ -105,14 +105,18 @@ export function EmbedInlinePageClient({
onClick={() => copyToClipboard(links[0].shortLink)}
/>
</div>
- <a
- href="https://dub.partners"
- target="_blank"
- className="mt-4 flex items-center justify-center gap-1.5 text-neutral-500 transition-colors duration-75 hover:text-neutral-700 md:absolute md:bottom-3 md:right-3 md:mt-0 md:translate-x-0"
- >
- <p className="text-xs font-medium">Powered by</p>
- <Wordmark className="h-3.5 text-neutral-900" />
- </a>
+ <div className="mt-4 flex justify-center md:absolute md:bottom-3 md:right-3 md:mt-0">
+ <a
+ href="https://dub.partners"
+ target="_blank"
+ className="flex w-fit items-center gap-1.5 rounded-md border border-black/10 bg-white px-2 py-1 text-neutral-500 transition-colors duration-75 hover:text-neutral-700"
+ >
+ <p className="whitespace-nowrap text-xs font-medium leading-none">
+ Powered by
+ </p>
+ <Wordmark className="h-3.5 text-neutral-900" />
+ </a>
+ </div>
</div>
<div className="mt-4 grid gap-2 sm:h-32 sm:grid-cols-3">
<EmbedActivity
diff --git a/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/page-client.tsx b/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/page-client.tsx
index 2855ef40b9..341f2fed02 100644
--- a/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/page-client.tsx
+++ b/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/page-client.tsx
@@ -22,7 +22,7 @@ import {
XAxis,
YAxis,
} from "@dub/ui/charts";
-import { Check, Copy, LoadingSpinner, MoneyBill2 } from "@dub/ui/icons";
+import { Check, Copy, LoadingSpinner, MoneyBill } from "@dub/ui/icons";
import { cn, currencyFormatter, getPrettyUrl } from "@dub/utils";
import NumberFlow, { NumberFlowGroup } from "@number-flow/react";
import { LinearGradient } from "@visx/gradient";
@@ -65,7 +65,7 @@ export default function ProgramPageClient() {
<HeroBackground logo={program.logo} color={program.brandColor} />
)}
<span className="flex items-center gap-2 text-sm text-neutral-500">
- <MoneyBill2 className="size-4" />
+ <MoneyBill className="size-4" />
Refer and earn
</span>
<div className="relative mt-24 text-lg text-neutral-900 sm:max-w-[50%]">
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 67a08aa061..06f455362a 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -116,6 +116,7 @@ export * from "./map-position";
export * from "./menu3";
export * from "./message-smile";
export * from "./mobile-phone";
+export * from "./money-bill";
export * from "./money-bill2";
export * from "./money-bills2";
export * from "./note";
diff --git a/packages/ui/src/icons/nucleo/money-bill.tsx b/packages/ui/src/icons/nucleo/money-bill.tsx
new file mode 100644
index 0000000000..ef5dcd95c1
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/money-bill.tsx
@@ -0,0 +1,41 @@
+import { SVGProps } from "react";
+
+export function MoneyBill(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <circle
+ cx="9"
+ cy="9"
+ fill="none"
+ r="2"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <circle cx="4.25" cy="9" fill="currentColor" r=".75" stroke="none" />
+ <circle cx="13.75" cy="9" fill="currentColor" r=".75" stroke="none" />
+ <rect
+ height="10.5"
+ width="14.5"
+ fill="none"
+ rx="2"
+ ry="2"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x="1.75"
+ y="3.75"
+ />
+ </g>
+ </svg>
+ );
+}