update to new Chakra <Wrap> API
This commit is contained in:
parent
b023cbeaf9
commit
91982c60d9
2 changed files with 68 additions and 49 deletions
|
@ -16,6 +16,7 @@ import {
|
||||||
MenuList,
|
MenuList,
|
||||||
Portal,
|
Portal,
|
||||||
Wrap,
|
Wrap,
|
||||||
|
WrapItem,
|
||||||
VStack,
|
VStack,
|
||||||
useBreakpointValue,
|
useBreakpointValue,
|
||||||
useToast,
|
useToast,
|
||||||
|
@ -156,6 +157,7 @@ function UserItemsPage() {
|
||||||
</Heading1>
|
</Heading1>
|
||||||
<Wrap spacing="2" opacity="0.7">
|
<Wrap spacing="2" opacity="0.7">
|
||||||
{data.user.contactNeopetsUsername && (
|
{data.user.contactNeopetsUsername && (
|
||||||
|
<WrapItem>
|
||||||
<Badge
|
<Badge
|
||||||
as="a"
|
as="a"
|
||||||
href={`http://www.neopets.com/userlookup.phtml?user=${data.user.contactNeopetsUsername}`}
|
href={`http://www.neopets.com/userlookup.phtml?user=${data.user.contactNeopetsUsername}`}
|
||||||
|
@ -165,8 +167,10 @@ function UserItemsPage() {
|
||||||
<NeopetsStarIcon marginRight="1" />
|
<NeopetsStarIcon marginRight="1" />
|
||||||
{data.user.contactNeopetsUsername}
|
{data.user.contactNeopetsUsername}
|
||||||
</Badge>
|
</Badge>
|
||||||
|
</WrapItem>
|
||||||
)}
|
)}
|
||||||
{data.user.contactNeopetsUsername && (
|
{data.user.contactNeopetsUsername && (
|
||||||
|
<WrapItem>
|
||||||
<Badge
|
<Badge
|
||||||
as="a"
|
as="a"
|
||||||
href={`http://www.neopets.com/neomessages.phtml?type=send&recipient=${data.user.contactNeopetsUsername}`}
|
href={`http://www.neopets.com/neomessages.phtml?type=send&recipient=${data.user.contactNeopetsUsername}`}
|
||||||
|
@ -176,14 +180,21 @@ function UserItemsPage() {
|
||||||
<EmailIcon marginRight="1" />
|
<EmailIcon marginRight="1" />
|
||||||
Neomail
|
Neomail
|
||||||
</Badge>
|
</Badge>
|
||||||
|
</WrapItem>
|
||||||
)}
|
)}
|
||||||
<SupportOnly>
|
<SupportOnly>
|
||||||
|
<WrapItem>
|
||||||
<UserSupportMenu user={data.user}>
|
<UserSupportMenu user={data.user}>
|
||||||
<MenuButton as={BadgeButton} display="flex" alignItems="center">
|
<MenuButton
|
||||||
|
as={BadgeButton}
|
||||||
|
display="flex"
|
||||||
|
alignItems="center"
|
||||||
|
>
|
||||||
<EditIcon marginRight="1" />
|
<EditIcon marginRight="1" />
|
||||||
Support
|
Support
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
</UserSupportMenu>
|
</UserSupportMenu>
|
||||||
|
</WrapItem>
|
||||||
</SupportOnly>
|
</SupportOnly>
|
||||||
{/* Usually I put "Own" before "Want", but this matches the natural
|
{/* Usually I put "Own" before "Want", but this matches the natural
|
||||||
* order on the page: the _matches_ for things you want are things
|
* order on the page: the _matches_ for things you want are things
|
||||||
|
@ -191,6 +202,7 @@ function UserItemsPage() {
|
||||||
* more natural train of thought: you come to someone's list _wanting_
|
* more natural train of thought: you come to someone's list _wanting_
|
||||||
* something, and _then_ thinking about what you can offer. */}
|
* something, and _then_ thinking about what you can offer. */}
|
||||||
{!isCurrentUser && numItemsTheyOwnThatYouWant > 0 && (
|
{!isCurrentUser && numItemsTheyOwnThatYouWant > 0 && (
|
||||||
|
<WrapItem>
|
||||||
<Badge
|
<Badge
|
||||||
as="a"
|
as="a"
|
||||||
href="#owned-items"
|
href="#owned-items"
|
||||||
|
@ -203,8 +215,10 @@ function UserItemsPage() {
|
||||||
? `${numItemsTheyOwnThatYouWant} items you want`
|
? `${numItemsTheyOwnThatYouWant} items you want`
|
||||||
: "1 item you want"}
|
: "1 item you want"}
|
||||||
</Badge>
|
</Badge>
|
||||||
|
</WrapItem>
|
||||||
)}
|
)}
|
||||||
{!isCurrentUser && numItemsTheyWantThatYouOwn > 0 && (
|
{!isCurrentUser && numItemsTheyWantThatYouOwn > 0 && (
|
||||||
|
<WrapItem>
|
||||||
<Badge
|
<Badge
|
||||||
as="a"
|
as="a"
|
||||||
href="#wanted-items"
|
href="#wanted-items"
|
||||||
|
@ -217,6 +231,7 @@ function UserItemsPage() {
|
||||||
? `${numItemsTheyWantThatYouOwn} items you own`
|
? `${numItemsTheyWantThatYouOwn} items you own`
|
||||||
: "1 item you own"}
|
: "1 item you own"}
|
||||||
</Badge>
|
</Badge>
|
||||||
|
</WrapItem>
|
||||||
)}
|
)}
|
||||||
</Wrap>
|
</Wrap>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
SimpleGrid,
|
SimpleGrid,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Wrap,
|
Wrap,
|
||||||
|
WrapItem,
|
||||||
useColorModeValue,
|
useColorModeValue,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
|
@ -203,7 +204,10 @@ export function ItemCardList({ children }) {
|
||||||
export function ItemBadgeList({ children, ...props }) {
|
export function ItemBadgeList({ children, ...props }) {
|
||||||
return (
|
return (
|
||||||
<Wrap spacing="2" opacity="0.7" {...props}>
|
<Wrap spacing="2" opacity="0.7" {...props}>
|
||||||
{children}
|
{React.Children.map(
|
||||||
|
children,
|
||||||
|
(badge) => badge && <WrapItem>{badge}</WrapItem>
|
||||||
|
)}
|
||||||
</Wrap>
|
</Wrap>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue