diff --git a/ui/component/common/form-components/form-field.jsx b/ui/component/common/form-components/form-field.jsx index 8a481201d..01e58c165 100644 --- a/ui/component/common/form-components/form-field.jsx +++ b/ui/component/common/form-components/form-field.jsx @@ -7,6 +7,7 @@ import MarkdownPreview from 'component/common/markdown-preview'; import { openEditorMenu, stopContextMenu } from 'util/context-menu'; import { MAX_CHARACTERS_IN_COMMENT as defaultTextAreaLimit } from 'constants/comments'; import 'easymde/dist/easymde.min.css'; +import Button from 'component/button'; type Props = { name: string, @@ -35,6 +36,8 @@ type Props = { range?: number, min?: number, max?: number, + quickActionLabel?: string, + quickActionHandler?: any => any, }; export class FormField extends React.PureComponent { @@ -78,6 +81,8 @@ export class FormField extends React.PureComponent { blockWrap, charCount, textAreaMaxLength = defaultTextAreaLimit, + quickActionLabel, + quickActionHandler, ...inputProps } = this.props; const errorMessage = typeof error === 'object' ? error.message : error; @@ -85,6 +90,13 @@ export class FormField extends React.PureComponent { ? ({ children: innerChildren }) => {innerChildren} : ({ children: innerChildren }) => {innerChildren}; + const quickAction = + quickActionLabel && quickActionHandler ? ( +
+
+ ) : null; + let input; if (type) { if (type === 'radio') { @@ -127,7 +139,12 @@ export class FormField extends React.PureComponent { input = (
- +
+
+ +
+ {quickAction} +
{ ); input = ( - +
+
+ +
+ {quickAction} +