
* 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
34 lines
1 KiB
TypeScript
34 lines
1 KiB
TypeScript
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;
|