improved public page [WIP]

This commit is contained in:
daniel31x13 2023-11-16 06:51:28 -05:00
parent d972ec2dab
commit 01602bafec
3 changed files with 8 additions and 13 deletions

View File

@ -6,17 +6,12 @@ import { toast } from "react-hot-toast";
type Props = { type Props = {
placeHolder?: string; placeHolder?: string;
className?: string;
}; };
export default function PublicSearchBar({ placeHolder, className }: Props) { export default function PublicSearchBar({ placeHolder }: Props) {
const router = useRouter(); const router = useRouter();
const routeQuery = router.query.q; const [searchQuery, setSearchQuery] = useState("");
const [searchQuery, setSearchQuery] = useState(
routeQuery ? decodeURIComponent(routeQuery as string) : ""
);
useEffect(() => { useEffect(() => {
console.log(router); console.log(router);

View File

@ -1,5 +1,5 @@
"use client"; "use client";
import LinkCard from "@/components/PublicPage/LinkCard"; import PublicLinkCard from "@/components/PublicPage/PublicLinkCard";
import getPublicCollectionData from "@/lib/client/getPublicCollectionData"; import getPublicCollectionData from "@/lib/client/getPublicCollectionData";
import { CollectionIncludingMembersAndLinkCount, Sort } from "@/types/global"; import { CollectionIncludingMembersAndLinkCount, Sort } from "@/types/global";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
@ -16,7 +16,7 @@ import { useTheme } from "next-themes";
import getPublicUserData from "@/lib/client/getPublicUserData"; import getPublicUserData from "@/lib/client/getPublicUserData";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import PublicSearchBar from "@/components/PublicSearchBar"; import PublicSearchBar from "@/components/PublicPage/PublicSearchBar";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faFilter, faSort } from "@fortawesome/free-solid-svg-icons"; import { faFilter, faSort } from "@fortawesome/free-solid-svg-icons";
import FilterSearchDropdown from "@/components/FilterSearchDropdown"; import FilterSearchDropdown from "@/components/FilterSearchDropdown";
@ -129,7 +129,7 @@ export default function PublicCollections() {
<p className="text-4xl font-thin mb-2 capitalize mt-10"> <p className="text-4xl font-thin mb-2 capitalize mt-10">
{collection.name} {collection.name}
</p> </p>
<div className="flex gap-2 items-center mt-8"> <div className="flex gap-2 items-center mt-8 min-w-fit">
<ToggleDarkMode className="w-8 h-8 flex" /> <ToggleDarkMode className="w-8 h-8 flex" />
<Link href="https://linkwarden.app/" target="_blank"> <Link href="https://linkwarden.app/" target="_blank">
<Image <Image
@ -157,7 +157,7 @@ export default function PublicCollections() {
defaultIndex: 0, defaultIndex: 0,
}) })
} }
className="hover:opacity-80 duration-100 flex justify-center sm:justify-end items-center w-fit cursor-pointer" className="hover:opacity-80 duration-100 flex justify-center sm:justify-end items-start w-fit cursor-pointer"
> >
{collectionOwner.id ? ( {collectionOwner.id ? (
<ProfilePhoto <ProfilePhoto
@ -181,7 +181,7 @@ export default function PublicCollections() {
.slice(0, 3)} .slice(0, 3)}
{collection?.members.length && {collection?.members.length &&
collection.members.length - 3 > 0 ? ( collection.members.length - 3 > 0 ? (
<div className="w-8 h-8 text-white flex items-center justify-center rounded-full border-2 bg-sky-600 dark:bg-sky-600 border-slate-200 dark:border-neutral-700"> <div className="w-8 h-8 min-w-[2rem] text-white text-sm flex items-center justify-center rounded-full border-2 bg-sky-600 dark:bg-sky-600 border-slate-200 dark:border-neutral-700">
+{collection?.members?.length - 3} +{collection?.members?.length - 3}
</div> </div>
) : null} ) : null}
@ -263,7 +263,7 @@ export default function PublicCollections() {
viewport={{ once: true, amount: 0.8 }} viewport={{ once: true, amount: 0.8 }}
> >
<motion.div variants={cardVariants}> <motion.div variants={cardVariants}>
<LinkCard link={e as any} count={i} /> <PublicLinkCard link={e as any} count={i} />
</motion.div> </motion.div>
</motion.div> </motion.div>
); );