Skip to content

Commit a361453

Browse files
committed
Init product pages
1 parent a80c72e commit a361453

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
export const ProductItem = () => {
4+
return (
5+
<div>
6+
<h1>ProductItem Components</h1>
7+
</div>
8+
);
9+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
export const ProductList = () => {
4+
return (
5+
<div>
6+
<h1>ProductList Components</h1>
7+
</div>
8+
);
9+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import { ProductItem } from 'src/components/Product/ProductItem';
3+
import { MainLayout } from 'src/layouts/MainLayout';
4+
5+
const _ProductItemPage = () => {
6+
return (
7+
<MainLayout>
8+
<ProductItem />
9+
</MainLayout>
10+
);
11+
};
12+
const ProductItemPage = React.memo(_ProductItemPage);
13+
export default ProductItemPage;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import { ProductList } from 'src/components/Product/ProductList';
3+
import { MainLayout } from 'src/layouts/MainLayout';
4+
5+
const _ProductListPage = () => {
6+
return (
7+
<MainLayout>
8+
<ProductList />
9+
</MainLayout>
10+
);
11+
};
12+
const ProductListPage = React.memo(_ProductListPage);
13+
export default ProductListPage;

src/routes/ProductRoutes.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React, { lazy, Suspense } from 'react';
2+
import { Route, Switch } from 'react-router-dom';
3+
import { PATH } from 'src/constants/paths';
4+
import { Loading } from 'src/components/Loading';
5+
import { AuthenticatedGuard } from 'src/guards/AuthenticatedGuard';
6+
const ProductList = lazy(
7+
() => import('src/pages/ProductPages/ProductListPage'),
8+
);
9+
const ProductItem = lazy(
10+
() => import('src/pages/ProductPages/ProductItemPage'),
11+
);
12+
13+
export const AuthRoutes = () => {
14+
return (
15+
<Switch>
16+
<AuthenticatedGuard
17+
exact
18+
path={PATH.PROFILE}
19+
component={() => (
20+
<Suspense fallback={<Loading />}>
21+
<ProductList />
22+
</Suspense>
23+
)}
24+
/>
25+
<AuthenticatedGuard
26+
exact
27+
path={PATH.PROFILE}
28+
component={() => (
29+
<Suspense fallback={<Loading />}>
30+
<ProductItem />
31+
</Suspense>
32+
)}
33+
/>
34+
</Switch>
35+
);
36+
};

0 commit comments

Comments
 (0)