Skip to content

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

update design for document list

Marc Seitz9bed6d957c01
diff --git a/components/documents/document-card.tsx b/components/documents/document-card.tsx
index 0b690ae7..dd3a707c 100644
--- a/components/documents/document-card.tsx
+++ b/components/documents/document-card.tsx
@@ -5,6 +5,8 @@ import Link from "next/link";
import { DocumentWithLinksAndLinkCountAndViewCount } from "@/lib/types";
import toast from "react-hot-toast";
import Notification from "@/components/Notification";
+import Copy from "@/components/shared/icons/copy";
+import BarChart from "@/components/shared/icons/bar-chart";
export default function DocumentsCard({
document,
@@ -28,7 +30,7 @@ export default function DocumentsCard({
}
return (
- <li className="relative rounded-lg bg-gray-800 p-3 pr-1 border-0 ring-1 ring-gray-700 transition-all hover:ring-gray-600 sm:p-4 mx-5 my-2 flex justify-between items-center max-w-4xl ml-auto">
+ <li className="relative rounded-lg bg-gray-800 p-3 border-0 ring-1 ring-gray-700 transition-all hover:ring-gray-500 sm:p-4 flex justify-between items-center">
<div className="min-w-0 flex shrink items-center space-x-4">
<div className="rounded-full p-2 bg-gray-700 w-10 text-center flex justify-center items-center">
<span className="text-white whitespace-nowrap">
@@ -37,9 +39,9 @@ export default function DocumentsCard({
</div>
<div className="flex-col">
<div className="flex items-center">
- <h2 className="min-w-0 text-sm font-semibold leading-6 text-white">
+ <h2 className="min-w-0 text-sm font-semibold leading-6 text-white truncate max-w-[240px] sm:max-w-md">
<Link href={`/documents/${document.id}`}>
- <span className="truncate">{document.name}</span>
+ <span className="">{document.name}</span>
<span className="absolute inset-0" />
</Link>
</h2>
@@ -49,7 +51,6 @@ export default function DocumentsCard({
onClick={() => handleCopyToClipboard(document.links[0].id)}
title="Copy to clipboard"
>
- {/* <DocumentDuplicateIcon className="h-5 w-5 text-gray-500 group-hover:text-blue-800" aria-hidden="true" /> */}
<Copy
className="text-gray-400 group-hover:text-blue-800"
aria-hidden="true"
@@ -71,7 +72,7 @@ export default function DocumentsCard({
onClick={(e) => {
e.stopPropagation();
}}
- href={`/documents/${document.id}/stats`}
+ href={`/documents/${document.id}`}
className="flex items-center z-10 space-x-1 rounded-md bg-gray-700 px-2 py-0.5 transition-all duration-75 hover:scale-105 active:scale-100"
>
<BarChart className="h-4 w-4 text-gray-400" />
@@ -82,47 +83,4 @@ export default function DocumentsCard({
</Link>
</li>
);
-}
-
-
-function Copy({ className }: { className?: string }) {
- return (
- <svg
- width="14"
- height="14"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- shapeRendering="geometricPrecision"
- className={className}
- >
- <path d="M15.5 2H8.6c-.4 0-.8.2-1.1.5-.3.3-.5.7-.5 1.1v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8c.4 0 .8-.2 1.1-.5.3-.3.5-.7.5-1.1V6.5L15.5 2z" />
- <path d="M3 7.6v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8" />
- <path d="M15 2v5h5" />
- </svg>
- );
-}
-
-function BarChart({ className }: { className?: string }) {
- return (
- <svg
- width="14"
- height="14"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- className={className}
- shapeRendering="geometricPrecision"
- >
- <line x1="12" x2="12" y1="20" y2="10" />
- <line x1="18" x2="18" y1="20" y2="4" />
- <line x1="6" x2="6" y1="20" y2="16" />
- </svg>
- );
-}
+}
\ No newline at end of file
diff --git a/components/shared/icons/bar-chart.tsx b/components/shared/icons/bar-chart.tsx
new file mode 100644
index 00000000..94ee6ed2
--- /dev/null
+++ b/components/shared/icons/bar-chart.tsx
@@ -0,0 +1,20 @@
+export default function BarChart({ className }: { className?: string }) {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ className={className}
+ shapeRendering="geometricPrecision"
+ >
+ <line x1="12" x2="12" y1="20" y2="10" />
+ <line x1="18" x2="18" y1="20" y2="4" />
+ <line x1="6" x2="6" y1="20" y2="16" />
+ </svg>
+ );
+}
diff --git a/components/shared/icons/copy.tsx b/components/shared/icons/copy.tsx
new file mode 100644
index 00000000..18da2d05
--- /dev/null
+++ b/components/shared/icons/copy.tsx
@@ -0,0 +1,20 @@
+export default function Copy({ className }: { className?: string }) {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ shapeRendering="geometricPrecision"
+ className={className}
+ >
+ <path d="M15.5 2H8.6c-.4 0-.8.2-1.1.5-.3.3-.5.7-.5 1.1v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8c.4 0 .8-.2 1.1-.5.3-.3.5-.7.5-1.1V6.5L15.5 2z" />
+ <path d="M3 7.6v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8" />
+ <path d="M15 2v5h5" />
+ </svg>
+ );
+}
diff --git a/components/ui/separator.tsx b/components/ui/separator.tsx
new file mode 100644
index 00000000..5b6774dc
--- /dev/null
+++ b/components/ui/separator.tsx
@@ -0,0 +1,31 @@
+"use client";
+
+import * as React from "react";
+import * as SeparatorPrimitive from "@radix-ui/react-separator";
+
+import { cn } from "@/lib/utils";
+
+const Separator = React.forwardRef<
+ React.ElementRef<typeof SeparatorPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
+>(
+ (
+ { className, orientation = "horizontal", decorative = true, ...props },
+ ref
+ ) => (
+ <SeparatorPrimitive.Root
+ ref={ref}
+ decorative={decorative}
+ orientation={orientation}
+ className={cn(
+ "shrink-0 bg-border",
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
+ className
+ )}
+ {...props}
+ />
+ )
+);
+Separator.displayName = SeparatorPrimitive.Root.displayName;
+
+export { Separator };
diff --git a/package-lock.json b/package-lock.json
index 571e3648..ea62a366 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,6 +15,7 @@
"@next-auth/prisma-adapter": "^1.0.6",
"@prisma/client": "^4.15.0",
"@radix-ui/react-dialog": "^1.0.4",
+ "@radix-ui/react-separator": "^1.0.3",
"@react-email/components": "^0.0.6",
"@tremor/react": "^3.4.1",
"@types/node": "20.2.5",
@@ -1549,6 +1550,29 @@
}
}
},
+ "node_modules/@radix-ui/react-separator": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.0.3.tgz",
+ "integrity": "sha512-itYmTy/kokS21aiV5+Z56MZB54KrhPgn6eHDKkFeOLR34HMN2s8PaN47qZZAGnvupcjxHaFZnW4pQEh0BvvVuw==",
+ "dependencies": {
+ "@babel/runtime": "^7.13.10",
+ "@radix-ui/react-primitive": "1.0.3"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0",
+ "react-dom": "^16.8 || ^17.0 || ^18.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-slot": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz",
@@ -9857,6 +9881,15 @@
"@radix-ui/react-slot": "1.0.2"
}
},
+ "@radix-ui/react-separator": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.0.3.tgz",
+ "integrity": "sha512-itYmTy/kokS21aiV5+Z56MZB54KrhPgn6eHDKkFeOLR34HMN2s8PaN47qZZAGnvupcjxHaFZnW4pQEh0BvvVuw==",
+ "requires": {
+ "@babel/runtime": "^7.13.10",
+ "@radix-ui/react-primitive": "1.0.3"
+ }
+ },
"@radix-ui/react-slot": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz",
diff --git a/package.json b/package.json
index 19b32fe1..884c93ba 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
"@next-auth/prisma-adapter": "^1.0.6",
"@prisma/client": "^4.15.0",
"@radix-ui/react-dialog": "^1.0.4",
+ "@radix-ui/react-separator": "^1.0.3",
"@react-email/components": "^0.0.6",
"@tremor/react": "^3.4.1",
"@types/node": "20.2.5",
diff --git a/pages/documents/index.tsx b/pages/documents/index.tsx
index ed8a9d5b..893bd9cd 100644
--- a/pages/documents/index.tsx
+++ b/pages/documents/index.tsx
@@ -5,66 +5,61 @@ import Skeleton from "@/components/Skeleton";
import { PlusIcon } from "@heroicons/react/24/solid";
import Link from "next/link";
import { AddDocumentModal } from "@/components/documents/add-document-modal";
+import { Separator } from "@/components/ui/separator";
+import AppLayout from "@/components/layouts/app"
+
export default function Documents() {
const { documents } = useDocuments();
return (
- <>
- <div className="flex flex-col lg:flex-row min-h-screen bg-gradient-to-tl from-black to-gray-950">
- <Sidebar></Sidebar>
- <main className="lg:m-2 grow w-full bg-gray-900 shadow rounded-xl">
- <div className="border-b border-white/5 px-4 py-5 sm:px-6 lg:px-8">
- <div className="-ml-4 -mt-2 flex flex-wrap items-center justify-between sm:flex-nowrap">
- <div className="ml-4 mt-2">
- <h3 className="text-base font-semibold leading-6 text-white">
- My Documents
- </h3>
- </div>
- {documents && documents.length !== 0 && (
- <div className="ml-4 mt-2 flex-shrink-0">
- <AddDocumentModal>
- <button
- type="button"
- className="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
- >
- <PlusIcon
- className="-ml-1 mr-2 h-5 w-5"
- aria-hidden="true"
- />
- New Document
- </button>
- </AddDocumentModal>
- </div>
- )}
- </div>
+ <AppLayout>
+ <div className="p-4 sm:p-4 sm:m-4">
+ <div className="flex items-center justify-between mb-4 md:mb-8 lg:mb-12">
+ <div className="space-y-1">
+ <h2 className="text-2xl text-white font-semibold tracking-tight">
+ Documents
+ </h2>
+ <p className="text-sm text-gray-400">Manage your documents</p>
</div>
+ <ul className="flex items-center justify-between gap-4">
+ <AddDocumentModal>
+ <button
+ type="button"
+ className="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-gray-950 bg-gray-300 hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"
+ >
+ Add New Document
+ </button>
+ </AddDocumentModal>
+ </ul>
+ </div>
- {documents && documents.length === 0 && (
- <div className="flex items-center justify-center h-96">
- <EmptyDocuments />
- </div>
- )}
+ <Separator className="my-6 bg-gray-700" />
- {/* Documents list */}
- <ul role="list" className="divide-y divide-white/5 overflow-y-hidden">
- {documents
- ? documents.map((document) => {
- return <DocumentCard key={document.id} document={document} />;
- })
- : Array.from({ length: 3 }).map((_, i) => (
- <li
- key={i}
- className="flex flex-col space-y-4 px-4 py-4 sm:px-6 lg:px-8"
- >
- <Skeleton key={i} className="h-5 w-20" />
- <Skeleton key={i} className="mt-3 h-3 w-10" />
- </li>
- ))}
- </ul>
- </main>
+ {documents && documents.length === 0 && (
+ <div className="flex items-center justify-center h-96">
+ <EmptyDocuments />
+ </div>
+ )}
+
+ {/* Documents list */}
+ <ul role="list" className="space-y-4">
+ {documents
+ ? documents.map((document) => {
+ return <DocumentCard key={document.id} document={document} />;
+ })
+ : Array.from({ length: 3 }).map((_, i) => (
+ <li
+ key={i}
+ className="flex flex-col space-y-4 px-4 py-4 sm:px-6 lg:px-8"
+ >
+ <Skeleton key={i} className="h-5 w-20" />
+ <Skeleton key={i} className="mt-3 h-3 w-10" />
+ </li>
+ ))}
+ </ul>
</div>
- </>
+ </AppLayout>
);
}