better rendering patern

This commit is contained in:
zmeyer44 2023-10-24 16:44:46 -04:00
parent e2abb71268
commit f83f7de9b3
2 changed files with 33 additions and 18 deletions

View File

@ -22,12 +22,14 @@ import {
import dynamic from "next/dynamic";
import { useModal } from "@/app/_providers/modal/provider";
import { IconType } from "react-icons";
const ZapPickerModal = dynamic(() => import("@/components/Modals/ZapPicker"), {
ssr: false,
});
const NewEventModal = dynamic(() => import("@/components/Modals/NewEvent"), {
const AddNoteButton = dynamic(() => import("./components/AddNoteButton"), {
ssr: false,
});
type NavigationLink = {
type: "link";
href: string;
@ -209,23 +211,7 @@ export default function Sidebar() {
}
})}
<div className="center py-2 xl:justify-start">
<Button
onClick={() => modal?.show(<NewEventModal />)}
size={"icon"}
className="xl:hidden"
>
<RiAddFill className="h-6 w-6" />
</Button>
<Button
onClick={() => modal?.show(<NewEventModal />)}
size={"lg"}
className="hidden xl:flex"
>
<div className="center gap-x-1.5">
<RiAddFill className="h-6 w-6" />
<span>Add Note</span>
</div>
</Button>
<AddNoteButton />
</div>
</div>
</div>

View File

@ -0,0 +1,29 @@
import { useModal } from "@/app/_providers/modal/provider";
import { Button } from "@/components/ui/button";
import { RiAddFill } from "react-icons/ri";
import NewEventModal from "@/components/Modals/NewEvent";
export default function AddNoteButton() {
const modal = useModal();
return (
<>
<Button
onClick={() => modal?.show(<NewEventModal />)}
size={"icon"}
className="xl:hidden"
>
<RiAddFill className="h-6 w-6" />
</Button>
<Button
onClick={() => modal?.show(<NewEventModal />)}
size={"lg"}
className="hidden xl:flex"
>
<div className="center gap-x-1.5">
<RiAddFill className="h-6 w-6" />
<span>Add Note</span>
</div>
</Button>
</>
);
}