Skip to content

Commit 6574056

Browse files
Merge pull request #25 from visual-heuristics/feat_uiImprove
modify url and links; background color fixed
2 parents fc267de + c6abcd4 commit 6574056

File tree

6 files changed

+50
-13
lines changed

6 files changed

+50
-13
lines changed

src/App.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,21 @@ const theme = createTheme({
2323

2424
function App() {
2525
return (
26+
<div className={styles.root}>
2627
<div className={styles.App}>
2728
<ThemeProvider theme={theme}>
2829
<NavigationBar />
2930
<Switch>
3031
<Route path="/" component={HomePage} exact />
31-
<Route path="/page1" component={PageOne} />
32-
<Route path="/page2" component={PageTwo} />
32+
<Route path="/problem" component={PageOne} />
33+
<Route path="/vfg" component={PageTwo} />
3334
<Route path="/page3" component={PageThree} />
34-
<Route path="/page4" component={PageFour} />
35+
<Route path="/demo" component={PageFour} />
3536
</Switch>
3637
</ThemeProvider>
3738
{/* <div>this is app</div> */}
3839
</div>
40+
</div>
3941
);
4042
}
4143

src/App.module.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
.root{
2+
position: absolute;
3+
top: 0;
4+
left: 0;
5+
right: 0;
6+
bottom: 0;
7+
background-color: #ffffff;
8+
9+
}
110
.App {
211
text-align: center;
312
display: flex;
413
flex-direction: column;
514
align-items: center;
615
justify-content: center;
16+
717
}
818

src/components/navigationBar/navigationBar.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ const useStyles = makeStyles((theme) => ({
2828
link: {
2929
margin: theme.spacing(1, 1.5),
3030
cursor: 'pointer'
31+
},
32+
alink: {
33+
color: '#ffffff',
34+
textDecoration: 'none'
3135
}
3236
}));
3337

3438
const nav = {
35-
problem: '/page1',
36-
vfg: '/page2',
37-
manual: '/page3',
38-
demo: '/page4',
39+
problem: '/problem',
40+
vfg: '/vfg',
41+
manual: 'https://planimation.github.io/documentation/ ',
42+
demo: '/demo',
3943
home: '/'
4044
};
4145

@@ -46,7 +50,12 @@ function NavigationBar() {
4650

4751
const handleClick = (url) => {
4852
setUrl(url);
49-
history.push(nav[url]);
53+
if(url==='manual'){
54+
window.location.href(nav[url])
55+
}else{
56+
history.push(nav[url]);
57+
58+
}
5059
}
5160

5261
return(
@@ -62,8 +71,8 @@ function NavigationBar() {
6271
<Link variant="button" color="inherit" onClick={()=>handleClick('vfg')} className={classes.link}>
6372
VFG
6473
</Link>
65-
<Link variant="button" color="inherit" onClick={()=>handleClick('manual')} className={classes.link}>
66-
User Manual
74+
<Link variant="button" color="inherit" className={classes.link}>
75+
<a href={'https://planimation.github.io/documentation/'} target='_blank' rel="noreferrer" className={classes.alink}>User Manual</a>
6776
</Link>
6877
<Link variant="button" color="inherit" onClick={()=>handleClick('demo')} className={classes.link}>
6978
Demo

src/pages/HomePage/home.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,23 @@ export default function Home() {
139139

140140
const handleOnClick = (num) => {
141141
setNum( num + 1 );
142-
history.push('/page'+num);
142+
switch(num){
143+
case 1:
144+
history.push('/problem');
145+
break;
146+
case 2:
147+
history.push('/vfg');
148+
break;
149+
case 3:
150+
window.open('https://planimation.github.io/documentation/')
151+
break;
152+
case 4:
153+
history.push('/demo');
154+
break;
155+
default: return;
156+
}
157+
158+
143159
}
144160

145161
return (

src/pages/PageOne/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class PageOne extends React.Component {
4949

5050
handleStore = (content)=> {
5151
localStorage.setItem('fileContent', content);
52-
window.location.href = '/page4';
52+
window.location.href = '/demo';
5353
}
5454

5555
handleNewURL = (urlString) => {

src/pages/PageTwo/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class PageTwo extends React.Component {
172172
<Button variant="contained" color="default" onClick={this.handleOnClick} text-align="left">Cancel</Button>
173173
<Button variant="contained" color="primary" startIcon={<CloudUploadIcon />} onClick={()=>{
174174
// eslint-disable-next-line no-restricted-globals
175-
location.href = '/page4';
175+
location.href = '/demo';
176176
}} text-align="right">Continue</Button>
177177
</div>
178178
</Container>

0 commit comments

Comments
 (0)