Add "Customize more" button to item page preview

This commit is contained in:
Emi Matchu 2021-01-26 15:02:11 -08:00
parent 10e09e266c
commit 0d14fde318

View file

@ -22,6 +22,7 @@ import {
import { import {
CheckIcon, CheckIcon,
ChevronRightIcon, ChevronRightIcon,
EditIcon,
StarIcon, StarIcon,
WarningIcon, WarningIcon,
} from "@chakra-ui/icons"; } from "@chakra-ui/icons";
@ -631,6 +632,12 @@ function ItemPageOutfitPreview({ itemId }) {
engine="canvas" engine="canvas"
onChangeHasAnimations={setHasAnimations} onChangeHasAnimations={setHasAnimations}
/> />
<CustomizeMoreButton
speciesId={petState.speciesId}
colorId={petState.colorId}
pose={petState.pose}
itemId={itemId}
/>
{hasAnimations && ( {hasAnimations && (
<PlayPauseButton <PlayPauseButton
isPaused={isPaused} isPaused={isPaused}
@ -698,6 +705,36 @@ function ItemPageOutfitPreview({ itemId }) {
); );
} }
function CustomizeMoreButton({ speciesId, colorId, pose, itemId }) {
const url =
`/outfits/new?species=${speciesId}&color=${colorId}&pose=${pose}&` +
`objects[]=${itemId}`;
// The default background is good in light mode, but in dark mode it's a
// very subtle transparent white... make it a semi-transparent black, for
// better contrast against light-colored background items!
const backgroundColor = useColorModeValue(undefined, "blackAlpha.600");
const backgroundColorHover = useColorModeValue(undefined, "blackAlpha.700");
return (
<Tooltip label="Customize more" placement="left" colorScheme="white">
<IconButton
as={Link}
to={url}
icon={<EditIcon />}
position="absolute"
top="2"
right="2"
size="sm"
background={backgroundColor}
_hover={{ backgroundColor: backgroundColorHover }}
_focus={{ backgroundColor: backgroundColorHover }}
boxShadow="sm"
/>
</Tooltip>
);
}
function PlayPauseButton({ isPaused, onClick }) { function PlayPauseButton({ isPaused, onClick }) {
return ( return (
<IconButton <IconButton