Skip to content

Commit afdaf13

Browse files
committed
stable initial pages
1 parent 75ca6f8 commit afdaf13

File tree

10 files changed

+73
-22
lines changed

10 files changed

+73
-22
lines changed

package-lock.json

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@testing-library/user-event": "^13.3.0",
1313
"react": "^17.0.2",
1414
"react-dom": "^17.0.2",
15+
"react-helmet": "^6.1.0",
1516
"react-redux": "^7.2.5",
1617
"react-router-dom": "^5.3.0",
1718
"react-scripts": "4.0.3",

public/vector/home.png

34.3 KB
Loading

src/app/app.js

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Suspense } from "react";
22
import Routes from "./routes";
3+
import { Helmet } from "react-helmet";
34
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
45
// @custome component
56
import MainBackdrop from "components/backdrop";
@@ -9,18 +10,30 @@ function App() {
910
<Suspense fallback={<MainBackdrop open />}>
1011
<Router>
1112
{/*
12-
A <Switch> looks through its children <Route>s and
13+
A <Switch> looks through its children <Route> and
1314
renders the first one that matches the current URL.
1415
*/}
1516
<Switch>
16-
{Routes.map((val, key) => (
17-
<Route
18-
key={key}
19-
component={val.component}
20-
path={val.path}
21-
exact={val.exact}
22-
/>
23-
))}
17+
{Routes.map((val, key) => {
18+
const Components = val.component;
19+
return (
20+
<Route
21+
key={key}
22+
path={val.path}
23+
exact={val.exact}
24+
render={(props) => {
25+
return (
26+
<>
27+
<Helmet>
28+
<title>{val?.name} - Your App</title>
29+
</Helmet>
30+
<Components {...props} pageParam={val} />
31+
</>
32+
);
33+
}}
34+
/>
35+
);
36+
})}
2437
</Switch>
2538
</Router>
2639
</Suspense>

src/app/routes.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ const Routes = [
2727
{
2828
path: "/something-wrong",
2929
component: React.lazy(() => import("pages/500")),
30-
name: "SOMETHING WRONG",
30+
name: "Something Wrong",
3131
exact: true,
3232
},
3333
{
3434
path: "*",
3535
component: React.lazy(() => import("pages/404")),
36-
name: "PAGE NOT FOUND",
36+
name: "Page not found",
3737
exact: true,
3838
},
3939
];

src/index.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import ReactDOM from "react-dom";
33
import Root from "app/root";
44
import reportWebVitals from "./reportWebVitals";
55

6-
ReactDOM.render(
7-
<React.StrictMode>
8-
<Root />
9-
</React.StrictMode>,
10-
document.getElementById("root")
11-
);
6+
ReactDOM.render(<Root />, document.getElementById("root"));
127

138
// If you want to start measuring performance in your app, pass a function
149
// to log results (for example: reportWebVitals(console.log))

src/pages/404.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function Main() {
3636
<Text gutterBottom>
3737
We can't seem to find the pages you're looking for.
3838
</Text>
39-
<Button variant="contained" size="small" onClick={loadPages}>
39+
<Button variant="contained" onClick={loadPages}>
4040
Go Back
4141
</Button>
4242
</Box>

src/pages/500.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function Main() {
3333
Something went wrong
3434
</Text>
3535
<Text gutterBottom>Looks like server failed to load yout request</Text>
36-
<Button variant="contained" size="small" onClick={loadPages}>
36+
<Button variant="contained" onClick={loadPages}>
3737
Reload Pages
3838
</Button>
3939
</Box>

src/pages/Home.js

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
11
import React, { memo } from "react";
22
import { connect } from "react-redux";
33
import Text from "@mui/material/Typography";
4+
import Button from "@mui/material/Button";
5+
import Box from "@mui/material/Box";
46

57
function Home(props) {
68
return (
7-
<>
8-
<Text>HENLO</Text>
9-
</>
9+
<Box
10+
height="100vh"
11+
width="100vw"
12+
display="flex"
13+
alignItems="center"
14+
justifyContent="center"
15+
flexDirection="column"
16+
>
17+
<img width="350px" src="/vector/home.png" alt="vector" />
18+
<Text align="center" variant="h4" gutterBottom>
19+
Welcome to React Starterkit
20+
</Text>
21+
<Text align="center" gutterBottom>
22+
Get started by editing pages/Home.js
23+
</Text>
24+
<Box display="flex" justifyContent="center">
25+
<Button color="primary" variant="outlined">
26+
See Documentation
27+
</Button>
28+
</Box>
29+
</Box>
1030
);
1131
}
1232

src/style/material.theme.js

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const mainTheme = createTheme({
7373
MuiButton: {
7474
defaultProps: {
7575
disableElevation: true,
76+
size: "small"
7677
},
7778
},
7879
},

0 commit comments

Comments
 (0)