Skip to content

Commit 7710a44

Browse files
committed
add routing
1 parent 756bbc2 commit 7710a44

File tree

9 files changed

+124
-15
lines changed

9 files changed

+124
-15
lines changed

examples/ecommerce-jewellery-store/package-lock.json

Lines changed: 43 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/ecommerce-jewellery-store/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"@progress/kendo-theme-default": "^9.1.0",
2727
"@progress/kendo-theme-utils": "^9.1.0",
2828
"react": "^18.3.1",
29-
"react-dom": "^18.3.1"
29+
"react-dom": "^18.3.1",
30+
"react-router-dom": "^6.27.0"
3031
},
3132
"devDependencies": {
3233
"@eslint/js": "^9.11.1",

examples/ecommerce-jewellery-store/src/App.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
1+
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
12
import Header from "@/components/Header";
23
import Footer from "@/components/Footer";
4+
import Contacts from "@/pages/Contacts";
5+
import ThankYou from "@/pages/ThankYou";
6+
import ShoppingCart from "@/pages/ShoppingCart";
7+
import PaymentDetails from "@/pages/PaymentDetails";
38
import { AllProductsListView } from "./pages/AllProductsListView";
9+
import Home from "@/pages/Home";
410
import "@progress/kendo-theme-default/dist/all.css";
511
import "@progress/kendo-theme-utils/dist/all.scss";
612
import { SizedParent } from "./components/SizedParent";
713

814
function App() {
9-
10-
1115
return (
12-
<>
13-
<Header />
16+
<Router>
1417
<SizedParent>
15-
<AllProductsListView></AllProductsListView>
18+
<Header />
19+
<Routes>
20+
<Route path="/home" element={<Home />} />
21+
<Route path="/paymentdetails" element={<PaymentDetails />} />
22+
<Route path="/shoppingcart" element={<ShoppingCart />} />
23+
<Route path="/thankyou" element={<ThankYou />} />
24+
<Route path="/contacts" element={<Contacts />} />
25+
<Route path="/products" element={<AllProductsListView />} />
26+
</Routes>
27+
<Footer />
1628
</SizedParent>
17-
<Footer />
18-
</>
29+
</Router>
1930
);
2031
}
2132

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { StrictMode } from 'react'
2-
import { createRoot } from 'react-dom/client'
3-
import App from './App.tsx'
4-
import './styles.css'
1+
import { StrictMode } from 'react';
2+
import { createRoot } from 'react-dom/client';
3+
import App from './App';
4+
import './styles.css';
55

66
createRoot(document.getElementById('root')!).render(
77
<StrictMode>
88
<App />
9-
</StrictMode>,
10-
)
9+
</StrictMode>
10+
);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
const Contacts: React.FC = () => {
4+
return (
5+
<>
6+
Contacts
7+
</>
8+
);
9+
};
10+
11+
export default Contacts;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
const Home: React.FC = () => {
4+
return (
5+
<>
6+
Home Page
7+
</>
8+
);
9+
};
10+
11+
export default Home;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
const PaymentDetails: React.FC = () => {
4+
return (
5+
<>
6+
Payment Details
7+
</>
8+
);
9+
};
10+
11+
export default PaymentDetails;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
const ShoppingCart: React.FC = () => {
4+
return (
5+
<>
6+
Shopping Cart
7+
</>
8+
);
9+
};
10+
11+
export default ShoppingCart;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
const ThankYou: React.FC = () => {
4+
return (
5+
<>
6+
Thank you page
7+
</>
8+
);
9+
};
10+
11+
export default ThankYou;

0 commit comments

Comments
 (0)