|
1 | 1 | import React, { useState } from 'react';
|
| 2 | +import RouterLink from 'next/link'; |
| 3 | + |
2 | 4 | import { makeStyles } from '@material-ui/core/styles';
|
3 | 5 | import Grid from '@material-ui/core/Grid';
|
4 | 6 | import Paper from '@material-ui/core/Paper';
|
5 |
| -import Button from '@material-ui/core/Button'; |
6 | 7 | import Typography from '@material-ui/core/Typography';
|
7 |
| -import Divider from '@material-ui/core/Divider'; |
8 | 8 | import List from '@material-ui/core/List';
|
9 | 9 | import ListItem from '@material-ui/core/ListItem';
|
10 | 10 | import ListItemIcon from '@material-ui/core/ListItemIcon';
|
11 | 11 | import ListItemText from '@material-ui/core/ListItemText';
|
| 12 | +import Link from '@material-ui/core/Link'; |
12 | 13 |
|
13 | 14 | import ArchiveIcon from '@material-ui/icons/Archive';
|
14 | 15 | import CreateIcon from '@material-ui/icons/Create';
|
@@ -92,36 +93,60 @@ const Form = () => (
|
92 | 93 | const buildFeatures = [
|
93 | 94 | {
|
94 | 95 | text: 'State management provided by Final Form!',
|
95 |
| - Icon: ArchiveIcon |
| 96 | + Icon: ArchiveIcon, |
| 97 | + href: 'https://final-form.org/react' |
96 | 98 | },
|
97 | 99 | {
|
98 | 100 | text: 'Multiple provided libraries - MaterialUI included!',
|
99 |
| - Icon: LocalLibraryIcon |
| 101 | + Icon: LocalLibraryIcon, |
| 102 | + link: '/renderer/component-api' |
100 | 103 | },
|
101 | 104 | {
|
102 | 105 | text: 'Validation - basic types are provided, supports async validators!',
|
103 |
| - Icon: VerifiedUserIcon |
| 106 | + Icon: VerifiedUserIcon, |
| 107 | + link: '/renderer/validators' |
104 | 108 | },
|
105 | 109 | {
|
106 | 110 | text: 'Conditions - hide and modify fields according to values of other fields!',
|
107 |
| - Icon: PlaylistAddCheckIcon |
| 111 | + Icon: PlaylistAddCheckIcon, |
| 112 | + link: '/renderer/condition' |
108 | 113 | },
|
109 | 114 | {
|
110 | 115 | text: 'Fully customizable - you can use any components you are using right now!',
|
111 |
| - Icon: EditAttributesIcon |
| 116 | + Icon: EditAttributesIcon, |
| 117 | + link: '/renderer/component-mapping' |
112 | 118 | },
|
113 | 119 | {
|
114 | 120 | text: 'Online editor - you can build your form using comfy DnD!',
|
115 |
| - Icon: CreateIcon |
| 121 | + Icon: CreateIcon, |
| 122 | + link: '/live-editor' |
116 | 123 | }
|
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 | +}); |
125 | 150 |
|
126 | 151 | const useStyles = makeStyles((theme) => ({
|
127 | 152 | cardsContainer: {
|
@@ -198,15 +223,19 @@ const LandingPageCards = () => {
|
198 | 223 | </Typography>
|
199 | 224 | <Paper elevation={3} className={classes.formState} square>
|
200 | 225 | <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 | + )} |
202 | 231 | </Paper>
|
203 | 232 | <Typography className={classes.cardQuestion} variant="h6" gutterBottom>
|
204 | 233 | Available features
|
205 | 234 | </Typography>
|
206 | 235 | <List component="nav" aria-label="features">
|
207 | 236 | {buildFeatures}
|
208 | 237 | </List>
|
209 |
| - <Typography variant="p" gutterBottom> |
| 238 | + <Typography variant="body2" gutterBottom> |
210 | 239 | ... and many more!
|
211 | 240 | </Typography>
|
212 | 241 | </Grid>
|
@@ -258,38 +287,3 @@ const LandingPageCards = () => {
|
258 | 287 | };
|
259 | 288 |
|
260 | 289 | 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