Issue #5: Creacion de boton AddToList

This commit is contained in:
Daniel Cortes
2020-06-19 05:56:55 -04:00
parent 5fea207523
commit ebda82edb3
6 changed files with 13 additions and 12 deletions

View File

@@ -0,0 +1,5 @@
import React from "react";
export const AddToList = (props) => {
return <button className='button'>Agregar a mi lista</button>
}

View File

@@ -1,10 +1,12 @@
import React from "react"; import React from "react";
import "./Entity.scss"
import "./Entity.scss";
import {AddToList} from "./AddToList";
export const Entity = (props) => { export const Entity = (props) => {
const hasCover = props.cover; const hasCover = props.cover;
const hasTags = props.tags && props.tags.length > 0; const hasTags = props.tags && props.tags.length > 0;
const hasButton = props.onButtonClick || props.buttonText
return ( return (
<div className='entity'> <div className='entity'>
@@ -20,9 +22,7 @@ export const Entity = (props) => {
</ul> </ul>
} }
</div> </div>
{hasButton && <AddToList/>
<button className='button' onClick={props.onButtonClick}>{props.buttonText}</button>
}
</div> </div>
{hasCover && {hasCover &&

View File

@@ -61,8 +61,7 @@ const Artist = (props) => {
if (artist){ if (artist){
return <Entity title={artist.name} return <Entity title={artist.name}
subtitle={[artist.type, artist.country].filter(Boolean).join(' - ')} subtitle={[artist.type, artist.country].filter(Boolean).join(' - ')}
tags={artist.tags.map((tag) => (tag.name))} tags={artist.tags.map((tag) => (tag.name))}/>
buttonText='Agregar a mi lista'/>
}else { }else {
return <Fragment/> return <Fragment/>
} }

View File

@@ -68,7 +68,6 @@ const Disc = (props) => {
) )
return <Entity title={disc.title} return <Entity title={disc.title}
subtitle={subtitle} subtitle={subtitle}
buttonText='Agregar a mi lista'
cover={<CoverArt disc={disc} popup={true} size={4}/>}/> cover={<CoverArt disc={disc} popup={true} size={4}/>}/>
}else { }else {
return <Fragment></Fragment> return <Fragment></Fragment>

View File

@@ -31,8 +31,7 @@ const Recordings = (props) => {
{recording.disambiguation && {recording.disambiguation &&
<div>{capitalize(recording.disambiguation)}</div>} <div>{capitalize(recording.disambiguation)}</div>}
</Fragment>), </Fragment>),
'selected': props.selected === recording.id, 'selected': props.selected === recording.id
'widget': <button className='button'>Agregar a mi lista</button>
})) }))
})); }));
@@ -57,7 +56,6 @@ const Release = (props) => {
) )
return <Entity title={release.title} return <Entity title={release.title}
subtitle={subtitle} subtitle={subtitle}
buttonText='Agregar a mi lista'
cover={<CoverArt release={release} popup={true} size={4}/>}/> cover={<CoverArt release={release} popup={true} size={4}/>}/>
}else { }else {
return <Fragment></Fragment> return <Fragment></Fragment>

View File

@@ -23,7 +23,7 @@ const Song = (props) => {
subtitle = <span>[{toDuration(song.length)}]</span> subtitle = <span>[{toDuration(song.length)}]</span>
} }
return <Entity title={song.title} subtitle={subtitle} buttonText='Agregar a mi lista'/> return <Entity title={song.title} subtitle={subtitle}/>
} }