From b447bbc3229141ef73617523536a929f4ef1460e Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 1 Oct 2020 10:03:06 -0300 Subject: [PATCH] UI State changes --- .../cart/CartSidebarView/CartSidebarView.tsx | 15 +++++---- components/core/Layout/Layout.tsx | 10 +++--- components/core/Navbar/Navbar.tsx | 14 ++------ components/core/UserNav/UserNav.module.css | 10 ++++++ components/core/UserNav/UserNav.tsx | 33 +++++++++++++++++++ components/core/UserNav/index.ts | 1 + components/core/index.ts | 1 + components/ui/Sidebar/Sidebar.tsx | 4 +-- 8 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 components/core/UserNav/UserNav.module.css create mode 100644 components/core/UserNav/UserNav.tsx create mode 100644 components/core/UserNav/index.ts diff --git a/components/cart/CartSidebarView/CartSidebarView.tsx b/components/cart/CartSidebarView/CartSidebarView.tsx index 6a3a8ca10..b65d9498c 100644 --- a/components/cart/CartSidebarView/CartSidebarView.tsx +++ b/components/cart/CartSidebarView/CartSidebarView.tsx @@ -1,5 +1,5 @@ import React, { FunctionComponent } from "react"; -// import s from "./CartSidebarView.module.css"; +import { UserNav } from "@components/core"; import { Button } from "@components/ui"; import { Trash, Cross } from "@components/icon"; import { useUI } from "@components/ui/context"; @@ -10,11 +10,6 @@ const CartSidebarView: FunctionComponent = () => { <>
-
-

- My Cart -

-
+
+ +
+

+ My Cart +

-
+
  • diff --git a/components/core/Layout/Layout.tsx b/components/core/Layout/Layout.tsx index aa22d3d52..fafc3b39a 100644 --- a/components/core/Layout/Layout.tsx +++ b/components/core/Layout/Layout.tsx @@ -15,19 +15,21 @@ const Layout: FunctionComponent = ({ className, children }) => { const rootClassName = cn(s.root, className); const { displaySidebar } = useUI(); return ( - +
    - -
    {children}
    + + +
    {children}
    +
    {displaySidebar && ( )} - +
    ); }; diff --git a/components/core/Navbar/Navbar.tsx b/components/core/Navbar/Navbar.tsx index bee174068..4a8c2dd7b 100644 --- a/components/core/Navbar/Navbar.tsx +++ b/components/core/Navbar/Navbar.tsx @@ -2,18 +2,14 @@ import cn from "classnames"; import React, { FunctionComponent } from "react"; 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"; +import { Searchbar } from "@components/core"; +import { UserNav } from "@components/core"; interface Props { className?: string; - children?: any; } const Navbar: FunctionComponent = ({ className }) => { const rootClassName = cn(s.root, className); - const { openSidebar } = useUI(); - return ( @@ -25,11 +21,7 @@ const Navbar: FunctionComponent = ({ className }) => { Accesories
- + ); }; diff --git a/components/core/UserNav/UserNav.module.css b/components/core/UserNav/UserNav.module.css new file mode 100644 index 000000000..3dd90ada2 --- /dev/null +++ b/components/core/UserNav/UserNav.module.css @@ -0,0 +1,10 @@ +.root { +} + +.list { + @apply flex flex-row items-center; +} + +.item { + @apply mr-6 cursor-pointer; +} diff --git a/components/core/UserNav/UserNav.tsx b/components/core/UserNav/UserNav.tsx new file mode 100644 index 000000000..dd36cb5fe --- /dev/null +++ b/components/core/UserNav/UserNav.tsx @@ -0,0 +1,33 @@ +import cn from "classnames"; +import React, { FunctionComponent } from "react"; +import s from "./UserNav.module.css"; +import { Avatar } from "@components/core"; +import { Heart, Bag } from "@components/icon"; +import { useUI } from "@components/ui/context"; + +interface Props { + className?: string; +} + +const UserNav: FunctionComponent = ({ className }) => { + const rootClassName = cn(s.root, className); + const { openSidebar } = useUI(); + + return ( + + ); +}; + +export default UserNav; diff --git a/components/core/UserNav/index.ts b/components/core/UserNav/index.ts new file mode 100644 index 000000000..68149bc0c --- /dev/null +++ b/components/core/UserNav/index.ts @@ -0,0 +1 @@ +export { default } from "./UserNav"; diff --git a/components/core/index.ts b/components/core/index.ts index 3aab7b5ca..57d076f79 100644 --- a/components/core/index.ts +++ b/components/core/index.ts @@ -4,3 +4,4 @@ export { default as Footer } from "./Footer"; export { default as Layout } from "./Layout"; export { default as Navbar } from "./Navbar"; export { default as Searchbar } from "./Searchbar"; +export { default as UserNav } from "./UserNav"; diff --git a/components/ui/Sidebar/Sidebar.tsx b/components/ui/Sidebar/Sidebar.tsx index a74da8026..081198e3f 100644 --- a/components/ui/Sidebar/Sidebar.tsx +++ b/components/ui/Sidebar/Sidebar.tsx @@ -11,12 +11,12 @@ const Sidebar: FunctionComponent = ({ className, children }) => { const rootClassName = cn(s.root, className); return (
-
+
-
{children}
+ {children}