diff --git a/components/LinkViews/Layouts/MasonryView.tsx b/components/LinkViews/Layouts/MasonryView.tsx new file mode 100644 index 0000000..743dcd4 --- /dev/null +++ b/components/LinkViews/Layouts/MasonryView.tsx @@ -0,0 +1,43 @@ +import LinkCard from "@/components/LinkViews/LinkCard"; +import { LinkIncludingShortenedCollectionAndTags } from "@/types/global"; +import { GridLoader } from "react-spinners"; +import Masonry from "react-masonry-css"; + +export default function MasonryView({ + links, + editMode, + isLoading, +}: { + links: LinkIncludingShortenedCollectionAndTags[]; + editMode?: boolean; + isLoading?: boolean; +}) { + return ( + + {links.map((e, i) => { + return ( + + ); + })} + + {isLoading && links.length > 0 && ( + + )} + + ); +} diff --git a/components/LinkViews/LinkCard.tsx b/components/LinkViews/LinkCard.tsx index 9299442..0ab4eee 100644 --- a/components/LinkViews/LinkCard.tsx +++ b/components/LinkViews/LinkCard.tsx @@ -30,6 +30,7 @@ type Props = { }; export default function LinkCard({ link, flipDropdown, editMode }: Props) { + const viewMode = localStorage.getItem("viewMode") || "card"; const { collections } = useCollectionStore(); const { account } = useAccountStore(); @@ -132,32 +133,36 @@ export default function LinkCard({ link, flipDropdown, editMode }: Props) { !editMode && window.open(generateLinkHref(link, account), "_blank") } > -
- {previewAvailable(link) ? ( - { - const target = e.target as HTMLElement; - target.style.display = "none"; - }} - /> - ) : link.preview === "unavailable" ? ( -
- ) : ( -
- )} -
- -
-
+ {viewMode === "masonry" && !previewAvailable(link) ? null : ( + <> +
+ {previewAvailable(link) ? ( + { + const target = e.target as HTMLElement; + target.style.display = "none"; + }} + /> + ) : link.preview === "unavailable" ? ( +
+ ) : ( +
+ )} +
+ +
+
-
+
+ + )}

@@ -229,7 +234,11 @@ export default function LinkCard({ link, flipDropdown, editMode }: Props) { setShowInfo(!showInfo)} linkInfo={showInfo} flipDropdown={flipDropdown} diff --git a/components/ViewDropdown.tsx b/components/ViewDropdown.tsx index 5ab821e..ec4fb8c 100644 --- a/components/ViewDropdown.tsx +++ b/components/ViewDropdown.tsx @@ -35,6 +35,17 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) { + +