diff --git a/src/app/HomePage.js b/src/app/HomePage.js index f92d8c6..bda7f30 100644 --- a/src/app/HomePage.js +++ b/src/app/HomePage.js @@ -362,6 +362,7 @@ function NewItemsSectionContent() { id name thumbnailUrl + isNc } } ` diff --git a/src/app/ItemSearchPage.js b/src/app/ItemSearchPage.js index 5fba3ce..bac5be1 100644 --- a/src/app/ItemSearchPage.js +++ b/src/app/ItemSearchPage.js @@ -144,6 +144,7 @@ function ItemSearchPageResults({ query: latestQuery, offset }) { id name thumbnailUrl + isNc } } } diff --git a/src/app/components/SquareItemCard.js b/src/app/components/SquareItemCard.js index 53812a6..4aa5f29 100644 --- a/src/app/components/SquareItemCard.js +++ b/src/app/components/SquareItemCard.js @@ -1,12 +1,17 @@ import React from "react"; -import { Skeleton, useTheme, useToken } from "@chakra-ui/react"; +import { + Skeleton, + useColorModeValue, + useTheme, + useToken, +} from "@chakra-ui/react"; import { ClassNames } from "@emotion/react"; import { Link } from "react-router-dom"; import { safeImageUrl, useCommonStyles } from "../util"; function SquareItemCard({ item, ...props }) { - const theme = useTheme(); + const outlineShadowValue = useToken("shadows", "outline"); return ( @@ -23,7 +28,7 @@ function SquareItemCard({ item, ...props }) { transform: scale(1.05); } &:focus { - box-shadow: ${theme.shadows.outline}; + box-shadow: ${outlineShadowValue}; outline: none; } `} @@ -31,23 +36,7 @@ function SquareItemCard({ item, ...props }) { > - } + thumbnailImage={} /> )} @@ -103,6 +92,81 @@ function SquareItemCardLayout({ name, thumbnailImage, minHeightNumLines = 2 }) { ); } +function ItemThumbnail({ item }) { + const mdRadiusValue = useToken("radii", "md"); + + const badgeBackground = useColorModeValue( + item.isNc ? "purple.100" : "gray.100", + item.isNc ? "purple.500" : "gray.500" + ); + const badgeColor = useColorModeValue( + item.isNc ? "purple.500" : "gray.500", + item.isNc ? "purple.100" : "gray.100" + ); + const thumbnailShadowColor = useColorModeValue( + item.isNc ? "purple.200" : "gray.200", + item.isNc ? "purple.600" : "gray.600" + ); + + const [ + badgeBackgroundValue, + badgeColorValue, + thumbnailShadowColorValue, + ] = useToken("colors", [badgeBackground, badgeColor, thumbnailShadowColor]); + + return ( + + {({ css }) => ( +
+ {`Thumbnail + {item.isNc != null && ( +
*/ + display: inline-block; + white-space: nowrap; + vertical-align: middle; + padding-left: 0.25rem; + padding-right: 0.25rem; + text-transform: uppercase; + font-size: 0.65rem; + border-radius: 0.125rem; + font-weight: 700; + background: ${badgeBackgroundValue}; + color: ${badgeColorValue}; + `} + > + {item.isNc ? "NC" : "NP"} +
+ )} +
+ )} +
+ ); +} + export function SquareItemCardSkeleton({ minHeightNumLines }) { return (