4
0
forked from crowetic/commerce

More changes for wishlist config

This commit is contained in:
Luis Alvarez 2021-02-23 13:21:25 -05:00
parent 67d05ea165
commit 412f268148
5 changed files with 8 additions and 13 deletions

View File

@ -9,7 +9,7 @@ import usePrice from '@framework/product/use-price'
import CartItem from '../CartItem'
import s from './CartSidebarView.module.css'
const CartSidebarView: FC<{ wishlist?: boolean }> = ({ wishlist }) => {
const CartSidebarView: FC = () => {
const { closeSidebar } = useUI()
const { data, isLoading, isEmpty } = useCart()
@ -48,7 +48,7 @@ const CartSidebarView: FC<{ wishlist?: boolean }> = ({ wishlist }) => {
</button>
</div>
<div className="space-y-1">
<UserNav wishlist={wishlist} />
<UserNav />
</div>
</div>
</header>

View File

@ -5,20 +5,17 @@ import { Grid } from '@components/ui'
import { ProductCard } from '@components/product'
import s from './HomeAllProductsGrid.module.css'
import { getCategoryPath, getDesignerPath } from '@lib/search'
import wishlist from '@framework/api/wishlist'
interface Props {
categories?: any
brands?: any
products?: Product[]
wishlist?: boolean
}
const HomeAllProductsGrid: FC<Props> = ({
categories,
brands,
products = [],
wishlist = false,
}) => {
return (
<div className={s.root}>
@ -65,7 +62,6 @@ const HomeAllProductsGrid: FC<Props> = ({
width: 480,
height: 480,
}}
wishlist={wishlist}
/>
))}
</Grid>

View File

@ -61,7 +61,7 @@ const Layout: FC<Props> = ({
return (
<CommerceProvider locale={locale}>
<div className={cn(s.root)}>
<Navbar wishlist={!!process.env.WISHLIST_ENABLED} />
<Navbar />
<main className="fit">{children}</main>
<Footer pages={pageProps.pages} />
@ -72,7 +72,7 @@ const Layout: FC<Props> = ({
</Modal>
<Sidebar open={displaySidebar} onClose={closeSidebar}>
<CartSidebarView wishlist={!!process.env.WISHLIST_ENABLED} />
<CartSidebarView />
</Sidebar>
<FeatureBar

View File

@ -5,7 +5,7 @@ import { Searchbar, UserNav } from '@components/common'
import NavbarRoot from './NavbarRoot'
import s from './Navbar.module.css'
const Navbar: FC<{ wishlist?: boolean }> = ({ wishlist }) => (
const Navbar: FC = () => (
<NavbarRoot>
<Container>
<div className="relative flex flex-row justify-between py-4 align-center md:py-6">
@ -33,7 +33,7 @@ const Navbar: FC<{ wishlist?: boolean }> = ({ wishlist }) => (
</div>
<div className="flex justify-end flex-1 space-x-8">
<UserNav wishlist={wishlist} />
<UserNav />
</div>
</div>

View File

@ -12,12 +12,11 @@ import { Avatar } from '@components/common'
interface Props {
className?: string
wishlist?: boolean
}
const countItem = (count: number, item: LineItem) => count + item.quantity
const UserNav: FC<Props> = ({ className, wishlist = false }) => {
const UserNav: FC<Props> = ({ className }) => {
const { data } = useCart()
const { data: customer } = useCustomer()
const { toggleSidebar, closeSidebarIfPresent, openModal } = useUI()
@ -31,7 +30,7 @@ const UserNav: FC<Props> = ({ className, wishlist = false }) => {
<Bag />
{itemsCount > 0 && <span className={s.bagCount}>{itemsCount}</span>}
</li>
{wishlist && (
{process.env.WISHLIST_ENABLED && (
<li className={s.item}>
<Link href="/wishlist">
<a onClick={closeSidebarIfPresent} aria-label="Wishlist">