spoti-search/src/components/Other.tsx

47 lines
782 B
TypeScript

import React from 'react';
import { Box, Heading } from 'grommet';
import placeholder from '../assets/placeholder-music.jpg';
export const Other = ({
image,
name,
handleClick,
}: {
image: string;
name: string;
handleClick: (name: string) => void;
}) => {
// Load placeholder image if none provided
if (!image) {
image = placeholder;
}
return (
<Box
round='xxsmall'
overflow='hidden'
align='center'
pad='small'
onClick={() => handleClick(name)}
>
<Heading
level='4'
margin={{ bottom: 'small', top: 'small', left: 'small' }}
>
{name}
</Heading>
<Box
height='small'
width='small'
round='full'
background={{
repeat: 'no-repeat',
size: 'cover',
image: `url(${image})`,
}}
/>
</Box>
);
};