4
0
forked from crowetic/commerce

Adding UI Context

This commit is contained in:
Belen Curcio
2020-09-30 15:56:32 -03:00
parent 3dc2c16cea
commit 1af9a980df
6 changed files with 40 additions and 28 deletions

View File

@@ -4,6 +4,7 @@ import s from "./Navbar.module.css";
import { Logo, Container } from "@components/ui";
import { Avatar, Searchbar } from "@components/core";
import { Heart, Bag } from "@components/icon";
import { useUI } from "@components/ui/context";
interface Props {
className?: string;
children?: any;
@@ -11,6 +12,10 @@ interface Props {
const Navbar: FunctionComponent<Props> = ({ className }) => {
const rootClassName = cn(s.root, className);
const { dispatch } = useUI();
const handleCartClick = () => dispatch("OPEN_SIDEBAR");
return (
<Container className={rootClassName}>
<Logo />
@@ -23,7 +28,7 @@ const Navbar: FunctionComponent<Props> = ({ className }) => {
</nav>
</div>
<nav className="flex flex-row items-center">
<Bag className="mr-6" />
<Bag className="mr-6" onClick={handleCartClick} />
<Heart className="mr-6" />
<Avatar />
</nav>