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 'trunk' into add/10822-new-flow-for-product-collection
- Loading branch information
Showing
69 changed files
with
2,187 additions
and
1,139 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
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
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
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
.wc-block-components-state-input { | ||
margin-top: em($gap-large); | ||
|
||
// Fixes width in the editor. | ||
.components-flex { | ||
width: 100%; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -65,7 +65,7 @@ const defaultTemplate = [ | |
[ | ||
'woocommerce/product-new', | ||
{ | ||
columns: 3, | ||
columns: 4, | ||
rows: 1, | ||
}, | ||
], | ||
|
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,79 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { ALLOWED_COUNTRIES } from '@woocommerce/block-settings'; | ||
import type { | ||
CartShippingAddress, | ||
CartBillingAddress, | ||
} from '@woocommerce/types'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
const AddressCard = ( { | ||
address, | ||
onEdit, | ||
target, | ||
}: { | ||
address: CartShippingAddress | CartBillingAddress; | ||
onEdit: () => void; | ||
target: string; | ||
} ): JSX.Element | null => { | ||
return ( | ||
<div className="wc-block-components-address-card"> | ||
<address> | ||
<span className="wc-block-components-address-card__address-section"> | ||
{ address.first_name + ' ' + address.last_name } | ||
</span> | ||
<div className="wc-block-components-address-card__address-section"> | ||
{ [ | ||
address.address_1, | ||
address.address_2, | ||
address.city, | ||
address.state, | ||
address.postcode, | ||
ALLOWED_COUNTRIES[ address.country ] | ||
? ALLOWED_COUNTRIES[ address.country ] | ||
: address.country, | ||
] | ||
.filter( ( field ) => !! field ) | ||
.map( ( field, index ) => ( | ||
<span key={ `address-` + index }>{ field }</span> | ||
) ) } | ||
</div> | ||
{ address.phone ? ( | ||
<div | ||
key={ `address-phone` } | ||
className="wc-block-components-address-card__address-section" | ||
> | ||
{ address.phone } | ||
</div> | ||
) : ( | ||
'' | ||
) } | ||
</address> | ||
{ onEdit && ( | ||
<a | ||
role="button" | ||
href={ '#' + target } | ||
className="wc-block-components-address-card__edit" | ||
aria-label={ __( | ||
'Edit address', | ||
'woo-gutenberg-products-block' | ||
) } | ||
onClick={ ( e ) => { | ||
onEdit(); | ||
e.preventDefault(); | ||
} } | ||
> | ||
{ __( 'Edit', 'woo-gutenberg-products-block' ) } | ||
</a> | ||
) } | ||
</div> | ||
); | ||
}; | ||
|
||
export default AddressCard; |
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 @@ | ||
.wc-block-components-address-card { | ||
border: 1px solid $universal-border; | ||
@include font-size(regular); | ||
padding: $gap; | ||
margin: 0; | ||
border-radius: 4px; | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
|
||
address { | ||
margin: 0; | ||
font-style: normal; | ||
|
||
.wc-block-components-address-card__address-section { | ||
display: block; | ||
margin: 0 0 2px 0; | ||
span { | ||
display: inline-block; | ||
padding: 0 4px 0 0; | ||
&::after { | ||
content: ", "; | ||
} | ||
&:last-child::after { | ||
content: ""; | ||
} | ||
} | ||
&:last-child { | ||
margin-bottom: 0; | ||
} | ||
&:first-child { | ||
font-weight: bold; | ||
} | ||
} | ||
} | ||
} | ||
.wc-block-components-address-card__edit { | ||
margin: 0 0 0 auto; | ||
text-decoration: none; | ||
@include font-size(small); | ||
} |
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,43 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import classnames from 'classnames'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
/** | ||
* Wrapper for address fields which handles the edit/preview transition. Form fields are always rendered so that | ||
* validation can occur. | ||
*/ | ||
export const AddressWrapper = ( { | ||
isEditing = false, | ||
addressCard, | ||
addressForm, | ||
}: { | ||
isEditing: boolean; | ||
addressCard: () => JSX.Element; | ||
addressForm: () => JSX.Element; | ||
} ): JSX.Element | null => { | ||
const wrapperClasses = classnames( | ||
'wc-block-components-address-address-wrapper', | ||
{ | ||
'is-editing': isEditing, | ||
} | ||
); | ||
|
||
return ( | ||
<div className={ wrapperClasses }> | ||
<div className="wc-block-components-address-card-wrapper"> | ||
{ addressCard() } | ||
</div> | ||
<div className="wc-block-components-address-form-wrapper"> | ||
{ addressForm() } | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AddressWrapper; |
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,32 @@ | ||
.wc-block-components-address-address-wrapper { | ||
position: relative; | ||
|
||
.wc-block-components-address-card-wrapper, | ||
.wc-block-components-address-form-wrapper { | ||
transition: all 300ms ease-in-out; | ||
width: 100%; | ||
} | ||
|
||
&.is-editing { | ||
.wc-block-components-address-form-wrapper { | ||
opacity: 1; | ||
} | ||
.wc-block-components-address-card-wrapper { | ||
opacity: 0; | ||
visibility: hidden; | ||
position: absolute; | ||
top: 0; | ||
} | ||
} | ||
|
||
&:not(.is-editing) { | ||
.wc-block-components-address-form-wrapper { | ||
opacity: 0; | ||
visibility: hidden; | ||
height: 0; | ||
} | ||
.wc-block-components-address-card-wrapper { | ||
opacity: 1; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.