Commit f41518bd authored by Jeff Avallone's avatar Jeff Avallone

Moving FormActions rendering to App

parent 13cfcca8
...@@ -4,6 +4,7 @@ import * as Sentry from '@sentry/browser'; ...@@ -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 { ...@@ -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 { ...@@ -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'; ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment