Skip to content

Commit 6ec3ff1

Browse files
committed
Add links to features list
1 parent 99a224a commit 6ec3ff1

File tree

2 files changed

+48
-54
lines changed

2 files changed

+48
-54
lines changed

packages/react-renderer-demo/src/app/src/components/landing-page/formExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const FormTemplate = ({ formFields }) => {
3333
{({ valid }) => (
3434
<div className={classes.formButtons}>
3535
<Button disabled={!valid} type="submit" color="primary" variant="contained">
36-
Submit
36+
Show
3737
</Button>
3838
</div>
3939
)}

packages/react-renderer-demo/src/app/src/components/landing-page/landing-page-cards.js

Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import React, { useState } from 'react';
2+
import RouterLink from 'next/link';
3+
24
import { makeStyles } from '@material-ui/core/styles';
35
import Grid from '@material-ui/core/Grid';
46
import Paper from '@material-ui/core/Paper';
5-
import Button from '@material-ui/core/Button';
67
import Typography from '@material-ui/core/Typography';
7-
import Divider from '@material-ui/core/Divider';
88
import List from '@material-ui/core/List';
99
import ListItem from '@material-ui/core/ListItem';
1010
import ListItemIcon from '@material-ui/core/ListItemIcon';
1111
import ListItemText from '@material-ui/core/ListItemText';
12+
import Link from '@material-ui/core/Link';
1213

1314
import ArchiveIcon from '@material-ui/icons/Archive';
1415
import CreateIcon from '@material-ui/icons/Create';
@@ -92,36 +93,60 @@ const Form = () => (
9293
const buildFeatures = [
9394
{
9495
text: 'State management provided by Final Form!',
95-
Icon: ArchiveIcon
96+
Icon: ArchiveIcon,
97+
href: 'https://final-form.org/react'
9698
},
9799
{
98100
text: 'Multiple provided libraries - MaterialUI included!',
99-
Icon: LocalLibraryIcon
101+
Icon: LocalLibraryIcon,
102+
link: '/renderer/component-api'
100103
},
101104
{
102105
text: 'Validation - basic types are provided, supports async validators!',
103-
Icon: VerifiedUserIcon
106+
Icon: VerifiedUserIcon,
107+
link: '/renderer/validators'
104108
},
105109
{
106110
text: 'Conditions - hide and modify fields according to values of other fields!',
107-
Icon: PlaylistAddCheckIcon
111+
Icon: PlaylistAddCheckIcon,
112+
link: '/renderer/condition'
108113
},
109114
{
110115
text: 'Fully customizable - you can use any components you are using right now!',
111-
Icon: EditAttributesIcon
116+
Icon: EditAttributesIcon,
117+
link: '/renderer/component-mapping'
112118
},
113119
{
114120
text: 'Online editor - you can build your form using comfy DnD!',
115-
Icon: CreateIcon
121+
Icon: CreateIcon,
122+
link: '/live-editor'
116123
}
117-
].map(({ text, Icon, href, link }, idx) => (
118-
<ListItem button key={idx}>
119-
<ListItemIcon>
120-
<Icon />
121-
</ListItemIcon>
122-
<ListItemText primary={text} />
123-
</ListItem>
124-
));
124+
].map(({ text, Icon, href, link }, idx) => {
125+
const children = (
126+
<ListItem button>
127+
<ListItemIcon>
128+
<Icon />
129+
</ListItemIcon>
130+
<ListItemText primary={text} />
131+
</ListItem>
132+
);
133+
134+
if (link) {
135+
return (
136+
<RouterLink href={link} key={idx}>
137+
<Link href={link} style={{ textDecoration: 'none', color: 'inherit' }}>
138+
{children}
139+
</Link>
140+
</RouterLink>
141+
);
142+
}
143+
144+
return (
145+
<Link href={href} rel="noopener noreferrer" target="_blank" key={idx} style={{ textDecoration: 'none', color: 'inherit' }}>
146+
{children}
147+
</Link>
148+
);
149+
});
125150

126151
const useStyles = makeStyles((theme) => ({
127152
cardsContainer: {
@@ -198,15 +223,19 @@ const LandingPageCards = () => {
198223
</Typography>
199224
<Paper elevation={3} className={classes.formState} square>
200225
<FormExample setFormState={setFormState} />
201-
{!formState ? <Typography variant="p">Click on submit to show values</Typography> : <pre>{JSON.stringify(formState, null, 2)}</pre>}
226+
{!formState ? (
227+
<Typography variant="body2">Click on the button to show values</Typography>
228+
) : (
229+
<pre>{JSON.stringify(formState, null, 2)}</pre>
230+
)}
202231
</Paper>
203232
<Typography className={classes.cardQuestion} variant="h6" gutterBottom>
204233
Available features
205234
</Typography>
206235
<List component="nav" aria-label="features">
207236
{buildFeatures}
208237
</List>
209-
<Typography variant="p" gutterBottom>
238+
<Typography variant="body2" gutterBottom>
210239
... and many more!
211240
</Typography>
212241
</Grid>
@@ -258,38 +287,3 @@ const LandingPageCards = () => {
258287
};
259288

260289
export default LandingPageCards;
261-
262-
/*
263-
<Paper elevation={0} className={classes.card}>
264-
<Typography className={classes.cardQuestion} variant="h6" gutterBottom>
265-
How to install it?
266-
</Typography>
267-
<Typography variant="h5" gutterBottom>
268-
Installation
269-
</Typography>
270-
<Typography color="textSecondary" gutterBottom>
271-
Add react form renderer
272-
</Typography>
273-
<pre className={classes.codeSnippet}>
274-
<code className={classes.languageSh}>$ npm install @data-driven-forms/react-form-renderer -S</code>
275-
</pre>
276-
<pre className={classes.codeSnippet}>
277-
<code className={classes.languageSh}>$ yarn add @data-driven-forms/react-form-renderer</code>
278-
</pre>
279-
<Divider className={classes.divider} />
280-
<Typography color="textSecondary" gutterBottom>
281-
Choose your component mapper
282-
</Typography>
283-
<pre className={classes.codeSnippet}>
284-
<code className={classes.languageSh}>$ npm install @data-driven-forms/pf4-component-mapper -S</code>
285-
</pre>
286-
<pre className={classes.codeSnippet}>
287-
<code className={classes.languageSh}>$ yarn add @data-driven-forms/pf4-component-mapper</code>
288-
</pre>
289-
</Paper>
290-
291-
<div style={{ background: '#1d1f21', paddingTop: 16 }}>
292-
<CodeEditor value={value} />
293-
</div>
294-
295-
*/

0 commit comments

Comments
 (0)