Skip to content

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

refactor: move add document button to sidebar

Marc Seitzeff599a4f073
diff --git a/components/Sidebar.tsx b/components/Sidebar.tsx
index d13190fe..e903d0cb 100644
--- a/components/Sidebar.tsx
+++ b/components/Sidebar.tsx
@@ -14,6 +14,9 @@ import SelectTeam from "./teams/select-team";
import { TeamContextType, initialState, useTeam } from "@/context/team-context";
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet";
import ProfileMenu from "./profile-menu";
+import { AddDocumentModal } from "./documents/add-document-modal";
+import { Button } from "./ui/button";
+import { PlusIcon } from "lucide-react";
export default function Sidebar() {
return (
@@ -101,7 +104,7 @@ export const SidebarComponent = ({ className }: { className?: string }) => {
return (
<aside
className={cn(
- "w-full h-screen lg:w-72 flex-shrink-0 flex-col justify-between gap-y-4 bg-gray-50 dark:bg-black px-4 lg:px-6 pt-4 lg:pt-6",
+ "w-full h-screen lg:w-72 flex-shrink-0 flex-col justify-between gap-y-6 bg-gray-50 dark:bg-black px-4 lg:px-6 pt-4 lg:pt-6",
className,
)}
>
@@ -125,7 +128,17 @@ export const SidebarComponent = ({ className }: { className?: string }) => {
setCurrentTeam={() => {}}
/>
- <section className="flex flex-1 flex-col gap-y-7">
+ <AddDocumentModal>
+ <Button
+ className="w-full text-left group flex gap-x-3 items-center justify-start px-3"
+ title="Add New Document"
+ >
+ <PlusIcon className="h-5 w-5 shrink-0" aria-hidden="true" />
+ <span>Add New Document</span>
+ </Button>
+ </AddDocumentModal>
+
+ <section className="flex flex-1 flex-col gap-y-6">
<div className="space-y-2">
{navigation.map((item) => (
<button
diff --git a/components/teams/select-team.tsx b/components/teams/select-team.tsx
index b830c5d9..4160d625 100644
--- a/components/teams/select-team.tsx
+++ b/components/teams/select-team.tsx
@@ -25,13 +25,13 @@ const SelectTeam = ({ teams, currentTeam, isLoading }: TeamContextType) => {
return (
<>
{isLoading ? (
- <div className="flex items-center gap-2 mb-6 text-sm">
+ <div className="flex items-center gap-2 text-sm">
<Loader className="animate-spin h-5 w-5" /> Loading teams...
</div>
) : (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <div className="w-full py-2 px-[10px] border rounded-md flex opacity-90 items-center justify-between mb-5 cursor-pointer hover:bg-muted duration-200">
+ <div className="w-full py-2 px-[10px] border rounded-md flex opacity-90 items-center justify-between cursor-pointer hover:bg-muted duration-200">
<div className="flex items-center space-x-2">
<Avatar className="w-[25px] h-[25px] text-[10px]">
<AvatarFallback>
diff --git a/pages/documents/index.tsx b/pages/documents/index.tsx
index 33b1083c..a6fb8935 100644
--- a/pages/documents/index.tsx
+++ b/pages/documents/index.tsx
@@ -29,7 +29,7 @@ export default function Documents() {
<AddDocumentModal>
<Button
size="icon"
- className="fixed bottom-6 right-5 z-30 sm:bottom-0 sm:right-0 sm:relative w-10 sm:w-44 h-10 sm:h-10"
+ className="fixed bottom-6 right-5 z-30 lg:hidden sm:bottom-0 sm:right-0 sm:relative w-10 sm:w-44 h-10 sm:h-10"
>
<span className="hidden sm:block">Add New Document</span>
<span className="block sm:hidden">