Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: Add accent color support to email verification and OTP inputs
Cursor Agent9ba398186930
diff --git a/components/ui/input-otp.tsx b/components/ui/input-otp.tsxindex 2cd1a6d5..d242258e 100644--- a/components/ui/input-otp.tsx+++ b/components/ui/input-otp.tsx@@ -4,11 +4,14 @@ import { OTPInput, OTPInputContext } from "input-otp";import { Dot } from "lucide-react";import { cn } from "@/lib/utils";+import { determineTextColor } from "@/lib/utils/determine-text-color";const InputOTP = React.forwardRef<React.ElementRef<typeof OTPInput>,- React.ComponentPropsWithoutRef<typeof OTPInput>->(({ className, containerClassName, ...props }, ref) => (+ React.ComponentPropsWithoutRef<typeof OTPInput> & {+ accentColor?: string | null;+ }+>(({ className, containerClassName, accentColor, ...props }, ref) => (<OTPInputref={ref}data-1p-ignore@@ -18,6 +21,7 @@ const InputOTP = React.forwardRef<containerClassName,)}className={cn("disabled:cursor-not-allowed", className)}+ context={{ accentColor }}{...props}/>));@@ -37,21 +41,31 @@ const InputOTPSlot = React.forwardRef<>(({ index, className, ...props }, ref) => {const inputOTPContext = React.useContext(OTPInputContext);const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];+ const accentColor = (inputOTPContext as any)?.accentColor;+ const textColor = determineTextColor(accentColor);return (<divref={ref}className={cn(- "relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm text-white transition-all first:rounded-l-md first:border-l last:rounded-r-md",- isActive && "z-10 text-white ring-2 ring-ring ring-offset-white",+ "relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",+ isActive && "z-10 ring-2 ring-ring",className,)}+ style={{+ color: textColor,+ borderColor: textColor,+ ringOffsetColor: accentColor || "white",+ }}{...props}>{char}{hasFakeCaret && (<div className="pointer-events-none absolute inset-0 flex items-center justify-center">- <div className="h-4 w-px animate-caret-blink bg-white duration-1000" />+ <div+ className="h-4 w-px animate-caret-blink duration-1000"+ style={{ backgroundColor: textColor }}+ /></div>)}</div>diff --git a/components/view/access-form/email-verification-form.tsx b/components/view/access-form/email-verification-form.tsxindex 77b7d053..a9aa5948 100644--- a/components/view/access-form/email-verification-form.tsx+++ b/components/view/access-form/email-verification-form.tsx@@ -1,5 +1,8 @@import { useEffect, useState } from "react";+import { Brand, DataroomBrand } from "@prisma/client";++import { determineTextColor } from "@/lib/utils/determine-text-color";import { useMediaQuery } from "@/lib/utils/use-media-query";import { Button } from "@/components/ui/button";@@ -20,6 +23,7 @@ export default function EmailVerificationMessage({setCode,isInvalidCode,setIsInvalidCode,+ brand,}: {onSubmitHandler: React.FormEventHandler<HTMLFormElement>;data: DEFAULT_ACCESS_FORM_TYPE;@@ -28,6 +32,7 @@ export default function EmailVerificationMessage({setCode: (code: string | null) => void;isInvalidCode: boolean;setIsInvalidCode: (invalidCode: boolean) => void;+ brand?: Partial<Brand> | Partial<DataroomBrand> | null;}) {const { isMobile } = useMediaQuery();const [isResendLoading, setIsResendLoading] = useState(false);@@ -46,12 +51,28 @@ export default function EmailVerificationMessage({return (<>- <div className="flex h-screen flex-1 flex-col bg-black px-6 py-12 lg:px-8">+ <div+ className="flex h-screen flex-1 flex-col px-6 py-12 lg:px-8"+ style={{+ backgroundColor:+ brand && brand.accentColor ? brand.accentColor : "black",+ }}+ ><div className="sm:mx-auto sm:w-full sm:max-w-md">- <h2 className="mt-10 text-2xl font-bold leading-9 tracking-tight text-white">+ <h2+ className="mt-10 text-2xl font-bold leading-9 tracking-tight"+ style={{+ color: determineTextColor(brand?.accentColor),+ }}+ >Verify your email address</h2>- <p className="text-pretty text-sm leading-6 text-white">+ <p+ className="text-pretty text-sm leading-6"+ style={{+ color: determineTextColor(brand?.accentColor),+ }}+ >Enter the six digit verification code sent to{" "}<strong className="font-medium" title={data.email ?? ""}>{data.email}@@ -68,6 +89,7 @@ export default function EmailVerificationMessage({setCode(code || null);}}containerClassName="my-6"+ accentColor={brand?.accentColor}><InputOTPGroup>{[0, 1, 2, 3, 4, 5].map((index) => (@@ -86,7 +108,11 @@ export default function EmailVerificationMessage({type="submit"disabled={!code || isLoading}loading={isLoading && !isResendLoading}- className="bg-white text-black hover:bg-white/90"+ className="hover:opacity-90"+ style={{+ backgroundColor: determineTextColor(brand?.accentColor),+ color: brand && brand.accentColor ? brand.accentColor : "black",+ }}>{isLoading && !isResendLoading ? "Verifying..." : "Continue"}</Button>@@ -94,13 +120,27 @@ export default function EmailVerificationMessage({<div className="mt-10 space-y-4"><div className="flex items-center">- <p className="text-xs text-gray-600">+ <p+ className="text-xs"+ style={{+ color:+ determineTextColor(brand?.accentColor) === "white"+ ? "rgb(75, 85, 99)"+ : "rgb(107, 114, 128)",+ }}+ >Didn't receive the email?</p>{" "}<Buttonvariant="link"size="sm"- className="text-xs font-normal text-gray-500"+ className="text-xs font-normal"+ style={{+ color:+ determineTextColor(brand?.accentColor) === "white"+ ? "rgb(107, 114, 128)"+ : "rgb(156, 163, 175)",+ }}disabled={isLoading || delaySeconds > 0}onClick={(e) => {e.preventDefault();diff --git a/components/view/dataroom/dataroom-document-view.tsx b/components/view/dataroom/dataroom-document-view.tsxindex 6e3790c6..ad23159d 100644--- a/components/view/dataroom/dataroom-document-view.tsx+++ b/components/view/dataroom/dataroom-document-view.tsx@@ -288,6 +288,7 @@ export default function DataroomDocumentView({setCode={setCode}isInvalidCode={isInvalidCode}setIsInvalidCode={setIsInvalidCode}+ brand={brand}/>);}diff --git a/components/view/dataroom/dataroom-view.tsx b/components/view/dataroom/dataroom-view.tsxindex d37458b6..54269adc 100644--- a/components/view/dataroom/dataroom-view.tsx+++ b/components/view/dataroom/dataroom-view.tsx@@ -231,6 +231,7 @@ export default function DataroomView({setCode={setCode}isInvalidCode={isInvalidCode}setIsInvalidCode={setIsInvalidCode}+ brand={brand}/>);}diff --git a/components/view/document-view.tsx b/components/view/document-view.tsxindex 73a84cd9..29879427 100644--- a/components/view/document-view.tsx+++ b/components/view/document-view.tsx@@ -246,6 +246,7 @@ export default function DocumentView({setCode={setCode}isInvalidCode={isInvalidCode}setIsInvalidCode={setIsInvalidCode}+ brand={brand}/>);}