File tree 3 files changed +25
-5
lines changed
3 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ import ApplicationOptionComponent from './ApplicationOption';
5
5
import { useMouseWheel } from '../../hooks/listeners/useScrolling' ;
6
6
import { ApplicationPreview } from './ApplicationPreview' ;
7
7
import { openTab } from '../../utils' ;
8
- // import TileGameComponent from './components/tile-game/TileGame ';
8
+ import { useNavigate } from 'react-router ' ;
9
9
10
10
export default function ApplicationSelection ( ) : ReactElement {
11
+ const navigate = useNavigate ( ) ;
12
+
11
13
const {
12
14
chooseSelection,
13
15
currentSelection,
@@ -20,7 +22,7 @@ export default function ApplicationSelection(): ReactElement {
20
22
choice : AppChoice . PictureCards ,
21
23
name : 'Picture Cards' ,
22
24
onSelect : ( ) => {
23
- console . log ( 'Selected Picture Cards ') ;
25
+ navigate ( '/picture-cards ') ;
24
26
} ,
25
27
} ,
26
28
{
Original file line number Diff line number Diff line change @@ -4,8 +4,11 @@ import useImages from '../../hooks/tile-game/useImages';
4
4
import { useTileAsset } from '../../hooks' ;
5
5
import { TileAsset as TileAssetT } from '../../types' ;
6
6
import TileGame from './TileGame' ;
7
+ import { HomeIcon } from '../../svg/HomeIcon' ;
8
+ import { useNavigate } from 'react-router' ;
7
9
8
10
export default function TileGameRoute ( ) : ReactElement {
11
+ const navigate = useNavigate ( ) ;
9
12
const { images } = useImages ( ) ;
10
13
const { create : createTileAsset } = useTileAsset ( ) ;
11
14
@@ -16,6 +19,16 @@ export default function TileGameRoute(): ReactElement {
16
19
17
20
return (
18
21
< div >
22
+ < div
23
+ className = "
24
+ absolute top-5 left-5
25
+ hover:cursor-pointer hover:animate-wiggle
26
+ active:animate-jump-out
27
+ "
28
+ onClick = { ( ) => navigate ( '/' ) }
29
+ >
30
+ < HomeIcon />
31
+ </ div >
19
32
< TileGame tiles = { tileAssets } />
20
33
</ div >
21
34
) ;
Original file line number Diff line number Diff line change @@ -3,14 +3,19 @@ import ReactDOM from 'react-dom/client';
3
3
import './index.css' ;
4
4
import App from './App' ;
5
5
import reportWebVitals from './reportWebVitals' ;
6
+ import { BrowserRouter , Routes , Route } from 'react-router' ;
7
+ import TileGameRoute from './components/tile-game/TileGameRoute' ;
6
8
7
9
const root = ReactDOM . createRoot (
8
10
document . getElementById ( 'root' ) as HTMLElement ,
9
11
) ;
10
12
root . render (
11
- < React . StrictMode >
12
- < App />
13
- </ React . StrictMode > ,
13
+ < BrowserRouter >
14
+ < Routes >
15
+ < Route index element = { < App /> } />
16
+ < Route path = "/picture-cards" element = { < TileGameRoute /> } />
17
+ </ Routes >
18
+ </ BrowserRouter > ,
14
19
) ;
15
20
16
21
// If you want to start measuring performance in your app, pass a function
You can’t perform that action at this time.
0 commit comments