File tree 4 files changed +28
-12
lines changed
4 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { Country } from "../types";
3
3
4
4
const CountryCard = ( { country } : { country : Country } ) => {
5
5
return (
6
- < Link href = { `/${ country . cca3 } ` } >
6
+ < Link href = { `/country/ ${ country . cca3 } ` } >
7
7
< article className = "p-5 rounded-lg shadow-sm bg-white dark:bg-gray-700 space-y-7 border border-gray-300/50 dark:border-gray-500/50 md:hover:scale-[104%] transition-transform" >
8
8
< div className = "aspect-video" >
9
9
< img
Original file line number Diff line number Diff line change
1
+ import BackButton from "@/app/components/shared/BackButton" ;
2
+
3
+ const NotFound = ( ) => {
4
+ return (
5
+ < div className = "px-4 md:container mt-10 space-y-10" >
6
+ < BackButton />
7
+ < p > Country not found</ p >
8
+ </ div >
9
+ ) ;
10
+ } ;
11
+
12
+ export default NotFound ;
Original file line number Diff line number Diff line change @@ -4,21 +4,13 @@ import Link from "next/link";
4
4
import { Button } from "@/components/ui/button" ;
5
5
import { Country } from "@/app/types" ;
6
6
import BackButton from "@/app/components/shared/BackButton" ;
7
+ import { notFound } from "next/navigation" ;
7
8
8
9
const CountryPage = async ( { params } : { params : { cca3 : string } } ) => {
9
- const { data, error } = await getCountry ( params . cca3 ) ;
10
+ const { data } = await getCountry ( params . cca3 ) ;
10
11
const country = data as Country ;
11
12
12
- if ( error ) {
13
- return (
14
- < div className = "container" >
15
- < div className = "my-10" >
16
- < BackButton />
17
- </ div >
18
- < p > { error } </ p >
19
- </ div >
20
- ) ;
21
- }
13
+ if ( ! country ) notFound ( )
22
14
23
15
const nativeName = country . name . nativeName
24
16
? Object . values ( country . name . nativeName ) [ 0 ]
Original file line number Diff line number Diff line change
1
+ import BackButton from "./components/shared/BackButton" ;
2
+
3
+ const NotFound = ( ) => {
4
+ return (
5
+ < div className = "px-4 md:container mt-10 space-y-10" >
6
+ < BackButton />
7
+ < p > Page not found</ p >
8
+ </ div >
9
+ ) ;
10
+ } ;
11
+
12
+ export default NotFound ;
You can’t perform that action at this time.
0 commit comments