diff --git a/src/app/UserOutfitsPage.js b/src/app/UserOutfitsPage.js index 3e75a24..062d46c 100644 --- a/src/app/UserOutfitsPage.js +++ b/src/app/UserOutfitsPage.js @@ -1,5 +1,6 @@ import React from "react"; import { Box, Center, Flex, Wrap, WrapItem } from "@chakra-ui/react"; +import { ClassNames } from "@emotion/react"; import gql from "graphql-tag"; import { useQuery } from "@apollo/client"; import { Link } from "react-router-dom"; @@ -109,16 +110,33 @@ function UserOutfitsPageContent() { function OutfitCard({ outfit }) { const image = ( - + {({ css }) => ( + )} - width={150} - height={150} - alt="Outfit thumbnail" - /> + ); return ( @@ -178,6 +196,26 @@ function buildOutfitThumbnailUrl(petAppearance, itemAppearances) { return `/api/outfitImage?size=${size}&layerUrls=${layerUrls.join(",")}`; } +function buildOutfitAltText(outfit) { + const { petAppearance, wornItems } = outfit; + const { species, color } = petAppearance; + + let altText = ""; + + const petDescription = `${color.name} ${species.name}`; + altText += petDescription; + + if (wornItems.length > 0) { + const itemNames = wornItems + .map((item) => item.name) + .sort() + .join(", "); + altText += ` wearing ${itemNames}`; + } + + return altText; +} + /** * getBestImageSize returns the right image size to render at 150x150, for the * current device.