Skip to content

Commit

Permalink
fix: disable "Add Value" button if the initial input has no value
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed May 28, 2020
1 parent 03f6a69 commit 3346545
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const plugin: CmsEditorFieldRendererPlugin = {
})}
<Cell span={12} className={style.addButton}>
<ButtonDefault
disabled={value[0] === undefined}
onClick={() => appendValue("")}
>{t`+ Add value`}</ButtonDefault>
</Cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const plugin: CmsEditorFieldRendererPlugin = {
})}
<Cell span={12} className={style.addButton}>
<ButtonDefault
disabled={value[0] === undefined}
onClick={() => appendValue("")}
>{t`+ Add value`}</ButtonDefault>
</Cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const plugin: CmsEditorFieldRendererPlugin = {
{value.slice(1).map((item, index) => {
const Bind = getBind(index + 1);
return (
<Cell span={12} key={index+1}>
<Cell span={12} key={index + 1}>
<Bind>
{bind => (
<Input
Expand All @@ -76,6 +76,7 @@ const plugin: CmsEditorFieldRendererPlugin = {
})}
<Cell span={12} className={style.addButton}>
<ButtonDefault
disabled={value[0] === undefined}
onClick={() => appendValue("")}
>{t`+ Add value`}</ButtonDefault>
</Cell>
Expand Down

0 comments on commit 3346545

Please sign in to comment.