fix(my-joy-beta): make logo click trigger change
This commit is contained in:
parent
4a8fa480c4
commit
d13e23e15d
@ -48,18 +48,23 @@ export const Preview = ({ name, version, isVm }) => (
|
|||||||
const Image = ({ onClick, active, ...image }) => {
|
const Image = ({ onClick, active, ...image }) => {
|
||||||
const { imageName = '', versions = [] } = image;
|
const { imageName = '', versions = [] } = image;
|
||||||
|
|
||||||
const ids = [`image-card-${imageName}`, `image-img-${imageName}`];
|
const id = `image-card-${imageName}`;
|
||||||
|
|
||||||
const handleClick = ev =>
|
const handleCardClick = ev => {
|
||||||
includes(ids, ev.target.id) ? onClick(image) : null;
|
return ev.target.id === id ? onClick(image) : null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleLogoClick = ev => {
|
||||||
|
return onClick(image);
|
||||||
|
};
|
||||||
|
|
||||||
const Logo = Assets[pascalCase(imageName)] || Assets.Placeholder;
|
const Logo = Assets[pascalCase(imageName)] || Assets.Placeholder;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col md={2} sm={3}>
|
<Col md={2} sm={3}>
|
||||||
<Margin bottom={3}>
|
<Margin bottom={3}>
|
||||||
<Card id={ids[0]} onClick={handleClick} active={active} preview>
|
<Card id={id} onClick={handleCardClick} active={active} preview>
|
||||||
<Logo id={ids[1]} width="42" height="42" />
|
<Logo onClick={handleLogoClick} width="42" height="42" />
|
||||||
<H4>{titleCase(imageName)}</H4>
|
<H4>{titleCase(imageName)}</H4>
|
||||||
<FormGroup name="image" field={Field}>
|
<FormGroup name="image" field={Field}>
|
||||||
<Version onBlur={null}>
|
<Version onBlur={null}>
|
||||||
|
Loading…
Reference in New Issue
Block a user