Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function NftCard({ ipfsUrl, name, onClick, nftPathId }: NftCardPr
id={`${nftPathId}-component-button`}
>
<Box sx={{ borderRadius: '4px', overflow: 'hidden', flex: '1 1 auto' }}>
<NftImage imageUrl={ipfsUrl} name={name} width="100%" height="100%" nftPathId={nftPathId} />
<NftImage imageUrl={ipfsUrl} name={name} width="100%" height="100%" nftPathId={nftPathId} fillBox={true} />
</Box>
<Box>
<Typography
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ interface NftImageProps {
maxWidth?: string;
maxHeight?: string;
contentHeight?: string;
contentWidth?: string;
nftPathId: string;
imageSx?: SxProps;
onClickHandler?: () => void;
cursor?: string;
fillBox?: boolean;
}

export default function NftImage({
imageUrl,
name,
contentHeight,
contentWidth,
nftPathId,
width = 'auto',
height = 'auto',
imageSx = {},
onClickHandler,
cursor = 'default',
fillBox = false,
}: NftImageProps) {
const [loading, setLoading] = useState(true);
const [error, setError] = useState(false);
Expand All @@ -50,7 +54,7 @@ export default function NftImage({

if (error || url === null)
return (
<SvgWrapper height={contentHeight ? contentHeight : '100%'} id={`${nftPathId}-image-component`}>
<SvgWrapper height={contentHeight ?? '100%'} width={contentWidth ?? '100%'} id={`${nftPathId}-image-component`}>
<DefaultNft />
</SvgWrapper>
);
Expand All @@ -63,7 +67,7 @@ export default function NftImage({
sx={{
width,
height,
objectFit: 'cover',
objectFit: fillBox ? 'cover' : 'contain',
display: 'inline-block',
cursor,
...imageSx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,25 @@ const nftPathId = 'nftDetails';
const ImageItem = ({ nftInfo, onClick }: { nftInfo: Nft | null; onClick: () => void }) => {
if (!nftInfo) return null;
return (
<Box sx={{ overflow: 'hidden', height: '100%' }}>
<Box
sx={{
overflow: 'hidden',
width: '100%',
maxWidth: '550px',
height: '550px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<NftImage
imageSx={{ borderRadius: '8px' }}
imageUrl={nftInfo.image}
name={nftInfo.name || '-'}
width="100%"
height="100%"
maxWidth="550px"
maxHeight="550px"
contentHeight="550px"
nftPathId={nftPathId}
onClickHandler={onClick}
Expand Down Expand Up @@ -74,7 +86,7 @@ export default function NftDetails() {
}

return (
<>
<Box>
<Box sx={{ mb: '24px', width: '100%' }}>
<Link to={ROUTES.NFT_GALLERY.ROOT}>
<Button
Expand All @@ -88,7 +100,7 @@ export default function NftDetails() {
</Button>
</Link>
</Box>
<Grid container columns={10}>
<Grid container columns={10} alignItems="flex-start">
<Grid item xs={4}>
<ImageItem onClick={openModal} nftInfo={currentNft} />
</Grid>
Expand Down Expand Up @@ -141,6 +153,6 @@ export default function NftDetails() {
/>
</Box>
</Modal>
</>
</Box>
);
}
Loading