File tree Expand file tree Collapse file tree 7 files changed +38
-9
lines changed Expand file tree Collapse file tree 7 files changed +38
-9
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ this variable that you find suitable.
199199 - ` this.get('foos.1') // => {bar: 'bak'} `
200200 - ` this.get('foos.1.bar') // => 'bak' `
201201 - ` this.get() // returns whole form's attributes object `
202- - ` set(name, value) ` - sets a ` value ` for an input with a specified ` name ` ;
202+ - ` set(name, value) ` - sets a ` value ` for an input with a specified ` name ` .
203203- ` set(object) ` - sets multiple values at once. Each key in the object
204204 corresponds to input name, and values are input values.
205205- ` merge(name, value) ` - merges given ` value ` object with value of input with
@@ -267,6 +267,11 @@ class Page extends Component {
267267}
268268```
269269
270+ ## Credits
271+
272+ Hugs and thanks to [ ogrechishkina] ( https://github.com/ogrechishkina ) for her
273+ support and building all of the CSS for demo application.
274+
270275## Running Demo locally
271276
272277```
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
12< html >
23 < head >
34 < title > React Form Base Demo</ title >
Original file line number Diff line number Diff line change 11import React , { PureComponent } from 'react' ;
2- import InputPrerequisites from './components/InputPrerequisites ' ;
2+ import { Intro , InputPrerequisites } from './components' ;
33import * as Forms from './forms' ;
44
55const sections = [
@@ -50,10 +50,10 @@ export default class App extends PureComponent {
5050 if ( [ 'foo' , 'bar' , 'baz' ] . includes ( attrs . account ) ) {
5151 reject ( { account : 'has already been taken' } ) ;
5252 } else {
53- resolve ( { status : 200 } ) ;
53+ resolve ( true ) ;
5454 }
5555 } , 3000 ) ;
56- } ) . then ( ( ) => form . setState ( { saving : false , success : true } ) )
56+ } ) . then ( success => form . setState ( { success , saving : false } ) )
5757 . catch ( errors => form . setState ( { errors, saving : false } ) ) ;
5858 } ) ;
5959 } ;
@@ -77,6 +77,7 @@ export default class App extends PureComponent {
7777 < a href = "#form11" className = { this . isActive ( 'form11' ) } > { Forms . Form11 . title } </ a >
7878 </ div >
7979 < div className = "content paper flex-item p-20" >
80+ < Intro />
8081 < div id = "inputs" > < InputPrerequisites /> </ div >
8182 < div id = "form01" > < Forms . Form1 { ...this . formProps ( 'form1' ) } /> </ div >
8283 < div id = "form02" > < Forms . Form2 { ...this . formProps ( 'form2' ) } /> </ div >
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import marked from 'marked' ;
3+
4+ const content = `
5+ This demo application shows the basic usage examples of [react-form-base](https://github.com/akuzko/react-form-base).
6+ It renders a number of forms, each of which demonstrates specific use case scenario
7+ with a short description.
8+
9+ **NOTE:** Please keep in mind that source code, rendered on the left side, is
10+ not 100% accurate, since it does not contain all of the markup (including
11+ \`className\`s), which was omitted for brevity.
12+ ` ;
13+
14+ export default function Intro ( ) {
15+ return (
16+ < div className = "pb-20 mb-20 border-bottom" >
17+ < h1 > React Form Base Demo</ h1 >
18+ < div className = "mb-20" dangerouslySetInnerHTML = { { __html : marked ( content ) } } />
19+ </ div >
20+ ) ;
21+ }
Original file line number Diff line number Diff line change 1+ export Intro from './Intro' ;
12export InputPrerequisites from './InputPrerequisites' ;
23export Source from './Source' ;
Original file line number Diff line number Diff line change @@ -56,10 +56,10 @@ const SOURCE = [['Form11.jsx', `
5656 if (['foo', 'bar', 'baz'].includes(data.account)) {
5757 reject({ account: 'has already been taken' });
5858 } else {
59- resolve({ status: 200 } );
59+ resolve(true );
6060 }
6161 }, 3000);
62- }).then(() => form.setState({ saving: false, success: true }))
62+ }).then(success => form.setState({ success, saving: false }))
6363 .catch(errors => form.setState({ errors, saving: false }));
6464 });
6565 }
Original file line number Diff line number Diff line change @@ -90,9 +90,9 @@ const DESCRIPTION = dedent`
9090 like \`'numbers.0'\`, \`'numbers.1'\` and so on will be validated with rules
9191 defined for \`'numbers.*'\`.
9292
93- **NOTE:** wildcard validation is not limited to a string values. Your form
94- may have a collection of nested _objects_ and you may want to define property
95- validation for each of them with something like
93+ **NOTE:** wildcard validation is not limited to validating collection of strings.
94+ Your form may have a collection of nested _objects_ and you may want to define
95+ their property validation for each of them with something like
9696
9797 \`\`\`js
9898 validations = {
You can’t perform that action at this time.
0 commit comments