2021-01-08 01:23:24 -08:00
|
|
|
import { Box } from "@chakra-ui/react";
|
|
|
|
|
2021-09-03 15:37:38 -07:00
|
|
|
function OutfitThumbnail({ outfitId, updatedAt, ...props }) {
|
|
|
|
const versionTimestamp = new Date(updatedAt).getTime();
|
|
|
|
|
|
|
|
// NOTE: It'd be more reliable for testing to use a relative path, but
|
|
|
|
// generating these on dev is SO SLOW, that I'd rather just not.
|
|
|
|
const thumbnailUrl150 = `https://outfits.openneo-assets.net/outfits/${outfitId}/v/${versionTimestamp}/150.png`;
|
|
|
|
const thumbnailUrl300 = `https://outfits.openneo-assets.net/outfits/${outfitId}/v/${versionTimestamp}/300.png`;
|
2021-01-08 01:23:24 -08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Box
|
|
|
|
as="img"
|
2021-09-03 15:37:38 -07:00
|
|
|
src={thumbnailUrl150}
|
|
|
|
srcSet={`${thumbnailUrl150} 1x, ${thumbnailUrl300} 2x`}
|
2021-01-08 01:23:24 -08:00
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default OutfitThumbnail;
|