Feature Changes and updates

This commit is contained in:
Bel Curcio 2021-06-22 13:12:51 -03:00
parent 8b0eedcaea
commit cdee712577
8 changed files with 44 additions and 24 deletions

View File

@ -66,14 +66,20 @@ Every provider defines the features that it supports under `framework/{provider}
#### Features Available #### Features Available
The following features can be enabled or disabled. This means that the UI will remove all code related to the feature.
For example: Turning `cart` off will disable Cart capabilities.
- cart
- search
- wishlist - wishlist
- customerAuth
- customCheckout - customCheckout
#### How to turn Features on and off #### How to turn Features on and off
> NOTE: The selected provider should support the feature that you are toggling. (This means that you can't turn wishlist on if the provider doesn't support this functionality out the box) > NOTE: The selected provider should support the feature that you are toggling. (This means that you can't turn wishlist on if the provider doesn't support this functionality out the box)
- Open `commerce.config.json` - Open `commerce.config.json` from your chosen provider.
- You'll see a config file like this: - You'll see a config file like this:
```json ```json
{ {
@ -83,7 +89,7 @@ Every provider defines the features that it supports under `framework/{provider}
} }
} }
``` ```
- Turn wishlist on by setting wishlist to true. - Turn `wishlist` on by setting `wishlist` to `true`.
- Run the app and the wishlist functionality should be back on. - Run the app and the wishlist functionality should be back on.
### How to create a new provider ### How to create a new provider

View File

@ -1,6 +1,9 @@
{ {
"features": { "features": {
"cart": true,
"search": true,
"wishlist": false, "wishlist": false,
"customerAuth": false,
"customCheckout": false "customCheckout": false
} }
} }

View File

@ -1,5 +1,6 @@
.root { .root {
@apply sticky top-0 bg-primary z-40 transition-all duration-150; @apply sticky top-0 bg-primary z-40 transition-all duration-150;
min-height: 74px;
} }
.nav { .nav {

View File

@ -34,9 +34,11 @@ const Navbar: FC<NavbarProps> = ({ links }) => (
))} ))}
</nav> </nav>
</div> </div>
{process.env.COMMERCE_SEARCH_ENABLED && (
<div className="justify-center flex-1 hidden lg:flex"> <div className="justify-center flex-1 hidden lg:flex">
<Searchbar /> <Searchbar />
</div> </div>
)}
<div className="flex items-center justify-end flex-1 space-x-8"> <div className="flex items-center justify-end flex-1 space-x-8">
<UserNav /> <UserNav />
</div> </div>

View File

@ -25,10 +25,12 @@ const UserNav: FC<Props> = ({ className }) => {
return ( return (
<nav className={cn(s.root, className)}> <nav className={cn(s.root, className)}>
<ul className={s.list}> <ul className={s.list}>
{process.env.COMMERCE_CART_ENABLED && (
<li className={s.item} onClick={toggleSidebar}> <li className={s.item} onClick={toggleSidebar}>
<Bag /> <Bag />
{itemsCount > 0 && <span className={s.bagCount}>{itemsCount}</span>} {itemsCount > 0 && <span className={s.bagCount}>{itemsCount}</span>}
</li> </li>
)}
{process.env.COMMERCE_WISHLIST_ENABLED && ( {process.env.COMMERCE_WISHLIST_ENABLED && (
<li className={s.item}> <li className={s.item}>
<Link href="/wishlist"> <Link href="/wishlist">
@ -38,7 +40,7 @@ const UserNav: FC<Props> = ({ className }) => {
</Link> </Link>
</li> </li>
)} )}
{process.env.COMMERCE_CUSTOMER_ENABLED && ( {process.env.COMMERCE_CUSTOMERAUTH_ENABLED && (
<li className={s.item}> <li className={s.item}>
{customer ? ( {customer ? (
<DropdownMenu /> <DropdownMenu />

View File

@ -56,6 +56,7 @@ const ProductSidebar: FC<ProductSidebarProps> = ({ product, className }) => {
<div className="text-accent-6 pr-1 font-medium text-sm">36 reviews</div> <div className="text-accent-6 pr-1 font-medium text-sm">36 reviews</div>
</div> </div>
<div> <div>
{process.env.COMMERCE_CART_ENABLED && (
<Button <Button
aria-label="Add to Cart" aria-label="Add to Cart"
type="button" type="button"
@ -68,6 +69,7 @@ const ProductSidebar: FC<ProductSidebarProps> = ({ product, className }) => {
? 'Not Available' ? 'Not Available'
: 'Add To Cart'} : 'Add To Cart'}
</Button> </Button>
)}
</div> </div>
<div className="mt-6"> <div className="mt-6">
<Collapse title="Care"> <Collapse title="Care">

View File

@ -1,6 +1,7 @@
{ {
"provider": "bigcommerce", "provider": "bigcommerce",
"features": { "features": {
"wishlist": true "wishlist": true,
"customerAuth": true
} }
} }

View File

@ -1,6 +1,9 @@
{ {
"provider": "local", "provider": "local",
"features": { "features": {
"wishlist": false "wishlist": false,
"cart": false,
"search": false,
"customerAuth": false
} }
} }