diff --git a/src/app/App.js b/src/app/App.js index 49a5ef2..16b13ad 100644 --- a/src/app/App.js +++ b/src/app/App.js @@ -12,6 +12,7 @@ import PageLayout from "./PageLayout"; import WardrobePageLayout from "./WardrobePage/WardrobePageLayout"; const HomePage = loadable(() => import("./HomePage")); +const ItemPage = loadable(() => import("./ItemPage")); const ModelingPage = loadable(() => import("./ModelingPage")); const UserItemsPage = loadable(() => import("./UserItemsPage")); const WardrobePage = loadable(() => import("./WardrobePage"), { @@ -63,6 +64,11 @@ function App() { + + + + + diff --git a/src/app/ItemPage.js b/src/app/ItemPage.js new file mode 100644 index 0000000..f9c7d4f --- /dev/null +++ b/src/app/ItemPage.js @@ -0,0 +1,127 @@ +import React from "react"; +import { Badge, Box, Center } from "@chakra-ui/core"; +import { ExternalLinkIcon } from "@chakra-ui/icons"; +import gql from "graphql-tag"; +import { useQuery } from "@apollo/client"; +import { useParams } from "react-router-dom"; + +import HangerSpinner from "./components/HangerSpinner"; +import { + ItemBadgeList, + ItemThumbnail, + NcBadge, + NpBadge, +} from "./components/ItemCard"; +import { Heading1, usePageTitle } from "./util"; + +function ItemPage() { + const { itemId } = useParams(); + + const { loading, error, data } = useQuery( + gql` + query ItemPage($itemId: ID!) { + item(id: $itemId) { + id + name + isNc + thumbnailUrl + } + } + `, + { variables: { itemId } } + ); + + usePageTitle(data?.item?.name); + + if (loading) { + return ( +
+ +
+ ); + } + + if (error) { + return {error.message}; + } + + const { item } = data; + + return ( + + + + {item.name} + + {item.isNc ? : } + + Jellyneo + + {!item.isNc && ( + + Shop Wiz + + )} + {!item.isNc && ( + + Trades + + )} + {!item.isNc && ( + + Auctions + + )} + + + + ); +} + +function LinkBadge({ children, href }) { + return ( + + {children} + + + ); +} + +export default ItemPage; diff --git a/src/app/components/ItemCard.js b/src/app/components/ItemCard.js index fcc93c6..6a57f4e 100644 --- a/src/app/components/ItemCard.js +++ b/src/app/components/ItemCard.js @@ -3,7 +3,6 @@ import { css } from "emotion"; import { Badge, Box, - Image, SimpleGrid, Tooltip, Wrap, @@ -52,8 +51,8 @@ export function ItemCardContent({ @@ -78,7 +77,14 @@ export function ItemCardContent({ * ItemThumbnail shows a small preview image for the item, including some * hover/focus and worn/unworn states. */ -function ItemThumbnail({ src, isWorn, isDisabled, focusSelector }) { +export function ItemThumbnail({ + item, + size = "md", + isActive, + isDisabled, + focusSelector, + ...props +}) { const theme = useTheme(); const borderColor = useColorModeValue( @@ -93,8 +99,8 @@ function ItemThumbnail({ src, isWorn, isDisabled, focusSelector }) { return ( - + );