Skip to content

Commit

Permalink
g
Browse files Browse the repository at this point in the history
  • Loading branch information
Addy832 committed Dec 1, 2023
1 parent 8846ff8 commit 92419c2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/Mobile/HeaderMobile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ import Filter from "../Products/Filter/Filter";
import NotifyCount from "../Utilities/NotifyCount";
import ProfileList from "../Desktop/Header/ProfileList";
import SwitchLang from "../Utilities/Lang/SwitchLang";
import { getProducts } from "@/toolkit/slices/products/productsSlice";
import { useDispatch } from "react-redux";

const HeaderMobile = ({ bg = "#0F4392", title, logo = false, search }) => {
const [isLogin, setIsLogin] = useState(true);
const [isOpen, setIsOpen] = useState(false);
const [showProfileList, setShowProfileList] = useState(false);
// Profile
const dispatch = useDispatch();

const profileMenuRef = useRef();
const profileImgRef = useRef();
useEffect(() => {
localStorage.getItem("token") ? setIsLogin(true) : setIsLogin(false);
}, []);
const [uses, setuses] = useState("");

useEffect(() => {
// Handle open & close profile list
Expand All @@ -35,6 +40,10 @@ const HeaderMobile = ({ bg = "#0F4392", title, logo = false, search }) => {
}
});
}, []);
useEffect(() => {
dispatch(getProducts({ uses }));
}, [uses]);

return (
<header
className="lg:hidden py-6 rounded-b-lg"
Expand All @@ -43,7 +52,7 @@ const HeaderMobile = ({ bg = "#0F4392", title, logo = false, search }) => {
}}
>
<div className="container flex justify-between items-center">
<div style={{width:"40px"}}>
<div style={{ width: "40px" }}>
{logo ? (
<Image src={logoImg} alt="logo" priority />
) : (
Expand Down Expand Up @@ -103,7 +112,7 @@ const HeaderMobile = ({ bg = "#0F4392", title, logo = false, search }) => {
</div>
</div>
<BottomModal isOpen={isOpen} setIsOpen={setIsOpen}>
<Filter />
<Filter setuses={setuses} />
</BottomModal>
</>
)}
Expand Down

0 comments on commit 92419c2

Please sign in to comment.