forked from usds/us-forms-system-starter-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d38aeac
Showing
12 changed files
with
11,001 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "presets": ["react", "es2015"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Directories to ignore | ||
node_modules/ | ||
.babelcache/ | ||
build/ | ||
|
||
# Files to ignore | ||
._* | ||
.cache | ||
.DS_Store | ||
npm-debug.log | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { IndexRedirect, Route, Router, useRouterHistory } from 'react-router'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore, combineReducers } from 'redux'; | ||
import { createHistory } from 'history'; | ||
|
||
import route from './js/routes.jsx'; | ||
import reducer from './js/reducers'; | ||
import Form from './js/components/Form.jsx'; | ||
|
||
const store = createStore(combineReducers(reducer)); | ||
|
||
const browserHistory = useRouterHistory(createHistory)({ | ||
basename: '/' | ||
}); | ||
|
||
console.log(browserHistory); | ||
console.log(route); | ||
|
||
ReactDOM.render( | ||
( | ||
<Provider store={store}> | ||
<Router history={browserHistory}> | ||
{route} | ||
</Router> | ||
</Provider> | ||
), document.getElementById('root') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
|
||
import FormApp from 'us-forms-system/lib/js/containers/FormApp'; | ||
import formConfig from '../config/form'; | ||
|
||
export default function Form({ location, children }) { | ||
return ( | ||
<FormApp formConfig={formConfig} currentLocation={location}> | ||
{children} | ||
</FormApp> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import fullName from '../definitions/fullName'; | ||
|
||
const formConfig = { | ||
title: 'Form', | ||
subTitle: 'Test', | ||
formId: '', | ||
urlPrefix: '/', | ||
trackingPrefix: 'form-', | ||
transformForSubmit: '', | ||
submitUrl: '', | ||
introduction: '', | ||
confirmation: '', | ||
defaultDefinitions: { | ||
fullName | ||
}, | ||
chapters: { | ||
firstSection: { | ||
title: 'First Section', | ||
pages: { | ||
firstPage: { | ||
path: 'first-section/first-page', | ||
title: 'First Page', | ||
uiSchema: {}, | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
fullName | ||
} | ||
} | ||
}, | ||
secondPage: { | ||
path: 'first-section/second-page', | ||
title: 'Second Page', | ||
uiSchema: {}, | ||
schema: { | ||
type: 'object', | ||
properties: {} | ||
} | ||
} | ||
} | ||
}, | ||
secondSection: { | ||
title: 'Second Section', | ||
pages: { | ||
|
||
} | ||
} | ||
} | ||
}; | ||
|
||
export default formConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const suffixes = [ | ||
'Jr.', | ||
'Sr.', | ||
'II', | ||
'III', | ||
'IV' | ||
]; | ||
|
||
const schema = { | ||
type: 'object', | ||
properties: { | ||
first: { | ||
type: 'string', | ||
pattern: '^.*\\S.*', | ||
minLength: 1, | ||
maxLength: 30 | ||
}, | ||
middle: { | ||
type: 'string' | ||
}, | ||
last: { | ||
type: 'string', | ||
pattern: '^.*\\S.*', | ||
minLength: 2, | ||
maxLength: 30 | ||
}, | ||
suffix: { | ||
type: 'string', | ||
'enum': suffixes | ||
}, | ||
}, | ||
required: [ | ||
'first', | ||
'last' | ||
] | ||
}; | ||
|
||
export default schema; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import formConfig from './config/form'; | ||
import createSchemaFormReducer from 'us-forms-system/lib/js/state'; | ||
|
||
export default { | ||
form: createSchemaFormReducer(formConfig) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { createRoutes } from 'us-forms-system/lib/js/helpers'; | ||
|
||
import formConfig from './config/form'; | ||
import Form from './components/Form.jsx'; | ||
|
||
const route = { | ||
path: '/', | ||
component: Form, | ||
indexRoute: { onEnter: (nextState, replace) => replace('/first-section/first-page') }, | ||
childRoutes: createRoutes(formConfig), | ||
}; | ||
|
||
export default route; |
Oops, something went wrong.