Skip to content

Commit

Permalink
fix(imagecardform): only show the close button if id is set
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdickerson committed Dec 8, 2020
1 parent 0bd0a77 commit c9714b5
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,21 @@ const ImageCardFormItems = ({ cardConfig, i18n, onChange }) => {
readOnly
value={cardConfig.content?.id || ''}
/>
<Button
kind="ghost"
renderIcon={Close16}
size="field"
iconDescription={mergedI18n.close}
className={`${baseClassName}--form-section ${baseClassName}--form-section-image-clear-button`}
onClick={() =>
// close means clear the image info out of the JSON
onChange(
omit(cardConfig, 'content.id', 'content.src', 'content.alt')
)
}
/>
{cardConfig.content?.id ? (
<Button
kind="ghost"
renderIcon={Close16}
size="field"
iconDescription={mergedI18n.close}
className={`${baseClassName}--form-section ${baseClassName}--form-section-image-clear-button`}
onClick={() =>
// close means clear the image info out of the JSON
onChange(
omit(cardConfig, 'content.id', 'content.src', 'content.alt')
)
}
/>
) : null}
</label>
{/* TODO enable once hotspot editing is live <Button
className={`${baseClassName}--form-section-image-btn`}
Expand Down

0 comments on commit c9714b5

Please sign in to comment.