-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#bugFix for nested routes. Seo and match correction throughouth the app
- Loading branch information
1 parent
5ad02c6
commit 3a35f14
Showing
16 changed files
with
204 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import React from 'react'; | ||
import GuestLayout from './guest-layout'; | ||
|
||
export default () => ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { useParams } from 'react-router'; | ||
import { toName } from '../../utils/text'; | ||
|
||
const NestedRoute2 = () => { | ||
const { name } = useParams(); | ||
return ( | ||
<h2> | ||
Hi, <span className="is-capitalized">{toName(name || '')}!</span> | ||
</h2> | ||
); | ||
}; | ||
|
||
export default NestedRoute2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Outlet } from 'react-router'; | ||
import GuestLayout from '../guest-layout'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
const NestedRoute = () => { | ||
return ( | ||
<GuestLayout> | ||
<div className="container p-2" style={{ minHeight: '20rem' }}> | ||
<h1 className="title mt-5">I am a nested Route</h1> | ||
<hr /> | ||
<ul> | ||
<li> | ||
<Link to="/nested/simple">A simple route</Link> | ||
</li> | ||
<li> | ||
<Link to="/nested/john-doe">John Doe as param</Link> | ||
</li> | ||
<li> | ||
<Link to="/nested/cathrine">Cathrine as param</Link> | ||
</li> | ||
</ul> | ||
<hr /> | ||
<Outlet /> | ||
</div> | ||
|
||
</GuestLayout> | ||
); | ||
}; | ||
|
||
export default NestedRoute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const NestedRoute1 = () => { | ||
return ( | ||
<h2>I am a sub nested route 1</h2> | ||
); | ||
}; | ||
|
||
export default NestedRoute1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
export const toName = (str: string) => { | ||
return str.replace(/-/g, ' ').split(' ').map((s) => { | ||
return s.charAt(0).toUpperCase() + s.slice(1); | ||
}).join(' '); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,7 @@ export interface IRoute { | |
}; | ||
routes?: IRoute[]; | ||
index?: boolean; | ||
cache?: false | { | ||
maxAge: number, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.