Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
refactor: update login page
Marc Seitz33b9551d1ac6
diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsxindex a11d3f40..9c628d9d 100644--- a/app/(auth)/login/page.tsx+++ b/app/(auth)/login/page.tsx@@ -11,138 +11,193 @@ import { useState } from "react";import { toast } from "sonner";import LinkedIn from "@/components/shared/icons/linkedin";import { Loader } from "lucide-react";+import Google from "@/components/shared/icons/google";+import { Label } from "@/components/ui/label";export default function Login() {const { next } = useParams as { next?: string };+const [isLoginWithEmail, setIsLoginWithEmail] = useState<boolean>(false);const [isLoginWithGoogle, setIsLoginWithGoogle] = useState<boolean>(false);const [isLoginWithLinkedIn, setIsLoginWithLinkedIn] =useState<boolean>(false);-const [email, setEmail] = useState<string>("");+ const [emailButtonText, setEmailButtonText] = useState<string>(+ "Continue with Email",+ );return (- <div className="flex h-screen w-full justify-center">- <div- className="absolute inset-x-0 top-10 -z-10 flex transform-gpu justify-center overflow-hidden blur-3xl"- aria-hidden="true"- >+ <div className="flex h-screen w-full flex-wrap ">+ {/* Left part */}+ <div className="flex w-full justify-center bg-white md:w-1/2 lg:w-2/5"><div- className="aspect-[1108/632] w-[69.25rem] flex-none bg-gradient-to-r from-[#80caff] to-[#4f46e5] opacity-20"- style={{- clipPath:- "polygon(73.6% 51.7%, 91.7% 11.8%, 100% 46.4%, 97.4% 82.2%, 92.5% 84.9%, 75.7% 64%, 55.3% 47.5%, 46.5% 49.4%, 45% 62.9%, 50.3% 87.2%, 21.3% 64.1%, 0.1% 100%, 5.4% 51.1%, 21.4% 63.9%, 58.9% 0.2%, 73.6% 51.7%)",- }}- />- </div>- <div className="z-10 mt-[calc(20vh)] h-fit w-full mx-5 sm:mx-0 max-w-md overflow-hidden border border-border bg-gray-50 dark:bg-gray-900 rounded-lg sm:shadow-xl">- <div className="flex flex-col items-center justify-center space-y-3 px-4 py-6 pt-8 text-center sm:px-16">- <Link href="/">- <span className="text-xl font-bold tracking-tighter text-foreground">- Papermark- </span>- </Link>- <h3 className="text-2xl text-foreground font-medium">- Start sharing documents- </h3>- </div>- <form- className="flex flex-col p-4 pt-8 sm:px-16 gap-4"- onSubmit={(e) => {- e.preventDefault();- setIsLoginWithEmail(true);- signIn("email", {- email: email,- redirect: false,- ...(next && next.length > 0 ? { callbackUrl: next } : {}),- }).then((res) => {- if (res?.ok && !res?.error) {- setEmail("");- toast.success("Email sent - check your inbox!");- } else {- toast.error("Error sending email - try again?");- }- setIsLoginWithEmail(false);- });- }}- >- <Input- className=" border-4"- placeholder="[email protected]"- value={email}- onChange={(e) => setEmail(e.target.value)}- />- <Button type="submit" disabled={isLoginWithEmail}>- {isLoginWithEmail && (- <Loader className="h-5 w-5 mr-2 animate-spin" />- )}- Continue with Email- </Button>- </form>- <p className="text-center">or</p>- <div className="flex flex-col px-4 py-8 sm:px-16 space-y-2">- <Button- onClick={() => {- setIsLoginWithGoogle(true);- signIn("google", {- ...(next && next.length > 0 ? { callbackUrl: next } : {}),- }).then((res) => {- if (res?.status) {- setIsLoginWithGoogle(false);- }- });- }}- disabled={isLoginWithGoogle}- className="flex justify-center items-center space-x-2"- >- {isLoginWithGoogle ? (- <Loader className="w-5 h-5 mr-2 animate-spin" />- ) : (- <svg- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 488 512"- fill="currentColor"- className="h-4 w-4"- >- <path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />- </svg>- )}-- <span>Continue with Google</span>- </Button>- <Button- onClick={() => {- setIsLoginWithLinkedIn(true);- signIn("linkedin", {+ className="absolute inset-x-0 top-10 -z-10 flex transform-gpu justify-center overflow-hidden blur-3xl"+ aria-hidden="true"+ ></div>+ <div className="z-10 mt-[calc(20vh)] h-fit w-full mx-5 sm:mx-0 max-w-md overflow-hiddenbg-gray-50 rounded-lg">+ <div className="flex flex-col items-center justify-center space-y-3 px-4 py-6 pt-8 text-center sm:px-16">+ <Link href="/">+ <span className=" text-2xl font-semibold text-gray-800 text-balance ">+ Welcome to Papermark+ </span>+ </Link>+ <h3 className="text-sm text-gray-800 text-balance ">+ Share documents. Not attachments.+ </h3>+ </div>+ <form+ className="flex flex-col px-4 pt-8 sm:px-16 gap-4"+ onSubmit={(e) => {+ e.preventDefault();+ setIsLoginWithEmail(true);+ signIn("email", {+ email: email,+ redirect: false,...(next && next.length > 0 ? { callbackUrl: next } : {}),}).then((res) => {- if (res?.status) {- setIsLoginWithLinkedIn(false);+ if (res?.ok && !res?.error) {+ setEmail("");+ setEmailButtonText("Email sent - check your inbox!");+ toast.success("Email sent - check your inbox!");+ } else {+ setEmailButtonText("Error sending email - try again?");+ toast.error("Error sending email - try again?");}+ setIsLoginWithEmail(false);});}}- disabled={isLoginWithLinkedIn}- className="flex justify-center items-center space-x-2">- {isLoginWithLinkedIn ? (- <Loader className="w-5 h-5 mr-2 animate-spin" />- ) : (- <LinkedIn />- )}- <span>Continue with LinkedIn</span>- </Button>- <Button- onClick={() =>- signInWithPasskey({- tenantId: process.env.NEXT_PUBLIC_HANKO_TENANT_ID as string,- })- }- variant="outline"- className="flex justify-center items-center space-x-2"+ {/* <Input+ className="border-1 bg-white border-gray-200 hover:border-gray-200 text-gray-800"+ placeholder="[email protected]"+ value={email}+ onChange={(e) => setEmail(e.target.value)}+ /> */}+ <Label className="sr-only" htmlFor="email">+ </Label>+ <Input+ id="email"+ placeholder="[email protected]"+ type="email"+ autoCapitalize="none"+ autoComplete="email"+ autoCorrect="off"+ disabled={isLoginWithEmail}+ value={email}+ onChange={(e) => setEmail(e.target.value)}+ className="flex h-10 w-full rounded-md border-0 ring-1 ring-gray-200 bg-background px-3 py-2 text-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 bg-white text-gray-900"+ />+ {/* <Button type="submit" disabled={isLoginWithEmail}>+ {isLoginWithEmail && (+ <Loader className="h-5 w-5 mr-2 animate-spin bg-gray-800 hover:bg-gray-900" />+ )}+ Continue with Email+ </Button> */}+ <Button+ type="submit"+ loading={isLoginWithEmail}+ className={`${+ isLoginWithEmail ? "bg-black" : "bg-gray-800 hover:bg-gray-900 "+ } text-white py-2 px-4 rounded focus:outline-none focus:shadow-outline transform transition-colors duration-300 ease-in-out`}+ >+ {emailButtonText}+ </Button>+ </form>+ <p className="text-center py-4">or</p>+ <div className="flex flex-col px-4 sm:px-16 space-y-2">+ <Button+ onClick={() => {+ setIsLoginWithGoogle(true);+ signIn("google", {+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),+ }).then((res) => {+ if (res?.status) {+ setIsLoginWithGoogle(false);+ }+ });+ }}+ disabled={isLoginWithGoogle}+ className="flex justify-center items-center space-x-2 font-normal bg-gray-100 text-gray-900 border border-gray-200 hover:bg-gray-200 "+ >+ {isLoginWithGoogle ? (+ <Loader className="w-5 h-5 mr-2 animate-spin" />+ ) : (+ <Google className="w-5 h-5" />+ )}+ <span>Continue with Google</span>+ </Button>+ <Button+ onClick={() => {+ setIsLoginWithLinkedIn(true);+ signIn("linkedin", {+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),+ }).then((res) => {+ if (res?.status) {+ setIsLoginWithLinkedIn(false);+ }+ });+ }}+ disabled={isLoginWithLinkedIn}+ className="flex justify-center items-center space-x-2 font-normal bg-gray-100 text-gray-900 border border-gray-200 hover:bg-gray-200"+ >+ {isLoginWithLinkedIn ? (+ <Loader className="w-5 h-5 mr-2 animate-spin " />+ ) : (+ <LinkedIn />+ )}+ <span>Continue with LinkedIn</span>+ </Button>+ <Button+ onClick={() =>+ signInWithPasskey({+ tenantId: process.env.NEXT_PUBLIC_HANKO_TENANT_ID as string,+ })+ }+ variant="outline"+ className="flex justify-center items-center space-x-2 border border-gray-200 hover:bg-gray-200 font-normal bg-gray-100 text-gray-900 hover:text-gray-900"+ >+ <Passkey className="w-4 h-4 " />+ <span>Continue with a passkey</span>+ </Button>+ </div>+ </div>+ </div>+ <div className="hidden w-full justify-center bg-gray-800 md:flex md:w-1/2 lg:w-3/5">+ <div className="flex w-full max-w-5xl px-4 md:px-8 py-20">+ <div+ className="flex w-full mx-auto max-w-5xl px-4 md:px-8 py-20 bg-gray-800 rounded-3xl justify-center"+ id="features">- <Passkey className="w-4 h-4" />- <span>Continue with a passkey</span>- </Button>+ <div className="flex flex-col items-center">+ {/* Image container */}+ <div className="w-64 h-64 mb-4">+ <img+ className="object-cover w-full h-full rounded-2xl shadow-2xl"+ src="https://www.papermark.io/_static/testimonials/jaski.jpeg"+ alt="Jaski"+ />+ </div>+ {/* Text content */}+ <div className="max-w-xl text-center">+ <blockquote className="text-l leading-8 text-gray-100 sm:text-xl sm:leading-9 text-balance">+ <p>+ True builders listen to their users and build what they+ need. Thanks Papermark team for solving a big pain point.+ DocSend monopoly will end soon!+ </p>+ </blockquote>+ <figcaption className="mt-4">+ <div className="font-semibold text-white text-balance ">+ Jaski+ </div>+ <div className="text-gray-400 text-balance ">+ Founder, Townhall Network+ </div>+ </figcaption>+ </div>+ </div>+ </div></div></div></div>diff --git a/components/shared/icons/google.tsx b/components/shared/icons/google.tsxnew file mode 100644index 00000000..8bc4e31a--- /dev/null+++ b/components/shared/icons/google.tsx@@ -0,0 +1,29 @@+export default function Google({ className }: { className?: string }) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ height="24"+ viewBox="0 0 24 24"+ width="24"+ className={className}+ >+ <path+ d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"+ fill="#4285F4"+ />+ <path+ d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"+ fill="#34A853"+ />+ <path+ d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"+ fill="#FBBC05"+ />+ <path+ d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"+ fill="#EA4335"+ />+ <path d="M1 1h22v22H1z" fill="none" />+ </svg>+ );+}diff --git a/components/shared/icons/linkedin.tsx b/components/shared/icons/linkedin.tsxindex c7c45505..47e28199 100644--- a/components/shared/icons/linkedin.tsx+++ b/components/shared/icons/linkedin.tsx@@ -1,4 +1,10 @@-export default function LinkedIn({ className }: { className?: string }) {+export default function LinkedIn({+ className,+ color = true,+}: {+ className?: string;+ color?: boolean;+}) {return (<svgxmlns="http://www.w3.org/2000/svg"@@ -11,7 +17,7 @@ export default function LinkedIn({ className }: { className?: string }) {<g><pathd="M0 18.338C0 8.216 8.474 0 18.92 0h218.16C247.53 0 256 8.216 256 18.338v219.327C256 247.79 247.53 256 237.08 256H18.92C8.475 256 0 247.791 0 237.668V18.335z"- fill="#000"+ fill={color ? "#069" : "#000"}/><pathd="M77.796 214.238V98.986H39.488v115.252H77.8zM58.65 83.253c13.356 0 21.671-8.85 21.671-19.91-.25-11.312-8.315-19.915-21.417-19.915-13.111 0-21.674 8.603-21.674 19.914 0 11.06 8.312 19.91 21.169 19.91h.248zM99 214.238h38.305v-64.355c0-3.44.25-6.889 1.262-9.346 2.768-6.885 9.071-14.012 19.656-14.012 13.858 0 19.405 10.568 19.405 26.063v61.65h38.304v-66.082c0-35.399-18.896-51.872-44.099-51.872-20.663 0-29.738 11.549-34.78 19.415h.255V98.99H99.002c.5 10.812-.003 115.252-.003 115.252z"diff --git a/components/ui/input.tsx b/components/ui/input.tsxindex 677d05fd..e8db54d5 100644--- a/components/ui/input.tsx+++ b/components/ui/input.tsx@@ -1,6 +1,6 @@-import * as React from "react"+import * as React from "react";-import { cn } from "@/lib/utils"+import { cn } from "@/lib/utils";export interface InputPropsextends React.InputHTMLAttributes<HTMLInputElement> {}@@ -11,15 +11,16 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(<inputtype={type}className={cn(- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",- className+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",+ // "flex h-10 w-full rounded-md border-0 ring-1 ring-border bg-background px-3 py-2 text-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",+ className,)}ref={ref}{...props}/>- )- }-)-Input.displayName = "Input"+ );+ },+);+Input.displayName = "Input";-export { Input }+export { Input };