Skip to content

Commit bbb70b7

Browse files
added links tutorial
1 parent 7e9e246 commit bbb70b7

File tree

1 file changed

+65
-10
lines changed

1 file changed

+65
-10
lines changed

app/src/tutorial/RouteLinks.tsx

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,78 @@
11
import React from 'react';
2-
import { Link, RouteComponentProps } from 'react-router-dom';
3-
2+
import { Link, withRouter, RouteComponentProps } from 'react-router-dom';
3+
import { makeStyles } from '@material-ui/core/styles';
4+
import links2 from '../../../resources/route_links_tutorial_images/links2.png';
5+
import links3 from '../../../resources/route_links_tutorial_images/links3.png';
6+
import links4 from '../../../resources/route_links_tutorial_images/links4.png';
7+
import links6 from '../../../resources/route_links_tutorial_images/links6.png';
8+
import linksCanvas from '../../../resources/route_links_tutorial_images/links-canvas.png';
49
// import Grid from '@material-ui/core/Grid';
510

611
// import ComponentPanel from '../components/left/ComponentPanel';
712
// import HTMLPanel from '../components/left/HTMLPanel';
813

914
// Left-hand portion of the app, where component options are displayed
1015

11-
const RouteLinks: React.FC<{
12-
classes: any;
13-
setPage: Function;
14-
}> = ({ classes, setPage }) => {
16+
const ComponentTree: React.FC<RouteComponentProps> = () => {
17+
const body = document.querySelector('body');
18+
body.style.overflowY = 'auto';
19+
const useStyles = makeStyles({
20+
title: {
21+
color: '#14151f',
22+
fontSize: 54
23+
},
24+
text: {
25+
color: '#2e2f3e',
26+
fontSize: 24
27+
},
28+
wrapper: {
29+
margin: '30px 30px 30px 30px',
30+
width: 'auto'
31+
},
32+
smallImg: {
33+
borderRadius: '3px',
34+
height: '300px',
35+
marginRight: '20px'
36+
},
37+
largeImg: {
38+
height: '700px'
39+
},
40+
imgWrapper: {
41+
display: 'flex',
42+
flexDirection: 'row',
43+
alignItems: 'center',
44+
// border: '1px solid black',
45+
width: 'auto'
46+
}
47+
});
48+
const classes = useStyles();
1549
return (
16-
<div>
17-
RouteLinks
50+
<div className={classes.wrapper}>
51+
<h1 className={classes.title}>Next.js Route Links</h1>
52+
<h2>Route Links are only available for Next.js projects.</h2>
53+
<p className={classes.text}>Users are able to drag-and-drop 'Link' components onto the canvas which allow navigation to different pages.</p>
54+
<div className={classes.imgWrapper}>
55+
<img className={classes.largeImg} src={linksCanvas}></img>
56+
</div>
57+
<p className={classes.text}>Each page found in the 'Pages' section can be navigated to via a 'Link'. Clicking on the 'Route Link' dropdown will display all the created pages in your application.</p>
58+
<div className={classes.imgWrapper}>
59+
<img className={classes.smallImg} src={links2}></img>
60+
<img className={classes.smallImg} src={links3}></img>
61+
</div>
62+
<p className={classes.text}>The code generator will automatically <code>import Link from 'next/link'</code> and create your Link component in the bottom panel.</p>
63+
<div className={classes.imgWrapper}>
64+
<img className={classes.largeImg} src={links4}></img>
65+
</div>
66+
<p className={classes.text}>Clicking on a Link component on the canvas will navigate to the corresponding page.</p>
67+
<div className={classes.imgWrapper}>
68+
<img className={classes.smallImg} src={links6}></img>
69+
</div>
70+
<p className={classes.text}>For more information on 'Link' for Next.js, please <a href="https://nextjs.org/docs/api-reference/next/link" target="_blank">visit the official documentation on nextjs.org.</a></p>
71+
<Link to={`/tutorial`}>
72+
<button>Tutorial</button>
73+
</Link>
1874
</div>
1975
);
2076
};
2177

22-
export default RouteLinks;
23-
78+
export default withRouter(ComponentTree);

0 commit comments

Comments
 (0)