Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1c2db40
Added to basket successfully
ddc22 Apr 19, 2021
b6a8f7a
Styling fixes for domains page
ddc22 Apr 20, 2021
2e2e93f
Final shopping cart designs
ddc22 Apr 21, 2021
780c59b
Add yoast plan on load
ddc22 Apr 22, 2021
a6d810b
RHide recommendation prop added
ddc22 Apr 22, 2021
a14025a
Fix max width
ddc22 Apr 22, 2021
7118ae2
Yoast feature flag cleanup
ddc22 Apr 23, 2021
5ae76c8
Complete initial mobile layout
ddc22 Apr 27, 2021
2016e99
Multiple minor fixes
ddc22 Apr 28, 2021
01d6d0d
Add translation and import fix
ddc22 Apr 28, 2021
f758fdf
Clean up css and reuse components, fix links
ddc22 Apr 29, 2021
84c064f
Show recommendation label refactor
ddc22 Apr 29, 2021
19069f0
Introduce emotion based styles
ddc22 Apr 29, 2021
065b99e
Styling fixes and css cleanup and traslation additions
ddc22 May 1, 2021
931cc96
Added rest of the text
ddc22 May 1, 2021
b2b68d8
Fix basket expanding view and other style issues
ddc22 May 2, 2021
59ffe12
Async loading domains route
ddc22 May 3, 2021
2188242
Loading indicators, add to basket on click, remove previous domain fr…
ddc22 May 3, 2021
3879ed3
Remove redundant props
ddc22 May 4, 2021
b54ca83
Simple url string
ddc22 May 4, 2021
71c3ff0
Cosmetic fixes
ddc22 May 4, 2021
f3810b6
Fixed scrollbars
ddc22 May 5, 2021
802f21d
Site preloading task complete, code redundancy fix
ddc22 May 6, 2021
fa68052
Removed cross state tree dipendency import
ddc22 May 6, 2021
3b1d448
Refactor emotion theme code, replace promise with async await, fix ro…
ddc22 May 6, 2021
44ad236
Review fixes
ddc22 May 6, 2021
b745edd
Fix type errors
ddc22 May 6, 2021
c7f5d1a
Remove unecessary url
ddc22 May 7, 2021
fe45139
Merge branch 'trunk' into add/yoast-domain-addition-step
ddc22 May 7, 2021
abcc784
Can be null
ddc22 May 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix basket expanding view and other style issues
  • Loading branch information
ddc22 committed May 6, 2021
commit b2b68d8452b9e1e88158105e564dccbe4ea2e3c5
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,23 @@ import { MobileHiddenHorizontalRule } from 'calypso/my-sites/plugins/marketplace
interface PropsForMarketplaceShoppingCart {
onAddDomainToCart: () => void;
selectedDomain: DomainSuggestions.DomainSuggestion | null;
isExpandedBasketView: boolean;
toggleExpandedBasketView: () => void;
}

const ShoppingCart = styled.div< { theme?: MarketplaceThemeType } >`
width: 100%;
background-color: var( --studio-gray-0 );
padding: 15px 25px;
height: 275px;

max-width: 611px;
@media ( ${ ( { theme } ) => theme.breakpoints.tabletDown } ) {
position: fixed;
bottom: 0;
height: auto;
max-height: 226px;
overflow-y: scroll;
-ms-overflow-style: none;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
padding: 0 35px;
}
`;

Expand Down Expand Up @@ -72,12 +70,47 @@ const ShoppingCartTotal = styled.div< { theme?: MarketplaceThemeType } >`
const FullWidthButton = styled( Button )`
justify-content: center;
width: 100%;
margin-bottom: 15px;
`;

const MarketPlaceBasketItem = styled( LineItem )`
div,
span {
font-size: 0.875rem;
}
padding: 4px 0;
`;

const MobileToggleExpandedBasket = styled.a< { theme?: MarketplaceThemeType } >`
display: none;
background-color: transparent;
border-color: transparent;
color: var( --color-accent-60 );
margin-bottom: 20px;
box-shadow: none;
cursor: pointer;
&:hover {
color: var( --color-accent-60 );
}

@media ( ${ ( { theme } ) => theme.breakpoints.tabletDown } ) {
display: block;
}
`;

const ItemContainer = styled.div< { theme?: MarketplaceThemeType } >`
margin: 8px 0;
`;

export default function MarketplaceShoppingCart(
props: PropsForMarketplaceShoppingCart
): JSX.Element {
const { onAddDomainToCart, selectedDomain } = props;
const {
onAddDomainToCart,
selectedDomain,
isExpandedBasketView,
toggleExpandedBasketView,
} = props;
const { responseCart, isLoading } = useShoppingCart();
const { products, sub_total_display } = responseCart;

Expand All @@ -89,18 +122,26 @@ export default function MarketplaceShoppingCart(
<h1>{ translate( 'Your cart' ) } </h1>
<MobileTotal>{ sub_total_display }</MobileTotal>
</ShoppingCartTitle>

<div>
{ products.map( ( product ) => {
return <LineItem key={ product.uuid } product={ product } />;
} ) }
</div>
{ isExpandedBasketView ? (
<ItemContainer>
{ products.map( ( product ) => {
return <MarketPlaceBasketItem key={ product.uuid } product={ product } />;
} ) }
{ products.map( ( product ) => {
return <MarketPlaceBasketItem key={ product.uuid } product={ product } />;
} ) }
</ItemContainer>
) : null }
<MobileHiddenHorizontalRule />
<ShoppingCartTotal>
<div>{ translate( 'Total' ) }</div>
<div>{ sub_total_display }</div>
</ShoppingCartTotal>

<MobileToggleExpandedBasket onClick={ toggleExpandedBasketView } isLink isPrimary>
{ isExpandedBasketView
? translate( 'View less details' )
: translate( 'View more details' ) }
</MobileToggleExpandedBasket>
<FullWidthButton
onClick={ onAddDomainToCart }
isBusy={ false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { DomainSuggestions } from '@automattic/data-stores';
import { ThemeProvider } from 'emotion-theming';
import styled from '@emotion/styled';
import { translate } from 'i18n-calypso';
import classnames from 'classnames';
import { isDesktop } from '@automattic/viewport';

/**
* Internal dependencies
Expand Down Expand Up @@ -73,12 +75,18 @@ function CalypsoWrappedMarketplaceDomainUpsell(): JSX.Element {
const [ selectedDomain, setDomain ] = useState< DomainSuggestions.DomainSuggestion | null >(
null
);

const [ isExpandedBasketView, setIsExpandedBasketView ] = useState( false );
const { addProductsToCart, replaceProductsInCart } = useShoppingCart();
const products = useSelector( getProductsList );
const previousPath = useSelector( getPreviousPath );
const isFetchingProducts = useSelector( isProductsListFetching );
const selectedSite = useSelector( getSelectedSite );

useEffect( () => {
setIsExpandedBasketView( isDesktop() );
}, [ setIsExpandedBasketView ] );

useEffect( () => {
//FIXME: This code segment simulates yoast premium already being added when arriving here. To be removed when plugins page is completed.
if ( ! isFetchingProducts && products[ 'yoast_premium' ] ) {
Expand Down Expand Up @@ -131,7 +139,11 @@ function CalypsoWrappedMarketplaceDomainUpsell(): JSX.Element {
tipTarget="close"
/>
</Masterbar>
<div className="marketplace-domain-upsell__root">
<div
className={ classnames( 'marketplace-domain-upsell__root', {
'expanded-basket-view': isExpandedBasketView,
} ) }
>
<div className="marketplace-domain-upsell__domain-picker-container">
<DomainPicker
header={ <MarketplaceDomainUpsellHeader /> }
Expand All @@ -147,6 +159,12 @@ function CalypsoWrappedMarketplaceDomainUpsell(): JSX.Element {
<MarketplaceShoppingCart
onAddDomainToCart={ onAddDomainToCart }
selectedDomain={ selectedDomain }
isExpandedBasketView={ isExpandedBasketView }
toggleExpandedBasketView={ () =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be just () => setIsExpandedBasketView( ! isExpandedBasketView )

isExpandedBasketView
? setIsExpandedBasketView( false )
: setIsExpandedBasketView( true )
}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@media ( max-width: 782px ) {
padding: 0;
background-color: var( --studio-white );
height: calc( 100vh - 50px );
height: 100vh;
.layout__primary {
height: 100vh;
.marketplace-domain-upsell__root {
Expand Down Expand Up @@ -33,15 +33,16 @@
grid-template-columns: 60% 40%;
grid-template-areas: 'domainpicker basket';

margin-top: 40px;
@media ( max-width: 782px ) {
grid-template-rows: 1fr 226px;
grid-template-rows: 1fr 157px;
grid-template-columns: 100%;
grid-template-areas:
'domainpicker'
'basket';

margin: calc( var( --masterbar-height ) + 30px ) 0 0;
margin: var( --masterbar-height ) 0 0;
&.expanded-basket-view {
grid-template-rows: 1fr 225px;
}
}

> div {
Expand All @@ -66,13 +67,15 @@
display: flex;
width: 100%;
justify-content: space-around;

.domain-picker {
max-width: 611px;
width: 611px;
padding: 0 20px;
}

@media ( max-width: 782px ) {
padding: 0;
padding: 30px 0 0;
overflow: scroll;
-ms-overflow-style: none;
scrollbar-width: none;
Expand All @@ -88,9 +91,12 @@
display: flex;
width: 100%;
justify-content: space-around;

height: 250px;
@media ( max-width: 782px ) {
background-color: var( --studio-gray-0 );
padding: 0;
align-items: flex-end;
height: auto;
}
}
}