This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/checkout-i2' of https://github.com/woocommerce/…
…woocommerce-gutenberg-products-block into feature/checkout-i2
- Loading branch information
Showing
20 changed files
with
167 additions
and
73 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 50 additions & 0 deletions
50
...locks/cart-checkout/checkout-i2/inner-blocks/checkout-shipping-methods-block/frontend.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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; | ||
import { FormStep } from '@woocommerce/base-components/cart-checkout'; | ||
import { useCheckoutContext } from '@woocommerce/base-context'; | ||
import { useCheckoutAddress } from '@woocommerce/base-context/hooks'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Block from './block'; | ||
import attributes from './attributes'; | ||
|
||
const FrontendBlock = ( { | ||
title, | ||
description, | ||
showStepNumber, | ||
}: { | ||
title: string; | ||
description: string; | ||
requireCompanyField: boolean; | ||
requirePhoneField: boolean; | ||
showApartmentField: boolean; | ||
showCompanyField: boolean; | ||
showPhoneField: boolean; | ||
showStepNumber: boolean; | ||
} ) => { | ||
const { isProcessing: checkoutIsProcessing } = useCheckoutContext(); | ||
const { showShippingFields } = useCheckoutAddress(); | ||
|
||
if ( ! showShippingFields ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<FormStep | ||
id="shipping-option" | ||
disabled={ checkoutIsProcessing } | ||
className="wc-block-checkout__shipping-option" | ||
title={ title } | ||
description={ description } | ||
showStepNumber={ showStepNumber } | ||
> | ||
<Block /> | ||
</FormStep> | ||
); | ||
}; | ||
|
||
export default withFilteredAttributes( attributes )( FrontendBlock ); |
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
File renamed without changes.
File renamed without changes.
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
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,97 @@ | ||
// Loading skeleton. | ||
.is-loading.wp-block-woocommerce-checkout-i2 { | ||
.wp-block-woocommerce-checkout-totals-block, | ||
.wp-block-woocommerce-checkout-fields-block { | ||
> div { | ||
@include placeholder(); | ||
margin: 0 0 1.5em 0; | ||
display: none; | ||
} | ||
|
||
.wp-block-woocommerce-checkout-contact-information-block, | ||
.wp-block-woocommerce-checkout-payment-block { | ||
min-height: 10em; | ||
display: block; | ||
} | ||
.wp-block-woocommerce-checkout-shipping-address-block { | ||
min-height: 24em; | ||
display: block; | ||
} | ||
.wp-block-woocommerce-checkout-actions-block { | ||
width: 50%; | ||
min-height: 4em; | ||
margin-left: 50%; | ||
display: block; | ||
} | ||
.wp-block-woocommerce-checkout-order-summary-block { | ||
min-height: 47em; | ||
display: block; | ||
} | ||
} | ||
|
||
// @todo these styles replace the need for SidebarLayout styles. We define styles here so placeholder elements (loading state) for the checkout has the same sidebar type layout before JS loads. | ||
&.wp-block-woocommerce-checkout-i2 { | ||
display: flex; | ||
flex-wrap: wrap; | ||
margin: 0 auto $gap; | ||
position: relative; | ||
|
||
.wp-block-woocommerce-checkout-fields-block { | ||
box-sizing: border-box; | ||
margin: 0; | ||
padding-right: percentage($gap-largest / 1060px); // ~1060px is the default width of the content area in Storefront. | ||
width: 65%; | ||
} | ||
.wp-block-woocommerce-checkout-totals-block { | ||
box-sizing: border-box; | ||
margin: 0; | ||
padding-left: percentage($gap-large / 1060px); | ||
width: 35%; | ||
|
||
.wc-block-components-panel > h2 { | ||
@include font-size(regular); | ||
@include reset-box(); | ||
@include reset-typography(); | ||
.wc-block-components-panel__button { | ||
font-weight: 400; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.is-medium, | ||
.is-small, | ||
.is-mobile { | ||
&.wp-block-woocommerce-checkout-i2 { | ||
flex-direction: column; | ||
margin: 0 auto $gap; | ||
|
||
.wp-block-woocommerce-checkout-fields-block { | ||
padding: 0; | ||
width: 100%; | ||
} | ||
.wp-block-woocommerce-checkout-totals-block { | ||
padding: 0; | ||
width: 100%; | ||
} | ||
} | ||
} | ||
|
||
.is-large { | ||
.wp-block-woocommerce-checkout-totals-block { | ||
.wc-block-components-totals-item, | ||
.wc-block-components-panel { | ||
padding-left: $gap; | ||
padding-right: $gap; | ||
} | ||
} | ||
} | ||
|
||
// For Twenty Twenty we need to increase specificity a bit more. | ||
.theme-twentytwenty { | ||
.wp-block-woocommerce-checkout-totals-block .wc-block-components-panel > h2 { | ||
@include font-size(large); | ||
@include reset-box(); | ||
} | ||
} | ||
} |
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
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