Moving FormActions rendering to App
This commit is contained in:
parent
13cfcca85e
commit
f41518bd92
@ -4,6 +4,7 @@ import * as Sentry from '@sentry/browser';
|
|||||||
import URLSearchParams from '@ungap/url-search-params';
|
import URLSearchParams from '@ungap/url-search-params';
|
||||||
|
|
||||||
import Form from 'components/Form';
|
import Form from 'components/Form';
|
||||||
|
import FormActions from 'components/FormActions';
|
||||||
import Loader from 'components/Loader';
|
import Loader from 'components/Loader';
|
||||||
import Message from 'components/Message';
|
import Message from 'components/Message';
|
||||||
|
|
||||||
@ -160,12 +161,12 @@ class App extends React.PureComponent {
|
|||||||
const formProps = {
|
const formProps = {
|
||||||
onSubmit: this.handleSubmit,
|
onSubmit: this.handleSubmit,
|
||||||
syntax,
|
syntax,
|
||||||
expr,
|
expr
|
||||||
actions: {
|
};
|
||||||
|
const actions = {
|
||||||
permalinkUrl,
|
permalinkUrl,
|
||||||
svgLink,
|
svgLink,
|
||||||
pngLink
|
pngLink
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const renderProps = {
|
const renderProps = {
|
||||||
onRender: this.handleSvgMarkup,
|
onRender: this.handleSvgMarkup,
|
||||||
@ -174,7 +175,9 @@ class App extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<Form { ...formProps } />
|
<Form { ...formProps }>
|
||||||
|
<FormActions { ...actions } />
|
||||||
|
</Form>
|
||||||
|
|
||||||
{ loading && <Loader /> }
|
{ loading && <Loader /> }
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@ import ExpandIcon from 'react-feather/dist/icons/chevrons-down';
|
|||||||
|
|
||||||
import style from './style.module.css';
|
import style from './style.module.css';
|
||||||
|
|
||||||
import FormActions from 'components/FormActions';
|
|
||||||
|
|
||||||
const syntaxList = [
|
const syntaxList = [
|
||||||
{ id: 'js', label: 'JavaScript' },
|
{ id: 'js', label: 'JavaScript' },
|
||||||
{ id: 'pcre', label: 'PCRE' }
|
{ id: 'pcre', label: 'PCRE' }
|
||||||
@ -38,7 +36,7 @@ class Form extends React.PureComponent {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
actions
|
children
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { expr, syntax } = this.state;
|
const { expr, syntax } = this.state;
|
||||||
|
|
||||||
@ -63,7 +61,7 @@ class Form extends React.PureComponent {
|
|||||||
</select>
|
</select>
|
||||||
<ExpandIcon />
|
<ExpandIcon />
|
||||||
</div>
|
</div>
|
||||||
<FormActions { ...actions } />
|
{ children }
|
||||||
</form>
|
</form>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
@ -72,8 +70,11 @@ class Form extends React.PureComponent {
|
|||||||
Form.propTypes = {
|
Form.propTypes = {
|
||||||
expr: PropTypes.string,
|
expr: PropTypes.string,
|
||||||
syntax: PropTypes.string,
|
syntax: PropTypes.string,
|
||||||
actions: PropTypes.object,
|
onSubmit: PropTypes.func.isRequired,
|
||||||
onSubmit: PropTypes.func.isRequired
|
children: PropTypes.oneOfType([
|
||||||
|
PropTypes.arrayOf(PropTypes.node),
|
||||||
|
PropTypes.node
|
||||||
|
]).isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Form;
|
export default Form;
|
||||||
|
Loading…
Reference in New Issue
Block a user