Skip to content

Commit 215fe1b

Browse files
feat: increase number of article items displayed on top africa page t… (kaliacad#235)
* feat: increase number of article items displayed on top africa page to 15 * feat: show 12 items in gallery view and 18 items in list view
1 parent f826123 commit 215fe1b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/pages/TopAfrica.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function Africa() {
3131

3232
// Pagination states
3333
const [currentPage, setCurrentPage] = useState(1);
34-
const articlesPerPage = 9; // Display 9 or 12 items per page
34+
const articlesPerPage = showCard ? 12 : 18; // Display 9 or 12 items per page
3535

3636
const handleClicked = () => {
3737
setShowCard(!showCard);
@@ -113,18 +113,18 @@ export default function Africa() {
113113
// Display loading component if data is loading
114114
if (loading)
115115
return (
116-
<div className='flex justify-center m-4 h-full items-center w-full'>
116+
<div className='flex items-center justify-center w-full h-full m-4'>
117117
<Loading />
118118
</div>
119119
);
120120
if (error) return <p>Error: {error.message}</p>;
121121
return (
122122
<main>
123-
<div className='african p-4'>
124-
<h1 className='text-2xl text-white font-bold text-center mb-4'>Top Wikimedia Articles in Africa</h1>
123+
<div className='p-4 african'>
124+
<h1 className='mb-4 text-2xl font-bold text-center text-white'>Top Wikimedia Articles in Africa</h1>
125125

126-
<div className='flex flex-wrap justify-center items-center gap-5 my-3'>
127-
<button onClick={handleClicked} className='bg-blue-500 text-white px-4 py-2 rounded'>
126+
<div className='flex flex-wrap items-center justify-center gap-5 my-3'>
127+
<button onClick={handleClicked} className='px-4 py-2 text-white bg-blue-500 rounded'>
128128
Articles List/Article Gallery
129129
</button>
130130
<DatePicker onChange={handleChange} />
@@ -164,17 +164,17 @@ export default function Africa() {
164164
))}
165165
</div>
166166
) : (
167-
<div className='flex flex-col justify-center items-center'>
167+
<div className='flex flex-col items-center justify-center'>
168168
<ListArticlesResult articlesData={currentArticles} />
169169
</div>
170170
))}
171171
{data.length == 0 && (
172-
<div className='w-full flex text-white justify-center mb-3'>
172+
<div className='flex justify-center w-full mb-3 text-white'>
173173
<p>No Article Post</p>
174174
</div>
175175
)}
176176

177-
<div className='flex justify-center items-center gap-4 my-5 mb-12'>
177+
<div className='flex items-center justify-center gap-4 my-5 mb-12'>
178178
<button
179179
onClick={() => paginate(currentPage - 1)}
180180
disabled={currentPage === 1}

0 commit comments

Comments
 (0)