Skip to content

#87: better explain what the example project is all about #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions packages/example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,39 @@ function App(props: AppProps & { selectedExample: ReactExampleDescription }) {
paddingTop='0'
paddingBottom='size-800'
>
<div className='container'>
<View padding='size-100'>
<Heading>react, json-schema, jsonforms.io, react-spectrum</Heading>
Generate{' '}
<a href='https://react-spectrum.adobe.com/' target='_blank'>
react-spectrum
</a>{' '}
based forms quickly by leveraging{' '}
<a href='https://json-schema.org/' target='_blank'>
json-schemas
</a>{' '}
for your object structure definition/validation, and{' '}
<a href='https://www.jsonforms.io' target='_blank'>
jsonforms.io
</a>{' '}
- choose a same in the 'Examples' section to preview predefined
forms (try for example one of the 'Categorization' examples). You
can also modify the examples in the editors and save them to local
storage to play with them later.
</View>
</div>
<div className='container'>
<div className='App-Form'>
<View padding='size-100'>
<Heading>{props.selectedExample.label}</Heading>
<Heading>Form: {props.selectedExample.label}</Heading>
{props.getComponent(props.selectedExample)}
<JsonFormsDispatch onChange={props.onChange} />
</View>
</div>

<div className='App-Data tabs'>
<View padding='size-100'>
<Heading>JsonForms Examples</Heading>
<Heading>Example Forms</Heading>
<ExamplesPicker {...props} onChange={setExampleByName} />
<Tabs defaultSelectedKey='boundData'>
<Item key='boundData' title='Bound data'>
Expand All @@ -125,31 +146,31 @@ function App(props: AppProps & { selectedExample: ReactExampleDescription }) {
/>
</Content>
</Item>
<Item key='uiSchema' title='UI Schema'>
<Item key='schema' title='Json-Schema'>
<Content margin='size-100'>
<TextArea
value={
JSON.stringify(
props.selectedExample.uischema,
props.selectedExample.schema,
circularReferenceReplacer(),
2
) || ''
}
onChange={updateCurrentUISchema}
onChange={updateCurrentSchema}
/>
</Content>
</Item>
<Item key='schema' title='Schema'>
<Item key='uiSchema' title='UI Schema'>
<Content margin='size-100'>
<TextArea
value={
JSON.stringify(
props.selectedExample.schema,
props.selectedExample.uischema,
circularReferenceReplacer(),
2
) || ''
}
onChange={updateCurrentSchema}
onChange={updateCurrentUISchema}
/>
</Content>
</Item>
Expand Down