fix(my-joy-beta): make logo click trigger change

This commit is contained in:
Sérgio Ramos 2018-02-22 02:08:18 +00:00
parent 4a8fa480c4
commit d13e23e15d

View File

@ -48,18 +48,23 @@ export const Preview = ({ name, version, isVm }) => (
const Image = ({ onClick, active, ...image }) => {
const { imageName = '', versions = [] } = image;
const ids = [`image-card-${imageName}`, `image-img-${imageName}`];
const id = `image-card-${imageName}`;
const handleClick = ev =>
includes(ids, ev.target.id) ? onClick(image) : null;
const handleCardClick = ev => {
return ev.target.id === id ? onClick(image) : null;
};
const handleLogoClick = ev => {
return onClick(image);
};
const Logo = Assets[pascalCase(imageName)] || Assets.Placeholder;
return (
<Col md={2} sm={3}>
<Margin bottom={3}>
<Card id={ids[0]} onClick={handleClick} active={active} preview>
<Logo id={ids[1]} width="42" height="42" />
<Card id={id} onClick={handleCardClick} active={active} preview>
<Logo onClick={handleLogoClick} width="42" height="42" />
<H4>{titleCase(imageName)}</H4>
<FormGroup name="image" field={Field}>
<Version onBlur={null}>