From a1b1e7c4c38c1349c5d59d5b29517781397eb266 Mon Sep 17 00:00:00 2001 From: Andrey Loginov <zdron444@gmail.com> Date: Wed, 19 May 2021 08:02:43 +0000 Subject: [PATCH] Merge branch 'fix/MRM-4475' into 'release/v0.14' fix: [MRM-4475] Hide street/building if empty See merge request mashroom/frontend/admin!77 (cherry picked from commit 905cffe854da86e390441c0cb67043ea4599964d) 0db4a3d2 fix: [MRM-4475] Hide street/building if empty --- .../UserDetails/HomeAddress.tsx | 28 +++++++++---------- src/ui/atoms/UserCard.tsx | 4 ++- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/entities/platform-users/UserDetails/HomeAddress.tsx b/src/entities/platform-users/UserDetails/HomeAddress.tsx index f94fb7e8..160472b2 100644 --- a/src/entities/platform-users/UserDetails/HomeAddress.tsx +++ b/src/entities/platform-users/UserDetails/HomeAddress.tsx @@ -32,35 +32,35 @@ const HomeAddress: FC<Props> = ({ location }) => { country, } = location; + const homeAddress = [address1, address2, address3, address4] + .filter(Boolean) + .join(", "); + return ( <Group> <FormRow> <Name>Home address</Name> - <Value> - {[address1, address2, address3, address4].filter(Boolean).join(", ")} - </Value> + <Value>{homeAddress !== "" ? homeAddress : "N/A"}</Value> </FormRow> <FormRow> <Row> - <Col> - <Name>Street / Building</Name> - <Value>{[street, building].filter(Boolean).join(", ")}</Value> - </Col> + {((street && street !== "") || (building && building !== "")) && ( + <Col> + <Name>Street / Building</Name> + <Value>{[street, building].filter(Boolean).join(", ")}</Value> + </Col> + )} <Col> <Name>City / Town</Name> - <Value>{city || "N/A"}</Value> + <Value>{city && city !== "" ? city : "N/A"}</Value> </Col> - </Row> - </FormRow> - <FormRow> - <Row> <Col> <Name>Postcode</Name> - <Value>{postcode || "N/A"}</Value> + <Value>{postcode && postcode !== "" ? postcode : "N/A"}</Value> </Col> <Col> <Name>Country</Name> - <Value>{country || "N/A"}</Value> + <Value>{country && country !== "" ? country : "N/A"}</Value> </Col> </Row> </FormRow> diff --git a/src/ui/atoms/UserCard.tsx b/src/ui/atoms/UserCard.tsx index 6cb2a487..0f082024 100644 --- a/src/ui/atoms/UserCard.tsx +++ b/src/ui/atoms/UserCard.tsx @@ -24,11 +24,12 @@ export const UserAvatarSmall = styled.img` margin: 0 20px 0 0; background: ${theme.colors.main.midGrey}; border-radius: 50%; - object-fix: cover; + object-fit: cover; `; export const UserDetails = styled.div` width: calc(50% - 15px); + margin-bottom: 4px; `; export const UserItem = styled.div` @@ -69,6 +70,7 @@ export const UserLastUpdate = styled.div` export const UserFlexRow = styled.div` display: flex; justify-content: space-between; + flex-wrap: wrap; `; export const StatusDanger = styled.span` color: ${theme.colors.main.red}; -- GitLab