Skip to content

Commit c0a82cb

Browse files
committed
Using react-router-dom
1 parent fed5d0d commit c0a82cb

File tree

7 files changed

+140
-11
lines changed

7 files changed

+140
-11
lines changed

src/Wishmaster/Views/Shared/WebView.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ private async void WebView_Loaded(object sender, RoutedEventArgs e)
1616
await WebViewElement.EnsureCoreWebView2Async();
1717
if (WebViewElement.CoreWebView2 is not null)
1818
{
19-
WebViewElement.CoreWebView2.Navigate("http://localhost:5080/index.html");
19+
WebViewElement.CoreWebView2.Navigate("http://localhost:5080");
2020
}
2121
}
2222
}

src/Wishmaster/client-app/package-lock.json

Lines changed: 82 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Wishmaster/client-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"dependencies": {
1111
"dayjs": "^1.11.4",
1212
"react": "^18.0.0",
13-
"react-dom": "^18.0.0"
13+
"react-dom": "^18.0.0",
14+
"react-router-dom": "^6.3.0"
1415
},
1516
"devDependencies": {
1617
"@types/react": "^18.0.0",
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import { useState } from 'react'
22
import logo from './logo.svg'
3+
import { BrowserRouter, Route, Link, Routes } from "react-router-dom";
4+
import MainPage from './Components/Pages/MainPage/MainPage';
5+
import SettingsPage from './Components/Pages/SettingsPage/SettingsPage';
36

47
function App() {
58
return (
6-
<div>
7-
123
8-
</div>
9-
)
9+
<BrowserRouter>
10+
<Routes>
11+
<Route path="/" element={<MainPage />} />
12+
<Route path="/settings" element={<SettingsPage />} />
13+
<Route path="*" element={<div>Not found</div>} />
14+
</Routes>
15+
</BrowserRouter>
16+
);
1017
}
1118

1219
export default App
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as React from 'react';
2+
import { Link } from 'react-router-dom';
3+
4+
interface IMainLayoutProps {
5+
children?: React.ReactNode;
6+
}
7+
8+
const MainLayout: React.FC<IMainLayoutProps> = (props) => {
9+
return (
10+
<div>
11+
<div>
12+
<Link to="/">Main</Link>
13+
<Link to="/settings">Settings</Link>
14+
</div>
15+
<div>{props.children}</div>
16+
</div>
17+
);
18+
};
19+
20+
export default MainLayout;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as React from 'react';
2+
import MainLayout from '../../Layout/MainLayout/MainLayout';
3+
4+
const MainPage: React.FC = () => {
5+
return (
6+
<MainLayout>
7+
<div>MAIN</div>
8+
</MainLayout>
9+
);
10+
};
11+
12+
export default MainPage;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as React from 'react';
2+
import MainLayout from '../../Layout/MainLayout/MainLayout';
3+
4+
const SettingsPage: React.FC = () => {
5+
return (
6+
<MainLayout>
7+
<div>SETTINGS</div>
8+
</MainLayout>
9+
);
10+
};
11+
12+
export default SettingsPage;

0 commit comments

Comments
 (0)