1
1
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' ;
4
9
// import Grid from '@material-ui/core/Grid';
5
10
6
11
// import ComponentPanel from '../components/left/ComponentPanel';
7
12
// import HTMLPanel from '../components/left/HTMLPanel';
8
13
9
14
// Left-hand portion of the app, where component options are displayed
10
15
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 ( ) ;
15
49
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 >
18
74
</ div >
19
75
) ;
20
76
} ;
21
77
22
- export default RouteLinks ;
23
-
78
+ export default withRouter ( ComponentTree ) ;
0 commit comments