Skip to content

Commit

Permalink
fix(label-form): show screenshot toggle button only when the post is …
Browse files Browse the repository at this point in the history
…available
  • Loading branch information
kitce committed Nov 5, 2022
1 parent 15bf19e commit e7aac4c
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions src/components/LabelForm/LabelForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,34 +225,38 @@ const LabelForm: React.FunctionComponent<TProps> = (props) => {
</ToggleButton>
</div>
{/* screenshot */}
<div className={classNames(styles.inputField, styles.screenshot)}>
<ToggleButton
className={styles.toggleButton}
checked={isScreenshotEnabled}
disabled={loading}
loading={screenshot.loading}
onChange={handleScreenshotToggleButtonChange}
>
{TEXTS.LABEL_FORM_FIELD_LABEL_SCREENSHOT}
</ToggleButton>
{
!screenshot.loading && !!screenshot.url && (
<div className={styles.preview}>
{
<a
className={styles.image}
href={screenshot.url}
target="_blank"
style={previewImageStyle}
aria-label={TEXTS.LABEL_FORM_SCREENSHOT_PREVIEW_LABEL_TEXT}
>
<Icon className={styles.icon} icon={IconName.Expand} />
</a>
}
</div>
)
}
</div>
{
post && (
<div className={classNames(styles.inputField, styles.screenshot)}>
<ToggleButton
className={styles.toggleButton}
checked={isScreenshotEnabled}
disabled={loading}
loading={screenshot.loading}
onChange={handleScreenshotToggleButtonChange}
>
{TEXTS.LABEL_FORM_FIELD_LABEL_SCREENSHOT}
</ToggleButton>
{
!screenshot.loading && !!screenshot.url && (
<div className={styles.preview}>
{
<a
className={styles.image}
href={screenshot.url}
target="_blank"
style={previewImageStyle}
aria-label={TEXTS.LABEL_FORM_SCREENSHOT_PREVIEW_LABEL_TEXT}
>
<Icon className={styles.icon} icon={IconName.Expand} />
</a>
}
</div>
)
}
</div>
)
}
{/* image */}
{
label && !isScreenshotEnabled && (
Expand Down

0 comments on commit e7aac4c

Please sign in to comment.