From 91982c60d9aa0e24a1648b54b88a1f24e694607b Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 25 Dec 2020 09:17:24 -0800 Subject: [PATCH] update to new Chakra API --- src/app/UserItemsPage.js | 111 +++++++++++++++++++-------------- src/app/components/ItemCard.js | 6 +- 2 files changed, 68 insertions(+), 49 deletions(-) diff --git a/src/app/UserItemsPage.js b/src/app/UserItemsPage.js index 768fc67..21ad4a3 100644 --- a/src/app/UserItemsPage.js +++ b/src/app/UserItemsPage.js @@ -16,6 +16,7 @@ import { MenuList, Portal, Wrap, + WrapItem, VStack, useBreakpointValue, useToast, @@ -156,34 +157,44 @@ function UserItemsPage() { {data.user.contactNeopetsUsername && ( - - - {data.user.contactNeopetsUsername} - + + + + {data.user.contactNeopetsUsername} + + )} {data.user.contactNeopetsUsername && ( - - - Neomail - + + + + Neomail + + )} - - - - Support - - + + + + + Support + + + {/* Usually I put "Own" before "Want", but this matches the natural * order on the page: the _matches_ for things you want are things @@ -191,32 +202,36 @@ function UserItemsPage() { * more natural train of thought: you come to someone's list _wanting_ * something, and _then_ thinking about what you can offer. */} {!isCurrentUser && numItemsTheyOwnThatYouWant > 0 && ( - - - {numItemsTheyOwnThatYouWant > 1 - ? `${numItemsTheyOwnThatYouWant} items you want` - : "1 item you want"} - + + + + {numItemsTheyOwnThatYouWant > 1 + ? `${numItemsTheyOwnThatYouWant} items you want` + : "1 item you want"} + + )} {!isCurrentUser && numItemsTheyWantThatYouOwn > 0 && ( - - - {numItemsTheyWantThatYouOwn > 1 - ? `${numItemsTheyWantThatYouOwn} items you own` - : "1 item you own"} - + + + + {numItemsTheyWantThatYouOwn > 1 + ? `${numItemsTheyWantThatYouOwn} items you own` + : "1 item you own"} + + )} diff --git a/src/app/components/ItemCard.js b/src/app/components/ItemCard.js index 478dd2c..6279733 100644 --- a/src/app/components/ItemCard.js +++ b/src/app/components/ItemCard.js @@ -6,6 +6,7 @@ import { SimpleGrid, Tooltip, Wrap, + WrapItem, useColorModeValue, useTheme, } from "@chakra-ui/react"; @@ -203,7 +204,10 @@ export function ItemCardList({ children }) { export function ItemBadgeList({ children, ...props }) { return ( - {children} + {React.Children.map( + children, + (badge) => badge && {badge} + )} ); }