Skip to content

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

refactor: improve themes for link sheet

Marc Seitz3bd488940e5e
diff --git a/components/links/link-sheet/allow-list-section.tsx b/components/links/link-sheet/allow-list-section.tsx
index 2b77501f..d875c0fc 100644
--- a/components/links/link-sheet/allow-list-section.tsx
+++ b/components/links/link-sheet/allow-list-section.tsx
@@ -2,6 +2,8 @@ import { useEffect, useState } from "react";
import { motion } from "framer-motion";
+import { Textarea } from "@/components/ui/textarea";
+
import { FADE_IN_ANIMATION_SETTINGS } from "@/lib/constants";
import { sanitizeAllowDenyList } from "@/lib/utils";
@@ -92,8 +94,8 @@ export default function AllowListSection({
className="mt-1 block w-full"
{...FADE_IN_ANIMATION_SETTINGS}
>
- <textarea
- className="form-textarea w-full rounded-md border-0 bg-background py-1.5 text-sm leading-6 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400"
+ <Textarea
+ className="focus:ring-inset"
rows={5}
placeholder="Enter allowed emails/domains, one per line, e.g. [email protected] @example.org"
value={allowListInput}
diff --git a/components/links/link-sheet/deny-list-section.tsx b/components/links/link-sheet/deny-list-section.tsx
index 3f97c671..d5806374 100644
--- a/components/links/link-sheet/deny-list-section.tsx
+++ b/components/links/link-sheet/deny-list-section.tsx
@@ -2,6 +2,8 @@ import { useEffect, useState } from "react";
import { motion } from "framer-motion";
+import { Textarea } from "@/components/ui/textarea";
+
import { FADE_IN_ANIMATION_SETTINGS } from "@/lib/constants";
import { sanitizeAllowDenyList } from "@/lib/utils";
@@ -91,8 +93,8 @@ export default function DenyListSection({
className="mt-1 block w-full"
{...FADE_IN_ANIMATION_SETTINGS}
>
- <textarea
- className="form-textarea w-full rounded-md border-0 bg-background py-1.5 text-sm leading-6 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400"
+ <Textarea
+ className="focus:ring-inset"
rows={5}
placeholder="Enter blocked emails/domains, one per line, e.g. [email protected] @example.org"
value={denyListInput}
diff --git a/components/links/link-sheet/domain-section.tsx b/components/links/link-sheet/domain-section.tsx
index 9592e34c..9c23ef32 100644
--- a/components/links/link-sheet/domain-section.tsx
+++ b/components/links/link-sheet/domain-section.tsx
@@ -7,7 +7,15 @@ import { Domain } from "@prisma/client";
import { mutate } from "swr";
import { AddDomainModal } from "@/components/domains/add-domain-modal";
+import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
import { BLOCKED_PATHNAMES } from "@/lib/constants";
import { BasePlan } from "@/lib/swr/use-billing";
@@ -33,12 +41,13 @@ export default function DomainSection({
const teamInfo = useTeam();
const { limits } = useLimits();
- const handleDomainChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
- const value = event.target.value;
+ const handleDomainChange = (value: string) => {
+ // const value = event.target.value;
if (value === "add_domain" || value === "add_dataroom_domain") {
// Redirect to the add domain page
setModalOpen(true);
+ setData({ ...data, domain: "papermark.io" });
return;
}
@@ -57,54 +66,69 @@ export default function DomainSection({
<>
<Label htmlFor="link-domain">Domain</Label>
<div className="flex">
- <select
- value={data.domain || "papermark.io"}
- onChange={handleDomainChange}
- onFocus={handleSelectFocus}
- className={cn(
- "w-full rounded-l-md border border-r-0 border-border bg-secondary px-5 text-sm text-secondary-foreground focus:border-border focus:outline-none focus:ring-0",
- data.domain && data.domain !== "papermark.io"
- ? ""
- : "border-r-1 rounded-r-md",
- )}
+ <Select
+ defaultValue={data.domain || "papermark.io"}
+ onValueChange={handleDomainChange}
+ onOpenChange={handleSelectFocus}
>
- <option key="papermark.io" value="papermark.io">
- papermark.io
- </option>
- {linkType === "DOCUMENT_LINK" &&
- (plan === "business" || (limits && limits.customDomainOnPro)) && (
- <>
- {domains?.map(({ slug }) => (
- <option key={slug} value={slug}>
- {slug}
- </option>
- ))}
- </>
- )}
- {linkType === "DATAROOM_LINK" &&
- (plan === "datarooms" ||
- (limits && limits.customDomainInDataroom)) && (
- <>
- {domains?.map(({ slug }) => (
- <option key={slug} value={slug}>
- {slug}
- </option>
- ))}
- </>
+ <SelectTrigger
+ className={cn(
+ "flex w-full rounded-none rounded-l-md border border-input bg-white text-foreground placeholder-muted-foreground focus:border-muted-foreground focus:outline-none focus:ring-inset focus:ring-muted-foreground dark:border-gray-500 dark:bg-gray-800 focus:dark:bg-transparent sm:text-sm",
+ data.domain && data.domain !== "papermark.io"
+ ? ""
+ : "border-r-1 rounded-r-md",
)}
- <option
- value={
- linkType === "DOCUMENT_LINK"
- ? "add_domain"
- : "add_dataroom_domain"
- }
>
- Add a custom domain ✨
- </option>
- </select>
+ <SelectValue placeholder="Select a domain" />
+ </SelectTrigger>
+ <SelectContent className="flex w-full rounded-md border border-input bg-white text-foreground placeholder-muted-foreground focus:border-muted-foreground focus:outline-none focus:ring-inset focus:ring-muted-foreground dark:border-gray-500 dark:bg-gray-800 focus:dark:bg-transparent sm:text-sm">
+ <SelectItem value="papermark.io" className="hover:bg-muted">
+ papermark.io
+ </SelectItem>
+ {linkType === "DOCUMENT_LINK" &&
+ (plan === "business" || (limits && limits.customDomainOnPro)) && (
+ <>
+ {domains?.map(({ slug }) => (
+ <SelectItem
+ key={slug}
+ value={slug}
+ className="hover:bg-muted hover:dark:bg-gray-700"
+ >
+ {slug}
+ </SelectItem>
+ ))}
+ </>
+ )}
+ {linkType === "DATAROOM_LINK" &&
+ (plan === "datarooms" ||
+ (limits && limits.customDomainInDataroom)) && (
+ <>
+ {domains?.map(({ slug }) => (
+ <SelectItem
+ key={slug}
+ value={slug}
+ className="hover:bg-muted hover:dark:bg-gray-700"
+ >
+ {slug}
+ </SelectItem>
+ ))}
+ </>
+ )}
+ <SelectItem
+ className="hover:bg-muted hover:dark:bg-gray-700"
+ value={
+ linkType === "DOCUMENT_LINK"
+ ? "add_domain"
+ : "add_dataroom_domain"
+ }
+ >
+ Add a custom domain ✨
+ </SelectItem>
+ </SelectContent>
+ </Select>
{data.domain && data.domain !== "papermark.io" ? (
- <input
+ <Input
type="text"
name="key"
required
@@ -126,7 +150,7 @@ export default function DomainSection({
}}
autoComplete="off"
className={cn(
- "hidden w-full rounded-r-md border-0 bg-background py-1.5 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400 sm:text-sm sm:leading-6",
+ "hidden rounded-l-none focus:ring-inset",
data.domain && data.domain !== "papermark.io" ? "flex" : "",
)}
placeholder="deck"
diff --git a/components/links/link-sheet/expiration-section.tsx b/components/links/link-sheet/expiration-section.tsx
index 8e1d8aaa..7a7d625a 100644
--- a/components/links/link-sheet/expiration-section.tsx
+++ b/components/links/link-sheet/expiration-section.tsx
@@ -2,6 +2,8 @@ import { useEffect, useState } from "react";
import { motion } from "framer-motion";
+import { Input } from "@/components/ui/input";
+
import { FADE_IN_ANIMATION_SETTINGS } from "@/lib/constants";
import { getDateTimeLocal } from "@/lib/utils";
@@ -40,7 +42,7 @@ export default function ExpirationSection({
{enabled && (
<motion.div className="mt-3" {...FADE_IN_ANIMATION_SETTINGS}>
- <input
+ <Input
type="datetime-local"
id="expiresAt"
name="expiresAt"
@@ -50,7 +52,7 @@ export default function ExpirationSection({
onChange={(e) => {
setData({ ...data, expiresAt: new Date(e.target.value) });
}}
- className="flex w-full rounded-md border-0 bg-background py-1.5 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400 sm:text-sm sm:leading-6"
+ className="focus:ring-inset"
/>
</motion.div>
)}
diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsx
index cdb2bd26..e985003a 100644
--- a/components/links/link-sheet/index.tsx
+++ b/components/links/link-sheet/index.tsx
@@ -7,6 +7,7 @@ import { toast } from "sonner";
import { mutate } from "swr";
import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
@@ -200,7 +201,7 @@ export default function LinkSheet({
return (
<Sheet open={isOpen} onOpenChange={(open: boolean) => setIsOpen(open)}>
- <SheetContent className="flex w-[90%] flex-col justify-between bg-background px-4 text-foreground sm:w-[600px] sm:max-w-2xl md:px-5">
+ <SheetContent className="flex w-[90%] flex-col justify-between border-l border-gray-200 bg-background px-4 text-foreground dark:border-gray-800 dark:bg-gray-900 sm:w-[600px] sm:max-w-2xl md:px-5">
<SheetHeader className="text-start">
<SheetTitle>
{currentLink ? "Edit link" : "Create a new link"}
@@ -216,13 +217,13 @@ export default function LinkSheet({
<div className="space-y-2">
<Label htmlFor="link-name">Link Name</Label>
<div className="mt-2">
- <input
+ <Input
type="text"
name="link-name"
id="link-name"
placeholder="Recipient's Organization"
value={data.name || ""}
- className="flex w-full rounded-md border-0 bg-background py-1.5 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400 sm:text-sm sm:leading-6"
+ className="focus:ring-inset"
onChange={(e) =>
setData({ ...data, name: e.target.value })
}
@@ -241,7 +242,7 @@ export default function LinkSheet({
<div className="relative flex items-center">
<Separator className="absolute bg-muted-foreground" />
<div className="relative mx-auto">
- <span className="bg-background px-2 text-sm text-muted-foreground">
+ <span className="bg-background px-2 text-sm text-muted-foreground dark:bg-gray-900">
Link Options
</span>
</div>
diff --git a/components/links/link-sheet/og-section.tsx b/components/links/link-sheet/og-section.tsx
index fc09343f..0fa3d59b 100644
--- a/components/links/link-sheet/og-section.tsx
+++ b/components/links/link-sheet/og-section.tsx
@@ -8,6 +8,7 @@ import LoadingSpinner from "@/components/ui/loading-spinner";
import { Textarea } from "@/components/ui/textarea";
import { FADE_IN_ANIMATION_SETTINGS } from "@/lib/constants";
+import { cn } from "@/lib/utils";
import { DEFAULT_LINK_TYPE } from ".";
import LinkItem from "./link-item";
@@ -100,7 +101,7 @@ export default function OGSection({
</div>
<label
htmlFor="image"
- className="group relative mt-1 flex h-[14rem] cursor-pointer flex-col items-center justify-center rounded-md border border-gray-300 bg-white shadow-sm transition-all hover:bg-gray-50"
+ className="group relative mt-1 flex h-[14rem] cursor-pointer flex-col items-center justify-center rounded-md border border-input bg-white shadow-sm transition-all hover:border-muted-foreground hover:bg-gray-50 hover:ring-muted-foreground dark:bg-gray-800 hover:dark:bg-transparent"
>
{false && (
<div className="absolute z-[5] flex h-full w-full items-center justify-center rounded-md bg-white">
@@ -154,20 +155,20 @@ export default function OGSection({
}}
/>
<div
- className={`${
- dragActive
- ? "cursor-copy border-2 border-black bg-gray-50 opacity-100"
- : ""
- } absolute z-[3] flex h-full w-full flex-col items-center justify-center rounded-md bg-white transition-all ${
+ className={cn(
+ "absolute z-[3] flex h-full w-full flex-col items-center justify-center rounded-md transition-all",
+ dragActive &&
+ "cursor-copy border-2 border-black bg-gray-50 opacity-100 dark:bg-transparent",
metaImage
? "opacity-0 group-hover:opacity-100"
- : "group-hover:bg-gray-50"
- }`}
+ : "group-hover:bg-gray-50 group-hover:dark:bg-transparent",
+ )}
>
<ArrowUpTrayIcon
- className={`${
- dragActive ? "scale-110" : "scale-100"
- } h-7 w-7 text-gray-500 transition-all duration-75 group-hover:scale-110 group-active:scale-95`}
+ className={cn(
+ "h-7 w-7 text-gray-500 transition-all duration-75 group-hover:scale-110 group-active:scale-95",
+ dragActive ? "scale-110" : "scale-100",
+ )}
/>
<p className="mt-2 text-center text-sm text-gray-500">
Drag and drop or click to upload.
@@ -214,7 +215,7 @@ export default function OGSection({
name="title"
id="title"
maxLength={120}
- className="flex w-full rounded-md border-0 bg-background py-1.5 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400 sm:text-sm sm:leading-6"
+ className="focus:ring-inset"
placeholder={`Papermark - open-source document sharing infrastructure.`}
value={metaTitle || ""}
onChange={(e) => {
@@ -245,7 +246,7 @@ export default function OGSection({
id="description"
rows={3}
maxLength={240}
- className="flex w-full rounded-md border-0 bg-background py-1.5 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400 sm:text-sm sm:leading-6"
+ className="focus:ring-inset"
placeholder={`Papermark is an open-source document sharing infrastructure for modern teams.`}
value={metaDescription || ""}
onChange={(e) => {
diff --git a/components/links/link-sheet/password-section.tsx b/components/links/link-sheet/password-section.tsx
index 92eee347..f7b65bf5 100644
--- a/components/links/link-sheet/password-section.tsx
+++ b/components/links/link-sheet/password-section.tsx
@@ -4,6 +4,7 @@ import { motion } from "framer-motion";
import Eye from "@/components/shared/icons/eye";
import EyeOff from "@/components/shared/icons/eye-off";
+import { Input } from "@/components/ui/input";
import { FADE_IN_ANIMATION_SETTINGS } from "@/lib/constants";
@@ -46,13 +47,14 @@ export default function PasswordSection({
className="relative mt-4 rounded-md shadow-sm"
{...FADE_IN_ANIMATION_SETTINGS}
>
- <input
+ <Input
name="password"
id="password"
autoComplete="off"
data-1p-ignore
type={showPassword ? "text" : "password"}
- className="flex w-full rounded-md border-0 bg-background py-1.5 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400 sm:text-sm sm:leading-6"
+ className="focus:ring-inset"
+ // className="flex w-full rounded-md border-0 bg-background py-1.5 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400 sm:text-sm sm:leading-6"
value={password || ""}
placeholder="Enter password"
onChange={(e) => {
diff --git a/components/links/link-sheet/question-section.tsx b/components/links/link-sheet/question-section.tsx
index 8dbd6ddf..c6ad0d44 100644
--- a/components/links/link-sheet/question-section.tsx
+++ b/components/links/link-sheet/question-section.tsx
@@ -73,10 +73,10 @@ export default function QuestionSection({
<div className="w-full space-y-2">
<Label>Question Type</Label>
<Select defaultValue="yes-no">
- <SelectTrigger className="focus:ring-offset-3 flex w-full rounded-md border-0 bg-background py-1.5 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-gray-400 sm:text-sm sm:leading-6">
+ <SelectTrigger className="flex w-full rounded-md border border-input bg-white text-foreground placeholder-muted-foreground focus:border-muted-foreground focus:outline-none focus:ring-inset focus:ring-muted-foreground dark:border-gray-500 dark:bg-gray-800 focus:dark:bg-transparent sm:text-sm">
<SelectValue placeholder="Select a question type" />
</SelectTrigger>
- <SelectContent>
+ <SelectContent className="flex w-full rounded-md border border-input bg-white text-foreground placeholder-muted-foreground focus:border-muted-foreground focus:outline-none focus:ring-inset focus:ring-muted-foreground dark:border-gray-500 dark:bg-gray-800 focus:dark:bg-transparent sm:text-sm">
<SelectItem value="yes-no">Yes / No</SelectItem>
</SelectContent>
</Select>
@@ -84,7 +84,7 @@ export default function QuestionSection({
<div className="w-full space-y-2">
<Label htmlFor="question">Question</Label>
<Input
- className="flex w-full rounded-md border-0 bg-background py-1.5 text-foreground shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400 sm:text-sm sm:leading-6"
+ className="focus:ring-inset"
id="question"
type="text"
name="question"
diff --git a/components/ui/select.tsx b/components/ui/select.tsx
index f65c473d..d34ce855 100644
--- a/components/ui/select.tsx
+++ b/components/ui/select.tsx
@@ -20,7 +20,7 @@ const SelectTrigger = React.forwardRef<
<SelectPrimitive.Trigger
ref={ref}
className={cn(
- "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
+ "flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
className,
)}
{...props}
diff --git a/components/ui/textarea.tsx b/components/ui/textarea.tsx
index 9f005734..64b960b1 100644
--- a/components/ui/textarea.tsx
+++ b/components/ui/textarea.tsx
@@ -10,7 +10,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
return (
<textarea
className={cn(
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background 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",
+ "flex min-h-[80px] w-full rounded-md border border-input bg-white text-foreground placeholder-muted-foreground focus:border-muted-foreground focus:outline-none focus:ring-muted-foreground dark:border-gray-500 dark:bg-gray-800 focus:dark:bg-transparent sm:text-sm",
className,
)}
ref={ref}