Polish UI
This commit is contained in:
parent
b6a77263c8
commit
8d182a1177
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useCallback, useEffect } from 'react';
|
import React, { useState, useCallback, useEffect } from 'react';
|
||||||
import { Grommet } from 'grommet';
|
import { Grommet, Heading } from 'grommet';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import { gql, useLazyQuery } from '@apollo/client';
|
import { gql, useLazyQuery } from '@apollo/client';
|
||||||
|
|
||||||
@ -8,7 +8,6 @@ import { Search } from './Search';
|
|||||||
import { Results } from './Results';
|
import { Results } from './Results';
|
||||||
import { Artists, Artist } from '../interfaces';
|
import { Artists, Artist } from '../interfaces';
|
||||||
|
|
||||||
|
|
||||||
const QUERY_ARTISTS = gql`
|
const QUERY_ARTISTS = gql`
|
||||||
query Artist($byName: String!) {
|
query Artist($byName: String!) {
|
||||||
queryArtists(byName: $byName) {
|
queryArtists(byName: $byName) {
|
||||||
@ -98,12 +97,14 @@ export default function App() {
|
|||||||
return (
|
return (
|
||||||
<Grommet theme={theme}>
|
<Grommet theme={theme}>
|
||||||
<Header>
|
<Header>
|
||||||
<h1>Spoti Search</h1>
|
<Heading level='1' margin={{ vertical: 'small' }} color='light-1'>
|
||||||
|
Spoti Search
|
||||||
|
</Heading>
|
||||||
</Header>
|
</Header>
|
||||||
<Search
|
<Search
|
||||||
inputValue={inputValue}
|
inputValue={inputValue}
|
||||||
handleChange={handleChange}
|
|
||||||
suggestions={suggestions}
|
suggestions={suggestions}
|
||||||
|
handleChange={handleChange}
|
||||||
handleSelect={handleSelect}
|
handleSelect={handleSelect}
|
||||||
/>
|
/>
|
||||||
{selected && (
|
{selected && (
|
||||||
@ -115,6 +116,9 @@ export default function App() {
|
|||||||
|
|
||||||
const theme = {
|
const theme = {
|
||||||
global: {
|
global: {
|
||||||
|
colors: {
|
||||||
|
brand: 'rgb(24, 177, 147)',
|
||||||
|
},
|
||||||
font: {
|
font: {
|
||||||
family: 'Roboto',
|
family: 'Roboto',
|
||||||
size: '18px',
|
size: '18px',
|
||||||
|
@ -38,22 +38,24 @@ export const Results = ({
|
|||||||
as='section'
|
as='section'
|
||||||
rows={['fit', 'fit']}
|
rows={['fit', 'fit']}
|
||||||
columns={['fit', '2/3']}
|
columns={['fit', '2/3']}
|
||||||
gap='small'
|
gap='large'
|
||||||
areas={[
|
areas={[
|
||||||
['artist-title', 'other-title'],
|
['artist-title', 'other-title'],
|
||||||
['artist', 'other'],
|
['artist', 'other'],
|
||||||
['disco-title', 'disco-title'],
|
['disco-title', 'disco-title'],
|
||||||
['discography', 'discography'],
|
['discography', 'discography'],
|
||||||
]}
|
]}
|
||||||
|
pad='xlarge'
|
||||||
>
|
>
|
||||||
<Heading
|
<Heading
|
||||||
level='1'
|
level='1'
|
||||||
|
size='small'
|
||||||
gridArea='artist-title'
|
gridArea='artist-title'
|
||||||
margin={{ vertical: 'none' }}
|
margin={{ vertical: 'none' }}
|
||||||
>
|
>
|
||||||
{selectedName}
|
{selectedName}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Grid gridArea='artist' margin={{ bottom: 'medium' }}>
|
<Box gridArea='artist'>
|
||||||
<Box
|
<Box
|
||||||
round='full'
|
round='full'
|
||||||
background={{
|
background={{
|
||||||
@ -64,7 +66,7 @@ export const Results = ({
|
|||||||
height='300px'
|
height='300px'
|
||||||
width='300px'
|
width='300px'
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Box>
|
||||||
<Heading
|
<Heading
|
||||||
level='2'
|
level='2'
|
||||||
gridArea='other-title'
|
gridArea='other-title'
|
||||||
@ -76,7 +78,7 @@ export const Results = ({
|
|||||||
</Heading>
|
</Heading>
|
||||||
<ResponsiveContext.Consumer>
|
<ResponsiveContext.Consumer>
|
||||||
{(size) => (
|
{(size) => (
|
||||||
<Box gridArea='other' direction='row' wrap>
|
<Box gridArea='other' direction='row-reverse' justify='end' wrap gap='medium'>
|
||||||
{otherArtists.map((artist) => (
|
{otherArtists.map((artist) => (
|
||||||
<Other
|
<Other
|
||||||
key={artist.id}
|
key={artist.id}
|
||||||
@ -88,7 +90,7 @@ export const Results = ({
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</ResponsiveContext.Consumer>
|
</ResponsiveContext.Consumer>
|
||||||
<Heading level='2' gridArea='disco-title' size='large'>
|
<Heading level='2' gridArea='disco-title' size='large' margin={{bottom: "none"}}>
|
||||||
Discography
|
Discography
|
||||||
</Heading>
|
</Heading>
|
||||||
<ResponsiveContext.Consumer>
|
<ResponsiveContext.Consumer>
|
||||||
|
@ -17,16 +17,23 @@ export const Search = ({
|
|||||||
as='section'
|
as='section'
|
||||||
direction='row'
|
direction='row'
|
||||||
justify='center'
|
justify='center'
|
||||||
margin={{ vertical: 'large' }}
|
margin={{ top: 'large' }}
|
||||||
>
|
>
|
||||||
<TextInput
|
<Box
|
||||||
value={inputValue}
|
as='div'
|
||||||
onChange={e => handleChange(e.target.value)}
|
margin={{ vertical: 'none' }}
|
||||||
onSelect={(target) => handleSelect(target.suggestion)}
|
width='500px'
|
||||||
placeholder='Type an artist name'
|
|
||||||
icon={<FormSearch color='plain' />}
|
>
|
||||||
dropHeight='large'
|
<TextInput
|
||||||
suggestions={suggestions}
|
value={inputValue}
|
||||||
/>
|
suggestions={suggestions}
|
||||||
|
onChange={(e) => handleChange(e.target.value)}
|
||||||
|
onSelect={(target) => handleSelect(target.suggestion)}
|
||||||
|
icon={<FormSearch color='plain' />}
|
||||||
|
dropHeight='large'
|
||||||
|
placeholder='Type an artist name'
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user