Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

chore: cleanup spacing of access screen

Marc Seitz35ec34547fb9
diff --git a/components/view/access-form/agreement-section.tsx b/components/view/access-form/agreement-section.tsx
index 503acd8b..ca608118 100644
--- a/components/view/access-form/agreement-section.tsx
+++ b/components/view/access-form/agreement-section.tsx
@@ -28,15 +28,27 @@ export default function AgreementSection({
};
return (
- <div className="pb-5">
- <div className="relative flex items-start space-x-2">
- <Checkbox
- id="agreement"
- onCheckedChange={handleCheckChange}
- className="mt-0.5 border border-gray-400 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-300 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-white data-[state=checked]:bg-black data-[state=checked]:text-white"
- />
- <label
- className="text-sm font-normal leading-5 text-white peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ <div className="relative flex items-start space-x-2 pt-5">
+ <Checkbox
+ id="agreement"
+ onCheckedChange={handleCheckChange}
+ className="mt-0.5 border border-gray-400 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-300 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-white data-[state=checked]:bg-black data-[state=checked]:text-white"
+ />
+ <label
+ className="text-sm font-normal leading-5 text-white peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ style={{
+ color:
+ brand && brand.accentColor
+ ? determineTextColor(brand.accentColor)
+ : "white",
+ }}
+ >
+ I have reviewed and agree to the terms of this{" "}
+ <a
+ href={`${agreementContent}`}
+ target="_blank"
+ rel="noreferrer noopener"
+ className="underline hover:text-gray-200"
style={{
color:
brand && brand.accentColor
@@ -44,24 +56,10 @@ export default function AgreementSection({
: "white",
}}
>
- I have reviewed and agree to the terms of this{" "}
- <a
- href={`${agreementContent}`}
- target="_blank"
- rel="noreferrer noopener"
- className="underline hover:text-gray-200"
- style={{
- color:
- brand && brand.accentColor
- ? determineTextColor(brand.accentColor)
- : "white",
- }}
- >
- {agreementName}
- </a>
- .
- </label>
- </div>
+ {agreementName}
+ </a>
+ .
+ </label>
</div>
);
}
diff --git a/components/view/access-form/custom-fields-section.tsx b/components/view/access-form/custom-fields-section.tsx
new file mode 100644
index 00000000..45c0fbfc
--- /dev/null
+++ b/components/view/access-form/custom-fields-section.tsx
@@ -0,0 +1,80 @@
+import { Brand, CustomField, DataroomBrand } from "@prisma/client";
+
+import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
+
+import { cn } from "@/lib/utils";
+import { determineTextColor } from "@/lib/utils/determine-text-color";
+
+export default function CustomFieldsSection({
+ fields,
+ data,
+ setData,
+ brand,
+}: {
+ fields: Partial<CustomField>[];
+ data: { [key: string]: string };
+ setData: (data: { [key: string]: string }) => void;
+ brand?: Partial<Brand> | Partial<DataroomBrand> | null;
+}) {
+ const handleInputChange = (
+ e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
+ identifier: string,
+ ) => {
+ setData({ ...data, [identifier]: e.target.value });
+ };
+
+ if (!fields?.length) return null;
+
+ return (
+ <div className="space-y-5">
+ {fields.map((field, index) => {
+ if (!field.identifier) return null;
+
+ const value = data[field.identifier] || "";
+ const isLongText = field.type === "LONG_TEXT";
+ const InputComponent = isLongText ? Textarea : Input;
+
+ return (
+ <div key={field.identifier} className="relative space-y-2">
+ <label
+ htmlFor={field.identifier}
+ className="block text-sm font-medium leading-6 text-white"
+ style={{
+ color:
+ brand && brand.accentColor
+ ? determineTextColor(brand.accentColor)
+ : "white",
+ }}
+ >
+ {field.label}
+ </label>
+ <InputComponent
+ name={field.identifier || ""}
+ id={field.id || ""}
+ type={field.type === "NUMBER" ? "number" : "text"}
+ autoComplete="off"
+ required={field.required}
+ disabled={field.disabled}
+ className={cn(
+ "flex w-full rounded-md border-0 bg-black py-1.5 text-gray-500 shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6",
+ isLongText && "min-h-[100px] resize-none",
+ )}
+ style={{
+ backgroundColor:
+ brand && brand.accentColor ? brand.accentColor : "black",
+ color:
+ brand && brand.accentColor
+ ? determineTextColor(brand.accentColor)
+ : "white",
+ }}
+ value={value}
+ placeholder={field.placeholder || ""}
+ onChange={(e) => handleInputChange(e, field.identifier!)}
+ />
+ </div>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/components/view/access-form/email-section.tsx b/components/view/access-form/email-section.tsx
index b6b10133..0997fa15 100644
--- a/components/view/access-form/email-section.tsx
+++ b/components/view/access-form/email-section.tsx
@@ -91,71 +91,69 @@ export default function EmailSection({
};
return (
- <div className="pb-5">
- <div className="relative space-y-2">
- <label
- htmlFor="email"
- className="block text-sm font-medium leading-6 text-white"
+ <div className="relative space-y-2">
+ <label
+ htmlFor="email"
+ className="block text-sm font-medium leading-6 text-white"
+ style={{
+ color:
+ brand && brand.accentColor
+ ? determineTextColor(brand.accentColor)
+ : "white",
+ }}
+ >
+ Email address
+ </label>
+ <input
+ name="email"
+ id="email"
+ type="email"
+ autoCorrect="off"
+ autoComplete="email"
+ autoFocus
+ required
+ className={cn(
+ "flex w-full rounded-md border-0 bg-black py-1.5 text-gray-500 shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6",
+ emailError && isDirty && "ring-red-500",
+ )}
+ style={{
+ backgroundColor:
+ brand && brand.accentColor ? brand.accentColor : "black",
+ color: disableEditEmail
+ ? "hsl(var(--muted-foreground))"
+ : brand && brand.accentColor
+ ? determineTextColor(brand.accentColor)
+ : "white",
+ }}
+ value={email || ""}
+ placeholder="Enter email"
+ onChange={handleEmailChange}
+ onInvalid={handleInvalid}
+ onBlur={handleBlur}
+ onFocus={handleFocus}
+ disabled={disableEditEmail}
+ data-1p-ignore
+ aria-invalid={emailError ? "true" : "false"}
+ aria-describedby={emailError ? "email-error" : undefined}
+ />
+ {emailError && (
+ <p
+ id="email-error"
+ className="mt-1 text-sm text-red-500"
style={{
- color:
- brand && brand.accentColor
- ? determineTextColor(brand.accentColor)
- : "white",
+ color: brand?.accentColor
+ ? determineTextColor(brand.accentColor)
+ : "rgb(239 68 68)",
}}
>
- Email address
- </label>
- <input
- name="email"
- id="email"
- type="email"
- autoCorrect="off"
- autoComplete="email"
- autoFocus
- required
- className={cn(
- "flex w-full rounded-md border-0 bg-black py-1.5 text-gray-500 shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6",
- emailError && isDirty && "ring-red-500",
- )}
- style={{
- backgroundColor:
- brand && brand.accentColor ? brand.accentColor : "black",
- color: disableEditEmail
- ? "hsl(var(--muted-foreground))"
- : brand && brand.accentColor
- ? determineTextColor(brand.accentColor)
- : "white",
- }}
- value={email || ""}
- placeholder="Enter email"
- onChange={handleEmailChange}
- onInvalid={handleInvalid}
- onBlur={handleBlur}
- onFocus={handleFocus}
- disabled={disableEditEmail}
- data-1p-ignore
- aria-invalid={emailError ? "true" : "false"}
- aria-describedby={emailError ? "email-error" : undefined}
- />
- {emailError && (
- <p
- id="email-error"
- className="mt-1 text-sm text-red-500"
- style={{
- color: brand?.accentColor
- ? determineTextColor(brand.accentColor)
- : "rgb(239 68 68)",
- }}
- >
- {emailError}
- </p>
- )}
- <p className="text-sm text-gray-500">
- {useCustomAccessForm
- ? "This data will be shared with the content provider."
- : "This data will be shared with the sender."}
+ {emailError}
</p>
- </div>
+ )}
+ <p className="text-sm text-gray-500">
+ {useCustomAccessForm
+ ? "This data will be shared with the content provider."
+ : "This data will be shared with the sender."}
+ </p>
</div>
);
}
diff --git a/components/view/access-form/name-section.tsx b/components/view/access-form/name-section.tsx
index a138b4d0..b6ea5197 100644
--- a/components/view/access-form/name-section.tsx
+++ b/components/view/access-form/name-section.tsx
@@ -37,43 +37,41 @@ export default function NameSection({
};
return (
- <div className="pb-5">
- <div className="relative space-y-2 rounded-md shadow-sm">
- <label
- htmlFor="name"
- className="block text-sm font-medium leading-6 text-white"
- style={{
- color:
- brand && brand.accentColor
- ? determineTextColor(brand.accentColor)
- : "white",
- }}
- >
- Name
- </label>
- <input
- name="name"
- id="name"
- type="text"
- autoCorrect="off"
- autoComplete="off"
- autoFocus
- className="flex w-full rounded-md border-0 bg-black py-1.5 text-white shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6"
- style={{
- backgroundColor:
- brand && brand.accentColor ? brand.accentColor : "black",
- color:
- brand && brand.accentColor
- ? determineTextColor(brand.accentColor)
- : "white",
- }}
- value={name || ""}
- placeholder="Enter your full name"
- onChange={handleNameChange}
- aria-invalid="true"
- data-1p-ignore
- />
- </div>
+ <div className="relative space-y-2 rounded-md shadow-sm">
+ <label
+ htmlFor="name"
+ className="block text-sm font-medium leading-6 text-white"
+ style={{
+ color:
+ brand && brand.accentColor
+ ? determineTextColor(brand.accentColor)
+ : "white",
+ }}
+ >
+ Name
+ </label>
+ <input
+ name="name"
+ id="name"
+ type="text"
+ autoCorrect="off"
+ autoComplete="off"
+ autoFocus
+ className="flex w-full rounded-md border-0 bg-black py-1.5 text-white shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6"
+ style={{
+ backgroundColor:
+ brand && brand.accentColor ? brand.accentColor : "black",
+ color:
+ brand && brand.accentColor
+ ? determineTextColor(brand.accentColor)
+ : "white",
+ }}
+ value={name || ""}
+ placeholder="Enter your full name"
+ onChange={handleNameChange}
+ aria-invalid="true"
+ data-1p-ignore
+ />
</div>
);
}
diff --git a/components/view/access-form/password-section.tsx b/components/view/access-form/password-section.tsx
index a90319c2..273b003e 100644
--- a/components/view/access-form/password-section.tsx
+++ b/components/view/access-form/password-section.tsx
@@ -22,56 +22,54 @@ export default function PasswordSection({
const [showPassword, setShowPassword] = useState<boolean>(false);
return (
- <div className="pb-5">
- <div className="space-y-2 rounded-md shadow-sm">
- <label
- htmlFor="password"
- className="block text-sm font-medium leading-6 text-white"
+ <div className="space-y-2 rounded-md shadow-sm">
+ <label
+ htmlFor="password"
+ className="block text-sm font-medium leading-6 text-white"
+ style={{
+ color:
+ brand && brand.accentColor
+ ? determineTextColor(brand.accentColor)
+ : "white",
+ }}
+ >
+ Passcode
+ </label>
+ <div className="relative">
+ <input
+ name="password"
+ id="password"
+ type={showPassword ? "text" : "password"}
+ autoCorrect="off"
+ autoComplete="off"
+ className="flex w-full rounded-md border-0 bg-black py-1.5 text-white shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6"
style={{
+ backgroundColor:
+ brand && brand.accentColor ? brand.accentColor : "black",
color:
brand && brand.accentColor
? determineTextColor(brand.accentColor)
: "white",
}}
+ value={password || ""}
+ placeholder="Enter passcode"
+ onChange={(e) => {
+ setData({ ...data, password: e.target.value });
+ }}
+ aria-invalid="true"
+ data-1p-ignore
+ />
+ <button
+ type="button"
+ onClick={() => setShowPassword(!showPassword)}
+ className="absolute inset-y-0 right-0 flex items-center pr-3"
>
- Passcode
- </label>
- <div className="relative">
- <input
- name="password"
- id="password"
- type={showPassword ? "text" : "password"}
- autoCorrect="off"
- autoComplete="off"
- className="flex w-full rounded-md border-0 bg-black py-1.5 text-white shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6"
- style={{
- backgroundColor:
- brand && brand.accentColor ? brand.accentColor : "black",
- color:
- brand && brand.accentColor
- ? determineTextColor(brand.accentColor)
- : "white",
- }}
- value={password || ""}
- placeholder="Enter passcode"
- onChange={(e) => {
- setData({ ...data, password: e.target.value });
- }}
- aria-invalid="true"
- data-1p-ignore
- />
- <button
- type="button"
- onClick={() => setShowPassword(!showPassword)}
- className="absolute inset-y-0 right-0 flex items-center pr-3"
- >
- {showPassword ? (
- <Eye className="h-4 w-4 text-gray-400" aria-hidden="true" />
- ) : (
- <EyeOff className="h-4 w-4 text-gray-400" aria-hidden="true" />
- )}
- </button>
- </div>
+ {showPassword ? (
+ <Eye className="h-4 w-4 text-gray-400" aria-hidden="true" />
+ ) : (
+ <EyeOff className="h-4 w-4 text-gray-400" aria-hidden="true" />
+ )}
+ </button>
</div>
</div>
);