From 5c59c86d55df91834e6e229c9fc8556f05b5cc68 Mon Sep 17 00:00:00 2001 From: Chloe Date: Tue, 16 Apr 2024 14:56:05 +0700 Subject: [PATCH] feat: implement profile popover Signed-off-by: Chloe --- components/banner.tsx | 2 +- components/cart/modal.tsx | 2 +- components/cart/open-cart.tsx | 4 +- components/layout/navbar/index.tsx | 7 +++- components/profile/index.tsx | 10 +++++ components/profile/open-profile.tsx | 7 ++++ components/profile/popover.tsx | 58 +++++++++++++++++++++++++++++ tailwind.config.js | 5 +++ 8 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 components/profile/index.tsx create mode 100644 components/profile/open-profile.tsx create mode 100644 components/profile/popover.tsx diff --git a/components/banner.tsx b/components/banner.tsx index cacbacad7..6c6ef1cbe 100644 --- a/components/banner.tsx +++ b/components/banner.tsx @@ -3,7 +3,7 @@ import Tooltip from './tooltip'; function Banner() { return ( -
+
Speak to a Specialist Now:{' '} diff --git a/components/cart/modal.tsx b/components/cart/modal.tsx index a30818940..8a414afd3 100644 --- a/components/cart/modal.tsx +++ b/components/cart/modal.tsx @@ -42,7 +42,7 @@ export default function CartModal({ cart }: { cart: Cart | undefined }) { - + +
{quantity ? ( diff --git a/components/layout/navbar/index.tsx b/components/layout/navbar/index.tsx index 50c87917c..ec761f720 100644 --- a/components/layout/navbar/index.tsx +++ b/components/layout/navbar/index.tsx @@ -1,6 +1,8 @@ import Cart from 'components/cart'; import OpenCart from 'components/cart/open-cart'; import LogoSquare from 'components/logo-square'; +import Profile from 'components/profile'; +import OpenProfile from 'components/profile/open-profile'; import { getMenu } from 'lib/shopify'; import { Menu } from 'lib/shopify/types'; import Link from 'next/link'; @@ -37,7 +39,10 @@ export default async function Navbar() {
-
+
+ }> + + }> diff --git a/components/profile/index.tsx b/components/profile/index.tsx new file mode 100644 index 000000000..69e53dbab --- /dev/null +++ b/components/profile/index.tsx @@ -0,0 +1,10 @@ +import { getMenu } from 'lib/shopify'; +import ProfilePopover from './popover'; + +const Profile = async () => { + const menu = await getMenu('profile-menu'); + + return ; +}; + +export default Profile; diff --git a/components/profile/open-profile.tsx b/components/profile/open-profile.tsx new file mode 100644 index 000000000..85dbcb87f --- /dev/null +++ b/components/profile/open-profile.tsx @@ -0,0 +1,7 @@ +import { UserIcon } from '@heroicons/react/24/outline'; + +const OpenProfile = () => { + return ; +}; + +export default OpenProfile; diff --git a/components/profile/popover.tsx b/components/profile/popover.tsx new file mode 100644 index 000000000..04062caf6 --- /dev/null +++ b/components/profile/popover.tsx @@ -0,0 +1,58 @@ +'use client'; + +import { Popover, Transition } from '@headlessui/react'; +import { ArrowRightIcon } from '@heroicons/react/16/solid'; +import { Menu } from 'lib/shopify/types'; +import { Fragment } from 'react'; +import OpenProfile from './open-profile'; + +type ProfilePopoverProps = { + menu: Menu[]; +}; + +const ProfilePopover = ({ menu }: ProfilePopoverProps) => { + return ( + + + + + + +
+ My Account + + Sign in + + {menu.length ? ( + + ) : null} +
+ + + + ); +}; + +export default ProfilePopover; diff --git a/tailwind.config.js b/tailwind.config.js index eaf8db155..442e78a08 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -5,6 +5,11 @@ module.exports = { content: ['./app/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], theme: { extend: { + colors: { + primary: '#17E4BB', + dark: '#08312B', + secondary: '#12baa9' + }, fontFamily: { sans: ['var(--font-geist-sans)'] },