Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
feat(Formbot): Support for yup via validationSchema; Add Context prov…
Browse files Browse the repository at this point in the history
…ider and EasyInput consumer (#20)
  • Loading branch information
Hurshal Patel authored and kylealwyn committed Feb 26, 2019
1 parent e783265 commit 2e457be
Show file tree
Hide file tree
Showing 16 changed files with 406 additions and 211 deletions.
14 changes: 13 additions & 1 deletion docs/wrapper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import React, { Component } from 'react';
import { createGlobalStyle } from 'styled-components';
import { ThemeProvider } from '../src';

const GlobalStyle = createGlobalStyle `
* {
box-sizing: border-box;
}
`

class App extends Component {
render() {
return <ThemeProvider>{this.props.children}</ThemeProvider>;
return (
<>
<GlobalStyle />
<ThemeProvider>{this.props.children}</ThemeProvider>
</>
);
}
}

Expand Down
116 changes: 86 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"release": "standard-version && git push --follow-tags"
},
"dependencies": {
"lodash": "^4.17.11",
"mitt": "^1.1.3",
"polished": "^2.0.0",
"popper.js": "^1.14.7",
Expand Down Expand Up @@ -63,8 +62,8 @@
"jest": "^24.1.0",
"jest-styled-components": "^6.3.1",
"npm-run-all": "^4.1.5",
"react": "^16.8.2",
"react-dom": "^16.8.2",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"react-router-dom": "^4.2.2",
"react-test-renderer": "^16.8.2",
"rimraf": "^2.6.3",
Expand All @@ -73,7 +72,8 @@
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-filesize": "^6.0.1",
"standard-version": "^5.0.0",
"styled-components": "^4.1.3"
"styled-components": "^4.1.3",
"yup": "^0.26.10"
},
"resolutions": {
"babel-core": "^7.0.0-bridge.0"
Expand Down
5 changes: 4 additions & 1 deletion src/Form/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { css } from 'styled-components';
import Icon from '../Icon';
import FormError from '../Form/FormError';
import Flex from '../Flex';
import { createEasyInput } from './EasyInput';
import { createComponent } from '../utils';

const CheckboxContainer = createComponent({
Expand Down Expand Up @@ -44,7 +45,7 @@ const StyledLabel = createComponent({
`,
});

export default class Checkbox extends React.Component {
class Checkbox extends React.Component {
static propTypes = {
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
Expand Down Expand Up @@ -148,3 +149,5 @@ export default class Checkbox extends React.Component {
);
}
}

export default createEasyInput(Checkbox);
10 changes: 7 additions & 3 deletions src/Form/CheckboxGroup.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Flex from '../Flex';
import Box from '../Box';
import Checkbox from './Checkbox';
import FormError from './FormError';
import Box from '../Box';
import Flex from '../Flex';
import { createEasyInput } from './EasyInput';

export default class CheckboxGroup extends Component {
class CheckboxGroup extends Component {
static propTypes = {
name: PropTypes.string.isRequired,
color: PropTypes.string,
Expand All @@ -22,6 +23,7 @@ export default class CheckboxGroup extends Component {
};

static defaultProps = {
defaultValue: [],
color: 'primary',
horizontal: false,
onChange() {},
Expand Down Expand Up @@ -90,3 +92,5 @@ export default class CheckboxGroup extends Component {
);
}
}

export default createEasyInput(CheckboxGroup);
Loading

0 comments on commit 2e457be

Please sign in to comment.