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' of github.com:woocommerce/woocommerce-blocks int…
…o fix/animation-dialog
- Loading branch information
Showing
45 changed files
with
1,563 additions
and
981 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
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,41 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { CSSTransition, TransitionGroup } from 'react-transition-group'; | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
export const AddressWrapper = ( { | ||
isEditing = false, | ||
addressCard, | ||
addressForm, | ||
}: { | ||
isEditing: boolean; | ||
addressCard: () => JSX.Element; | ||
addressForm: () => JSX.Element; | ||
} ): JSX.Element | null => { | ||
return ( | ||
<TransitionGroup className="address-fade-transition-wrapper"> | ||
{ ! isEditing && ( | ||
<CSSTransition | ||
timeout={ 300 } | ||
classNames="address-fade-transition" | ||
> | ||
{ addressCard() } | ||
</CSSTransition> | ||
) } | ||
{ isEditing && ( | ||
<CSSTransition | ||
timeout={ 300 } | ||
classNames="address-fade-transition" | ||
> | ||
{ addressForm() } | ||
</CSSTransition> | ||
) } | ||
</TransitionGroup> | ||
); | ||
}; | ||
|
||
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,25 @@ | ||
.address-fade-transition-wrapper { | ||
position: relative; | ||
} | ||
.address-fade-transition-enter { | ||
opacity: 0; | ||
} | ||
.address-fade-transition-enter-active { | ||
opacity: 1; | ||
transition: opacity 300ms ease-in; | ||
} | ||
.address-fade-transition-enter-done { | ||
opacity: 1; | ||
} | ||
.address-fade-transition-exit { | ||
opacity: 1; | ||
position: absolute; | ||
top: 0; | ||
} | ||
.address-fade-transition-exit-active { | ||
opacity: 0; | ||
transition: opacity 300ms ease-out; | ||
} | ||
.address-fade-transition-done { | ||
opacity: 0; | ||
} |
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.