-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Saleor 2798 user addresses selection for draft order (#1082)
* Create user addresses select modal * Prepare user addresses select modal form * Add user addresses select modal to order draft details page * Update draft order validation of adresses in edit modal * Add Customer Change modal * Update snapshots and messages * Indication of address form errors by address type * Refactor addresses submiting * Refactor address transform functions * Add data-testids to addresses change dialog * Update customer address choice style * Trigger CI * Update customer addresses edit flow * Move styles outside of component files * Refactor after review * Refactor after review * Do not update customer if the same selected * Handle setting adress after edit customer with no addresses * Trigger CI
- Loading branch information
Showing
104 changed files
with
1,373 additions
and
160 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
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
34 changes: 34 additions & 0 deletions
34
src/customers/components/CustomerAddressChoiceCard/CustomerAddressChoiceCard.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,34 @@ | ||
import Card from "@material-ui/core/Card"; | ||
import CardContent from "@material-ui/core/CardContent"; | ||
import AddressFormatter from "@saleor/components/AddressFormatter"; | ||
import classNames from "classnames"; | ||
import React from "react"; | ||
|
||
import { CustomerAddresses_user_addresses } from "../../types/CustomerAddresses"; | ||
import { useStyles } from "./styles"; | ||
|
||
export interface CustomerAddressChoiceCardProps { | ||
address: CustomerAddresses_user_addresses; | ||
selected: boolean; | ||
onSelect: () => void; | ||
} | ||
|
||
const CustomerAddressChoiceCard: React.FC<CustomerAddressChoiceCardProps> = props => { | ||
const { address, selected, onSelect } = props; | ||
const classes = useStyles(props); | ||
|
||
return ( | ||
<Card | ||
className={classNames(classes.card, { | ||
[classes.cardSelected]: selected | ||
})} | ||
onClick={onSelect} | ||
> | ||
<CardContent> | ||
<AddressFormatter address={address} /> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; | ||
CustomerAddressChoiceCard.displayName = "CustomerAddressChoiceCard"; | ||
export default CustomerAddressChoiceCard; |
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,2 @@ | ||
export { default } from "./CustomerAddressChoiceCard"; | ||
export * from "./CustomerAddressChoiceCard"; |
16 changes: 16 additions & 0 deletions
16
src/customers/components/CustomerAddressChoiceCard/styles.ts
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,16 @@ | ||
import { makeStyles } from "@saleor/theme"; | ||
|
||
export const useStyles = makeStyles( | ||
theme => ({ | ||
card: { | ||
cursor: "pointer", | ||
padding: "1px" | ||
}, | ||
cardSelected: { | ||
borderColor: theme.palette.primary.main, | ||
borderWidth: "2px", | ||
padding: "0" | ||
} | ||
}), | ||
{ name: "CustomerAddressChoiceCard" } | ||
); |
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
Oops, something went wrong.