1- // import ArticleCard from "@/app/components/Articles/ArticleCard";
21import { API_ENDPOINTS } from "@/config/endpoints" ;
32import { getData } from "@/lib/helpers/dataFetchHelper" ;
43import { ApiResponse , Article } from "@/types/CommonTypes" ;
@@ -8,16 +7,14 @@ import Link from "next/link";
87export default async function Page ( {
98 params,
109} : {
11- params : { article : string ; category : string ; subcategory : string } ;
10+ params : Promise < { article : string ; category : string ; subcategory : string } > ;
1211} ) {
13- const { category, subcategory } = await params ;
14-
15- const articleSlug = ( await params ) . article ;
12+ const { article, category, subcategory } = await params ;
1613
1714 const response : ApiResponse < Article > = await getData (
18- `${ API_ENDPOINTS . ARTICLES } ?filters[slug][$eq]=${ articleSlug } `
15+ `${ API_ENDPOINTS . ARTICLES } ?filters[slug][$eq]=${ article } `
1916 ) ;
20- const [ { title, publishedAt, description } ] = response . data ; // select first object in array, and destructure properties
17+ const [ { title, publishedAt, description } ] = response . data ;
2118
2219 const publishedDate = new Date ( publishedAt ) . toLocaleDateString ( "en-US" , {
2320 year : "numeric" ,
@@ -40,8 +37,7 @@ export default async function Page({
4037 < li >
4138 < Link
4239 href = { `/${ category } /${ subcategory } ` }
43- className = "hover:text-blue-600"
44- >
40+ className = "hover:text-blue-600" >
4541 { subcategory }
4642 </ Link >
4743 </ li >
@@ -65,15 +61,13 @@ export default async function Page({
6561 </ p >
6662 < button
6763 className = " flex items-center gap-2 text-white text-lg px-3 py-1 rounded-md shadow hover:brightness-110 transition"
68- style = { { backgroundColor : "#2F7CC4" } }
69- >
64+ style = { { backgroundColor : "#2F7CC4" } } >
7065 English
7166 < svg
7267 xmlns = "http://www.w3.org/2000/svg"
7368 viewBox = "0 0 24 24"
7469 fill = "currentColor"
75- className = "size-6"
76- >
70+ className = "size-6" >
7771 < path
7872 fillRule = "evenodd"
7973 d = "M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z"
@@ -103,15 +97,13 @@ export default async function Page({
10397 </ h1 >
10498 < button
10599 className = " flex gap-2 text-white text-lg px-8 py-3 rounded-md shadow hover:brightness-110 transition"
106- style = { { backgroundColor : "#2F7CC4" } }
107- >
100+ style = { { backgroundColor : "#2F7CC4" } } >
108101 Download PDF
109102 < svg
110103 xmlns = "http://www.w3.org/2000/svg"
111104 viewBox = "0 0 24 24"
112105 fill = "currentColor"
113- className = "size-6"
114- >
106+ className = "size-6" >
115107 < path
116108 fillRule = "evenodd"
117109 d = "M12 2.25a.75.75 0 0 1 .75.75v11.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 1 1 1.06-1.06l3.22 3.22V3a.75.75 0 0 1 .75-.75Zm-9 13.5a.75.75 0 0 1 .75.75v2.25a1.5 1.5 0 0 0 1.5 1.5h13.5a1.5 1.5 0 0 0 1.5-1.5V16.5a.75.75 0 0 1 1.5 0v2.25a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3V16.5a.75.75 0 0 1 .75-.75Z"
0 commit comments