-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy styling from Marketplace hosting page to the products overview v…
…2 page.
- Loading branch information
1 parent
3d707e3
commit 92cc682
Showing
3 changed files
with
169 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 121 additions & 2 deletions
123
client/a8c-for-agencies/sections/marketplace/products-overview-v2/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,122 @@ | ||
export default function ProductsOverviewV2() { | ||
return <div>Products Overview V2</div>; | ||
import page from '@automattic/calypso-router'; | ||
import { SiteDetails } from '@automattic/data-stores'; | ||
import { useBreakpoint } from '@automattic/viewport-react'; | ||
import { useTranslate } from 'i18n-calypso'; | ||
import { useEffect, useState } from 'react'; | ||
import A4AAgencyApprovalNotice from 'calypso/a8c-for-agencies/components/a4a-agency-approval-notice'; | ||
import { LayoutWithGuidedTour as Layout } from 'calypso/a8c-for-agencies/components/layout/layout-with-guided-tour'; | ||
import LayoutTop from 'calypso/a8c-for-agencies/components/layout/layout-with-payment-notification'; | ||
import MobileSidebarNavigation from 'calypso/a8c-for-agencies/components/sidebar/mobile-sidebar-navigation'; | ||
import { | ||
A4A_MARKETPLACE_CHECKOUT_LINK, | ||
A4A_MARKETPLACE_LINK, | ||
} from 'calypso/a8c-for-agencies/components/sidebar-menu/lib/constants'; | ||
import LayoutBody from 'calypso/layout/hosting-dashboard/body'; | ||
import LayoutHeader, { | ||
LayoutHeaderActions as Actions, | ||
LayoutHeaderBreadcrumb as Breadcrumb, | ||
} from 'calypso/layout/hosting-dashboard/header'; | ||
import { useSelector } from 'calypso/state'; | ||
import getSites from 'calypso/state/selectors/get-sites'; | ||
import ReferralToggle from '../common/referral-toggle'; | ||
import { ShoppingCartContext } from '../context'; | ||
import withMarketplaceType from '../hoc/with-marketplace-type'; | ||
import useShoppingCart from '../hooks/use-shopping-cart'; | ||
import ProductListing from '../products-overview/product-listing'; | ||
import ShoppingCart from '../shopping-cart'; | ||
|
||
import './style.scss'; | ||
|
||
type Props = { | ||
siteId?: string; | ||
suggestedProduct?: string; | ||
productBrand: string; | ||
searchQuery?: string; | ||
}; | ||
|
||
export function ProductsOverviewV2( { | ||
siteId, | ||
suggestedProduct, | ||
productBrand, | ||
searchQuery, | ||
}: Props ) { | ||
const [ selectedSite, setSelectedSite ] = useState< SiteDetails | null | undefined >( null ); | ||
|
||
const translate = useTranslate(); | ||
|
||
const isNarrowView = useBreakpoint( '<660px' ); | ||
|
||
const sites = useSelector( getSites ); | ||
|
||
const { | ||
selectedCartItems, | ||
setSelectedCartItems, | ||
onRemoveCartItem, | ||
showCart, | ||
setShowCart, | ||
toggleCart, | ||
} = useShoppingCart(); | ||
|
||
useEffect( () => { | ||
if ( siteId && sites.length > 0 ) { | ||
const site = siteId ? sites.find( ( site ) => site?.ID === parseInt( siteId ) ) : null; | ||
setSelectedSite( site ); | ||
} | ||
}, [ siteId, sites ] ); | ||
|
||
return ( | ||
<Layout | ||
className="products-overview-v2" | ||
title={ isNarrowView ? '' : translate( 'Products Marketplace' ) } | ||
wide | ||
> | ||
<LayoutTop> | ||
<A4AAgencyApprovalNotice /> | ||
<LayoutHeader> | ||
<Breadcrumb | ||
items={ [ | ||
{ | ||
label: translate( 'Marketplace' ), | ||
href: A4A_MARKETPLACE_LINK, | ||
}, | ||
{ | ||
label: translate( 'Products' ), | ||
}, | ||
] } | ||
/> | ||
|
||
<Actions> | ||
<MobileSidebarNavigation /> | ||
<ReferralToggle /> | ||
<ShoppingCart | ||
showCart={ showCart } | ||
setShowCart={ setShowCart } | ||
toggleCart={ toggleCart } | ||
items={ selectedCartItems } | ||
onRemoveItem={ onRemoveCartItem } | ||
onCheckout={ () => { | ||
page( A4A_MARKETPLACE_CHECKOUT_LINK ); | ||
} } | ||
/> | ||
</Actions> | ||
</LayoutHeader> | ||
</LayoutTop> | ||
|
||
<LayoutBody className="products-overview-v2__body"> | ||
<ShoppingCartContext.Provider value={ { setSelectedCartItems, selectedCartItems } }> | ||
{ | ||
// we will remove this once we have the new product listing component | ||
<ProductListing | ||
selectedSite={ selectedSite } | ||
suggestedProduct={ suggestedProduct } | ||
productBrand={ productBrand } | ||
searchQuery={ searchQuery } | ||
/> | ||
} | ||
</ShoppingCartContext.Provider> | ||
</LayoutBody> | ||
</Layout> | ||
); | ||
} | ||
|
||
export default withMarketplaceType( ProductsOverviewV2 ); |
41 changes: 41 additions & 0 deletions
41
client/a8c-for-agencies/sections/marketplace/products-overview-v2/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
$background-color: #05374A; | ||
|
||
.products-overview-v2.main.hosting-dashboard-layout { | ||
.hosting-dashboard-layout__container { | ||
height: auto; | ||
overflow: auto; | ||
display: block; | ||
} | ||
|
||
.hosting-dashboard-layout__top-wrapper { | ||
max-height: auto; | ||
background: url( calypso/assets/images/a8c-for-agencies/marketplace-hosting-page-v3-bg.svg ) no-repeat top right $background-color; | ||
border-block-end: none; | ||
position: sticky; | ||
top: 0; | ||
z-index: 100; | ||
} | ||
|
||
.hosting-dashboard-layout__header-breadcrumb { | ||
color: var(--color-neutral-40); | ||
fill: var(--color-neutral-40); | ||
|
||
a { | ||
color: var(--color-primary-5); | ||
} | ||
} | ||
|
||
.hosting-dashboard-layout__header-actions { | ||
background-color: var(--color-surface); | ||
border-radius: 8px; /* stylelint-disable-line */ | ||
padding: 8px 16px; | ||
|
||
.shopping-cart { | ||
margin: 0; | ||
} | ||
} | ||
|
||
.components-button:is(.is-primary, .is-secondary) { | ||
min-height: 40px; | ||
} | ||
} |