react-gravity-form
Advanced tools
Comparing version 0.0.1 to 0.0.3
import React from 'react'; | ||
import { Box } from 'rebass'; | ||
import { Button } from '../../styles'; | ||
export default ({ | ||
field, pages, nextStep, prevStep, isNextDisabled, | ||
}) => { | ||
export default ({ field, pages, nextStep, prevStep, isNextDisabled }) => { | ||
const { | ||
@@ -23,18 +20,15 @@ id, | ||
pageNumber, | ||
styledComponents, | ||
} = field; | ||
const SButton = | ||
styledComponents && styledComponents['Button'] ? styledComponents['Button'] : 'button'; | ||
return ( | ||
<Box className="form-field"> | ||
{pageNumber - 1 > 1 && <Button onClick={e => prevStep(e)}>{previousButton.text}</Button>} | ||
{pageNumber - 1 > 1 && <SButton onClick={(e) => prevStep(e)}>{previousButton.text}</SButton>} | ||
{pageNumber <= pages && ( | ||
<Button | ||
type="button" | ||
onClick={nextStep} | ||
color="pink" | ||
p="7px 20px" | ||
mt={20} | ||
disabled={isNextDisabled} | ||
> | ||
<SButton onClick={nextStep} color="pink" p="7px 20px" mt={20} disabled={isNextDisabled}> | ||
{nextButton.text} | ||
</Button> | ||
</SButton> | ||
)} | ||
@@ -41,0 +35,0 @@ </Box> |
27
index.js
import React, { Component } from "react"; | ||
import { basicAuthRequest as fetch } from "../../utils"; | ||
import RenderFields from "./RenderFields"; | ||
import FormError from "./FormError"; | ||
import FormConfirmation from "./FormConfirmation"; | ||
import RenderFields from "./FormElements/RenderFields"; | ||
import FormError from "./FormElements/FormError"; | ||
import FormConfirmation from "./FormElements/FormConfirmation"; | ||
import { validateField } from "./Helpers/validation"; | ||
import { Loading } from "../styles"; | ||
import Submit from "./Submit"; | ||
import Submit from "./FormElements/Submit"; | ||
@@ -33,5 +31,3 @@ class GravityForm extends Component { | ||
this._isMounted = true; | ||
const form = await fetch( | ||
`${backendUrl}/wp-json/wismon/v1/gravityforms/${formID}` | ||
) | ||
const form = await fetch(`${backendUrl}/v1/gravityforms/${formID}`) | ||
.then(response => { | ||
@@ -198,3 +194,3 @@ if (response.ok) { | ||
const req = await fetch( | ||
`${backendUrl}/wp-json/wismon/v1/gravityforms/${formID}/submissions`, | ||
`${backendUrl}/v1/gravityforms/${formID}/submissions`, | ||
{ | ||
@@ -276,3 +272,9 @@ method: "POST", | ||
} = this.state; | ||
const { title, submitIcon, saveStateToHtmlField } = this.props; | ||
const { | ||
title, | ||
submitIcon, | ||
saveStateToHtmlField, | ||
styledComponents | ||
} = this.props; | ||
const { Button, Loading } = styledComponents || false; | ||
const { cssClass } = formData; | ||
@@ -331,2 +333,3 @@ | ||
<RenderFields | ||
styledComponents={styledComponents} | ||
fields={formData.fields} | ||
@@ -352,2 +355,4 @@ formValues={formValues} | ||
<Submit | ||
Button={Button} | ||
Loading={Loading} | ||
formData={formData} | ||
@@ -354,0 +359,0 @@ submitIcon={submitIcon} |
{ | ||
"name": "react-gravity-form", | ||
"version": "0.0.1", | ||
"description": "A component for including Gravity Forms on React apps via the Wordpress API", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@bitbucket.org/gohike/gravity-forms.git" | ||
}, | ||
"keywords": [ | ||
"React", | ||
"Gravity", | ||
"Form", | ||
"Forms", | ||
"GravityForms", | ||
"Component", | ||
"Wordpress", | ||
"API", | ||
"Headless", | ||
"CMS" | ||
], | ||
"author": "Hike", | ||
"license": "ISC", | ||
"homepage": "https://bitbucket.org/gohike/gravity-forms#readme", | ||
"devDependencies": { | ||
"react": "^16.8.1" | ||
} | ||
"name": "react-gravity-form", | ||
"version": "0.0.3", | ||
"description": "A component for including Gravity Forms on React apps via the Wordpress API", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@bitbucket.org/gohike/gravity-forms.git" | ||
}, | ||
"keywords": [ | ||
"React", | ||
"Gravity", | ||
"Form", | ||
"Forms", | ||
"GravityForms", | ||
"Component", | ||
"Wordpress", | ||
"API", | ||
"Headless", | ||
"CMS" | ||
], | ||
"author": "Hike", | ||
"license": "ISC", | ||
"homepage": "https://bitbucket.org/gohike/gravity-forms#readme", | ||
"devDependencies": { | ||
"react": "^16.8.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52290
1851