import React from "react";
import { CSSTransition, TransitionGroup } from "react-transition-group";
import {
Box,
Flex,
IconButton,
Image,
PseudoBox,
Skeleton,
Tooltip,
} from "@chakra-ui/core";
import "./ItemList.css";
function ItemList({ items, outfitState, dispatchToOutfit }) {
return (
{items.map((item) => (
{
e.style.height = e.offsetHeight + "px";
}}
>
))}
);
}
function ItemListSkeleton({ count }) {
return (
{Array.from({ length: count }).map((_, i) => (
))}
);
}
function Item({ item, outfitState, dispatchToOutfit }) {
const { wornItemIds, allItemIds } = outfitState;
const isWorn = wornItemIds.includes(item.id);
const isInOutfit = allItemIds.includes(item.id);
return (
dispatchToOutfit({
type: isWorn ? "unwearItem" : "wearItem",
itemId: item.id,
})
}
>
{item.name}
{isInOutfit && (
{
e.stopPropagation();
dispatchToOutfit({ type: "removeItem", itemId: item.id });
}}
opacity="0"
transitionProperty="opacity color"
transitionDuration="0.2s"
_groupHover={{
opacity: 1,
transitionDuration: "0.5s",
}}
_hover={{
opacity: 1,
color: "gray.800",
backgroundColor: "gray.200",
}}
_focus={{
opacity: 1,
color: "gray.800",
backgroundColor: "gray.200",
}}
/>
)}
);
}
function ItemSkeleton() {
return (
);
}
function ItemThumbnail({ src, isWorn }) {
return (
);
}
function ItemName({ children, isWorn }) {
return (
{children}
);
}
export default ItemList;
export { ItemListSkeleton };