spoti-search/src/components/Album.tsx

32 lines
633 B
TypeScript

import React from 'react';
import { Box, Heading } from 'grommet';
import placeholder from '../assets/placeholder-music.jpg';
export const Album = ({ image, name }: { image: string; name: string }) => {
// Load placeholder image if none provided
if (!image) {
image = placeholder;
}
return (
<Box width='255px' margin={{right: '20px'}}>
<Box
height='255px'
width='255px'
background={{
repeat: 'no-repeat',
size: 'cover',
image: `url(${image})`,
}}
/>
<Heading
level='4'
margin={{ bottom: 'small', top: 'small', left: 'small' }}
>
{name}
</Heading>
</Box>
);
};