#Having some hydration erros

5 messages ยท Page 1 of 1 (latest)

barren egret
#

imma provide the code so please have a look ๐Ÿ˜ฆ

upbeat sleetBOT
#

๐Ÿ”Ž This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

๐Ÿ•ต๏ธ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

โœ… You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

barren egret
#

"use client";
import {
Sheet,
SheetClose,
SheetContent,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet";
import { BiSolidShoppingBag } from "react-icons/bi";
import { IoCloseSharp } from "react-icons/io5";
import CartProducts from "./CartProducts";
import { useDispatch, useSelector } from "react-redux";
import { Suspense, useEffect } from "react";
import { hideLoading } from "@/app/redux/slices/cart";

const CardSheet = ({}) => {
const dispatch = useDispatch();
const { loading, cartItems } = useSelector((state: any) => state.cart);
useEffect(() => {
dispatch(hideLoading());
}, []);

#

return (
<>
<div className="leading-none absolute right-1 bottom-4 bg-red-500 rounded-full pointer-events-none">
<span className="text-md text-white">{cartItems.length}</span>
</div>
<div>
<Sheet>
<SheetTrigger>
<div className="px-2">
<BiSolidShoppingBag size={25} />
</div>
</SheetTrigger>
<SheetContent>
<SheetHeader>
<div className="flex justify-between items-center">
<SheetTitle>Your Cart</SheetTitle>
<SheetClose>
<div className="border border-dashed">
<IoCloseSharp size={25} />
</div>
</SheetClose>
</div>
</SheetHeader>
{loading ? (
<div>Loading Cart</div>
) : (
<div>
<section>
{cartItems.length > 0 ? (
<>
{cartItems.map((item, index) => (
<div key={index}>
<div>{item.color}</div>
<div>{item.qty}</div>
</div>
))}
</>
) : (
<div>Cart is empty</div>
)}
</section>
<section>{/* cart total /}</section>
<section>{/
checkout button */}</section>
</div>
)}
</SheetContent>
</Sheet>
</div>
</>
);
};

export default CardSheet;