2020-07-23 12:07:29 +00:00
|
|
|
import React from 'react';
|
2020-07-23 19:17:31 +00:00
|
|
|
import { Box, Grid, Avatar, Image, ResponsiveContext, Heading } from 'grommet';
|
2020-07-23 09:43:12 +00:00
|
|
|
|
2020-07-23 19:17:31 +00:00
|
|
|
import { Card as Album } from './Card';
|
2020-07-23 12:07:29 +00:00
|
|
|
import { Artists } from '../interfaces';
|
2020-07-23 19:17:31 +00:00
|
|
|
import { size } from 'lodash';
|
2020-07-23 12:07:29 +00:00
|
|
|
|
2020-07-23 14:23:15 +00:00
|
|
|
export const Results = ({ artists }: { artists: Artists }) => {
|
2020-07-23 17:53:47 +00:00
|
|
|
const {
|
|
|
|
name: selectedName,
|
|
|
|
image: selectedImage,
|
|
|
|
albums: selectedAlbums,
|
|
|
|
} = artists[0];
|
2020-07-23 12:07:29 +00:00
|
|
|
|
2020-07-23 14:23:15 +00:00
|
|
|
return (
|
2020-07-23 12:07:29 +00:00
|
|
|
<Grid
|
2020-07-23 17:53:47 +00:00
|
|
|
rows={['fit', 'fit']}
|
2020-07-23 12:07:29 +00:00
|
|
|
columns={['1/4', '3/4']}
|
|
|
|
gap='small'
|
|
|
|
areas={[
|
2020-07-23 19:17:31 +00:00
|
|
|
['artist', 'other'],
|
2020-07-23 12:07:29 +00:00
|
|
|
['discography', 'discography'],
|
|
|
|
]}
|
2020-07-23 09:43:12 +00:00
|
|
|
>
|
2020-07-23 19:17:31 +00:00
|
|
|
<Box gridArea='artist' height='300px' >
|
2020-07-23 17:53:47 +00:00
|
|
|
<h1>{selectedName}</h1>
|
2020-07-23 19:17:31 +00:00
|
|
|
<Image src={selectedImage} fit='cover' />
|
2020-07-23 12:07:29 +00:00
|
|
|
</Box>
|
2020-07-23 19:17:31 +00:00
|
|
|
<Box gridArea='other' background='light-2'>
|
|
|
|
<h3>Other results</h3>
|
2020-07-23 17:53:47 +00:00
|
|
|
{artists.map((artist) => (
|
2020-07-23 19:17:31 +00:00
|
|
|
<Box gridArea='artist' key={artist.id}>
|
2020-07-23 17:53:47 +00:00
|
|
|
<Avatar src={artist.image} />
|
|
|
|
<h4>{artist.name}</h4>
|
|
|
|
</Box>
|
|
|
|
))}
|
2020-07-23 12:07:29 +00:00
|
|
|
</Box>
|
2020-07-23 19:17:31 +00:00
|
|
|
<ResponsiveContext.Consumer>
|
|
|
|
{(size) => (
|
|
|
|
<Grid
|
|
|
|
gridArea='discography'
|
|
|
|
align='start'
|
|
|
|
columns={{ count: 'fill', size: '300px' }}
|
|
|
|
gap='medium'
|
|
|
|
>
|
|
|
|
<Heading level='1'>
|
|
|
|
Discography
|
|
|
|
</Heading>
|
|
|
|
{selectedAlbums.map((album) => (
|
|
|
|
<Album
|
|
|
|
key={album.id}
|
|
|
|
image={album.image}
|
|
|
|
name={album.name}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</Grid>
|
|
|
|
)}
|
|
|
|
</ResponsiveContext.Consumer>
|
2020-07-23 12:07:29 +00:00
|
|
|
</Grid>
|
2020-07-23 09:43:12 +00:00
|
|
|
);
|
|
|
|
};
|