Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix: show proper pdf icon if light mode
Marc Seitz77699f3404c5
diff --git a/components/documents/document-card.tsx b/components/documents/document-card.tsxindex 1f2ddd0c..f6308155 100644--- a/components/documents/document-card.tsx+++ b/components/documents/document-card.tsx@@ -21,6 +21,7 @@ import { useCopyToClipboard } from "@/lib/utils/use-copy-to-clipboard";import Check from "@/components/shared/icons/check";import Copy from "@/components/shared/icons/copy";import { useEffect, useRef, useState } from "react";+import { useTheme } from "next-themes";type DocumentsCardProps = {document: DocumentWithLinksAndLinkCountAndViewCount;@@ -30,6 +31,10 @@ export default function DocumentsCard({document: prismaDocument,teamInfo,}: DocumentsCardProps) {+ const { theme, systemTheme } = useTheme();+ const isLight =+ theme === "light" || (theme === "system" && systemTheme === "light");+const { isCopied, copyToClipboard } = useCopyToClipboard({});const [isFirstClick, setIsFirstClick] = useState<boolean>(false);const [menuOpen, setMenuOpen] = useState<boolean>(false);@@ -121,11 +126,10 @@ export default function DocumentsCard({<NotionIcon className="w-8 h-8" />) : (<Image- src={`/_icons/${prismaDocument.type}.svg`}+ src={`/_icons/${prismaDocument.type}${isLight ? "-light" : ""}.svg`}alt="File icon"width={50}height={50}- className={`${prismaDocument.type === 'pdf' && "bg-black dark:bg-transparent"}`}/>)}</div>diff --git a/pages/documents/[id]/index.tsx b/pages/documents/[id]/index.tsxindex b19fa774..1b2d380c 100644--- a/pages/documents/[id]/index.tsx+++ b/pages/documents/[id]/index.tsx@@ -33,9 +33,14 @@ import { TrashIcon, Sparkles } from "lucide-react";import { StatsComponent } from "@/components/documents/stats";import { Switch } from "@/components/ui/switch";import { Label } from "@/components/ui/label";+import { useTheme } from "next-themes";export default function DocumentPage() {const { document: prismaDocument, primaryVersion, error } = useDocument();+ const { theme, systemTheme } = useTheme();+ const isLight =+ theme === "light" || (theme === "system" && systemTheme === "light");+const router = useRouter();const [isLinkSheetOpen, setIsLinkSheetOpen] = useState<boolean>(false);@@ -241,7 +246,7 @@ export default function DocumentPage() {) : (<div className="w-[25px] lg:w-[32px] h-[25px] lg:h-[32px]"><Image- src={`/_icons/${getExtension(primaryVersion.file)}.svg`}+ src={`/_icons/${getExtension(primaryVersion.file)}${isLight ? "-light" : ""}.svg`}alt="File icon"width={50}height={50}diff --git a/public/_icons/pdf-light.svg b/public/_icons/pdf-light.svgnew file mode 100644index 00000000..f528c2a8--- /dev/null+++ b/public/_icons/pdf-light.svg@@ -0,0 +1,6 @@+<svg width="171" height="200" viewBox="0 0 171 200" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M168.03 38.4L132.494 2.96C130.58 1.05111 128.036 0 125.328 0H30.4775C24.8892 0 20.3436 4.53333 20.3436 10.1067V92.5778H9.53008C4.27595 92.5778 0 96.7422 0 101.86V158.373C0 163.493 4.27595 167.658 9.53008 167.658H20.3436V189.893C20.3436 195.467 24.8892 200 30.4775 200H160.866C166.454 200 171 195.467 171 189.893V45.5467C170.998 42.8467 169.944 40.3111 168.03 38.4ZM131.485 11.38L159.587 39.4067H134.33C132.762 39.4067 131.485 38.1333 131.485 36.5689V11.38ZM6.68465 158.376V101.86C6.68465 100.418 7.96142 99.2444 9.53008 99.2444H128.332C129.901 99.2444 131.177 100.418 131.177 101.86V158.373C131.177 159.816 129.901 160.991 128.332 160.991H9.53008C7.96142 160.991 6.68465 159.818 6.68465 158.376ZM160.864 193.333H30.4775C28.5746 193.333 27.0283 191.791 27.0283 189.893V167.658H128.334C133.588 167.658 137.864 163.493 137.864 158.373V101.86C137.864 96.7422 133.588 92.5778 128.334 92.5778H27.0283V10.1067C27.0283 8.20889 28.5746 6.66667 30.4775 6.66667H124.8V36.5689C124.8 41.8089 129.076 46.0733 134.33 46.0733H164.313V189.893C164.313 191.791 162.767 193.333 160.864 193.333Z" fill="black"/>+<path d="M13.7926 152V108.364H31.0085C34.3182 108.364 37.1378 108.996 39.4673 110.26C41.7969 111.51 43.5724 113.25 44.794 115.48C46.0298 117.696 46.6477 120.253 46.6477 123.151C46.6477 126.048 46.0227 128.605 44.7727 130.821C43.5227 133.037 41.7117 134.763 39.3395 135.999C36.9815 137.234 34.1264 137.852 30.7742 137.852H19.8011V130.459H29.2827C31.0582 130.459 32.5213 130.153 33.6719 129.543C34.8367 128.918 35.7031 128.058 36.2713 126.965C36.8537 125.857 37.1449 124.585 37.1449 123.151C37.1449 121.702 36.8537 120.438 36.2713 119.358C35.7031 118.264 34.8367 117.419 33.6719 116.822C32.5071 116.212 31.0298 115.906 29.2401 115.906H23.0185V152H13.7926Z" fill="black"/>+<path d="M68.109 152H52.6403V108.364H68.2369C72.6261 108.364 76.4045 109.237 79.5721 110.984C82.7397 112.717 85.1758 115.21 86.8803 118.463C88.5991 121.716 89.4585 125.608 89.4585 130.139C89.4585 134.685 88.5991 138.591 86.8803 141.858C85.1758 145.125 82.7255 147.632 79.5295 149.379C76.3477 151.126 72.5408 152 68.109 152ZM61.8661 144.095H67.7255C70.4528 144.095 72.7468 143.612 74.6076 142.646C76.4826 141.666 77.8889 140.153 78.8264 138.108C79.7781 136.048 80.2539 133.392 80.2539 130.139C80.2539 126.915 79.7781 124.28 78.8264 122.234C77.8889 120.189 76.4897 118.683 74.6289 117.717C72.7681 116.751 70.4741 116.268 67.7468 116.268H61.8661V144.095Z" fill="black"/>+<path d="M96.2926 152V108.364H125.185V115.97H105.518V126.368H123.267V133.974H105.518V152H96.2926Z" fill="black"/>+</svg>