Skip to content

Commit

Permalink
fix(frontend): 🐛 remove first article definition and fix page size (#…
Browse files Browse the repository at this point in the history
…401)

* fix(frontend): 🐛 remove first article definition and fix page size

* style(frontend): 🎨 prettier

* style(frontend): 💄 change bg for project card

* refactor(frontend): 🔥 remove unecessary <span> in project page

* style(frontend): 🎨 prettier

---------

Co-authored-by: Lucas Tran <lucastra@stud.ntnu.no>
  • Loading branch information
2 people authored and GitHub committed May 7, 2024
1 parent 20a573f commit dcf988c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 31 deletions.
17 changes: 0 additions & 17 deletions frontend/src/app/blog/blogDataCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,7 @@ export default async function BlogDataCards({
<>
<div className="grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3">
<BlogpageButtons className="col-span-full" />
{/* Only map fist article */}
{articles.map((article: BlogPost) => {
if (article.firstArticle) {
return (
<React.Fragment key={article.key}>
<FullBlogCard
className="col-span-full"
article={article}
/>
</React.Fragment>
);
}
})}

{articles.map((article: BlogPost) => {
if (article.firstArticle) {
return;
}
return (
<React.Fragment key={article.key}>
<FullBlogCard article={article} />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default async function BlogPage({

const result = await fetchArticlePages({
currentPage: currentPage,
pageSize: 7,
pageSize: 9,
tag: tag,
});

Expand Down
12 changes: 5 additions & 7 deletions frontend/src/app/projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default async function ProjectsPage() {
key={project.id}
data-testid="projectCard"
>
<Card className="h-full w-full hover:border-primary">
<Card className="h-full w-full bg-background hover:border-primary">
<CardHeader></CardHeader>
<CardContent>
<div className="w-full">
Expand All @@ -112,12 +112,10 @@ export default async function ProjectsPage() {
{project?.attributes?.title}
</CardTitle>
<p className="break-words">
<span>
{SlicePreviewText(
project?.attributes
?.content ?? [],
)}
</span>
{SlicePreviewText(
project?.attributes?.content ??
[],
)}
</p>
</div>
</CardContent>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/BlogPaginator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function BlogPaginator({
let currentPage = parseInt(page ?? "1", 10);
currentPage = currentPage > 1 ? currentPage : 1;

const pageSize = 7;
const pageSize = 9;
const totalPages = Math.ceil(Number(totalArticles) / pageSize);

function handlePageChange(page: number) {
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/lib/data/fetchArticleInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ export default async function fetchArticlePages({
pageSize: number;
tag: string | null;
}) {
let firstArticle = true;

let graphqlData;

if (!tag) {
Expand Down Expand Up @@ -137,7 +135,6 @@ export default async function fetchArticlePages({

articleList.push({
key: article.id,
firstArticle: firstArticle,
title,
content,
coverImage,
Expand All @@ -148,8 +145,6 @@ export default async function fetchArticlePages({
avatarURL,
slug: article.attributes.slug,
});

firstArticle = false;
});

const totalArticles = graphqlData.data?.articles?.meta?.pagination?.total;
Expand Down

0 comments on commit dcf988c

Please sign in to comment.