From 2010a6b7ebede44e1c6bbe802277d49906e5bb7b Mon Sep 17 00:00:00 2001 From: mmv Date: Tue, 21 May 2019 16:16:12 +0400 Subject: [PATCH] add sendmax and button link for the amount field in sending funds form --- package.json | 1 + src/components/forms/GnoForm/index.jsx | 6 +- src/components/layout/ButtonLink/index.jsx | 29 +++++ src/components/layout/ButtonLink/index.scss | 79 ++++++++++++++ src/components/layout/Row/index.jsx | 2 +- src/components/layout/Row/index.scss | 5 + .../SendFunds/TokenSelectField/index.jsx | 9 +- .../SendModal/screens/SendFunds/index.jsx | 103 +++++++++++------- yarn.lock | 9 +- 9 files changed, 197 insertions(+), 46 deletions(-) create mode 100644 src/components/layout/ButtonLink/index.jsx create mode 100644 src/components/layout/ButtonLink/index.scss diff --git a/package.json b/package.json index 55cb529a..7f9296f1 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "react": "^16.8.6", "react-dom": "^16.8.6", "react-final-form": "5.1.0", + "react-final-form-listeners": "^1.0.2", "react-hot-loader": "4.8.7", "react-infinite-scroll-component": "^4.5.2", "react-redux": "7.0.3", diff --git a/src/components/forms/GnoForm/index.jsx b/src/components/forms/GnoForm/index.jsx index 64afb53e..8cb2c8ec 100644 --- a/src/components/forms/GnoForm/index.jsx +++ b/src/components/forms/GnoForm/index.jsx @@ -15,6 +15,7 @@ type Props = { padding?: number, validation?: (values: Object) => Object | Promise, initialValues?: Object, + formMutators: Object, } const stylesBasedOn = (padding: number): $Shape => ({ @@ -24,15 +25,16 @@ const stylesBasedOn = (padding: number): $Shape => ({ }) const GnoForm = ({ - onSubmit, validation, initialValues, children, padding = 0, + onSubmit, validation, initialValues, children, padding = 0, formMutators, }: Props) => (
( - {children(rest.submitting, rest.validating, rest)} + {children(rest.submitting, rest.validating, rest, rest.form.mutators)}
)} /> diff --git a/src/components/layout/ButtonLink/index.jsx b/src/components/layout/ButtonLink/index.jsx new file mode 100644 index 00000000..a1f165e8 --- /dev/null +++ b/src/components/layout/ButtonLink/index.jsx @@ -0,0 +1,29 @@ +// @flow +/* eslint-disable react/button-has-type */ +/* eslint-disable react/default-props-match-prop-types */ +import * as React from 'react' +import cn from 'classnames/bind' +import styles from './index.scss' + +const cx = cn.bind(styles) + +type Props = { + type: 'button' | 'submit' | 'reset', + size?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl', + weight?: 'light' | 'regular' | 'bolder' | 'bold', + color?: 'soft' | 'medium' | 'dark' | 'white' | 'fancy' | 'primary' | 'secondary' | 'warning' | 'disabled', +} + +const GnoButtonLink = ({ type, size, weight, color, ...props }: Props) => ( +