2023-10-24 17:29:07 -07:00
|
|
|
import React from "react";
|
2023-08-10 15:56:36 -07:00
|
|
|
import { Box } from "@chakra-ui/react";
|
|
|
|
|
|
|
|
function OutfitThumbnail({ outfitId, updatedAt, ...props }) {
|
2024-09-09 16:10:45 -07:00
|
|
|
const versionTimestamp = new Date(updatedAt).getTime();
|
2023-08-10 15:56:36 -07:00
|
|
|
|
2024-09-09 16:10:45 -07:00
|
|
|
// 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`;
|
2023-08-10 15:56:36 -07:00
|
|
|
|
2024-09-09 16:10:45 -07:00
|
|
|
return (
|
|
|
|
<Box
|
|
|
|
as="img"
|
|
|
|
src={thumbnailUrl150}
|
|
|
|
srcSet={`${thumbnailUrl150} 1x, ${thumbnailUrl300} 2x`}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
);
|
2023-08-10 15:56:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export default OutfitThumbnail;
|