From 8ac0493a1f8e8753d0819bf7ebe841444df2326e Mon Sep 17 00:00:00 2001 From: luctra02 <64017398+luctra02@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:34:59 +0200 Subject: [PATCH] 301 style project page and blog page to look similiar (#302) * style(frontend): :lipstick: Change grid on project page and border styling on blog page * style(frontend): :lipstick: style blogcard component instead of changing blogcard to card * style(frontend): :lipstick: remove justify start for related satellite/project cards * style(frontend): :lipstick: change border radius on project and blogs and hover effect on projects * style(frontend): :lipstick: add the same on hover effect in project page as for related satellites/projects * fix(frontend): :bug: remove wrong content on satellite page * style(frontend): :lipstick: change related satellites/projects title and make all the cards center in flex * refactor(frontend): :recycle: Prettier write * refactor(frontend): :sparkles: Remove unused layout component and update CSS classes in ProjectsPage * feat(frontend): :sparkles: add layout to project page * refactor(frontend): :art: --------- Co-authored-by: Mads Hermansen --- .../projects/{ => [projectSlug]}/layout.tsx | 0 .../src/app/projects/[projectSlug]/page.tsx | 54 ++++++++++--------- frontend/src/app/projects/page.tsx | 20 +++---- .../app/satellites/[satelliteSlug]/page.tsx | 35 ++++++------ .../RelatedProjectsAndSatellites.tsx | 4 +- frontend/src/components/shadcn/card.tsx | 2 +- frontend/src/components/ui/blogCard.tsx | 2 +- 7 files changed, 62 insertions(+), 55 deletions(-) rename frontend/src/app/projects/{ => [projectSlug]}/layout.tsx (100%) diff --git a/frontend/src/app/projects/layout.tsx b/frontend/src/app/projects/[projectSlug]/layout.tsx similarity index 100% rename from frontend/src/app/projects/layout.tsx rename to frontend/src/app/projects/[projectSlug]/layout.tsx diff --git a/frontend/src/app/projects/[projectSlug]/page.tsx b/frontend/src/app/projects/[projectSlug]/page.tsx index b6d3276..3062aae 100644 --- a/frontend/src/app/projects/[projectSlug]/page.tsx +++ b/frontend/src/app/projects/[projectSlug]/page.tsx @@ -73,36 +73,38 @@ export default async function Page({ projectTitle = STRAPI_URL + projectTitle; } return ( -
+
{graphqlData.data.projects?.data[0].attributes?.satellites?.data .length != 0 && ( -

- Related Satellites -

+ <> +
+

Related Satellites

+
+
+ {graphqlData.data.projects?.data[0].attributes?.satellites?.data.map( + (satellite: any) => { + const previewImage = + satellite?.attributes?.previewImage?.data + ?.attributes?.url ?? undefined; + const satelliteObject: ProjectOrSatellite = { + id: satellite.id, + title: satellite.attributes.name, + previewImage: previewImage, + slug: satellite.attributes.name, + isProject: false, + }; + return ( + + ); + }, + )} +
+ )} -
- {graphqlData.data.projects?.data[0].attributes?.satellites?.data.map( - (satellite: any) => { - const previewImage = - satellite?.attributes?.previewImage?.data - ?.attributes?.url ?? undefined; - const satelliteObject: ProjectOrSatellite = { - id: satellite.id, - title: satellite.attributes.name, - previewImage: previewImage, - slug: satellite.attributes.name, - isProject: false, - }; - return ( - - ); - }, - )} -
); } diff --git a/frontend/src/app/projects/page.tsx b/frontend/src/app/projects/page.tsx index 10f6795..6e4081a 100644 --- a/frontend/src/app/projects/page.tsx +++ b/frontend/src/app/projects/page.tsx @@ -60,7 +60,7 @@ export default async function ProjectsPage() { } return ( -
+
Our Projects @@ -70,8 +70,8 @@ export default async function ProjectsPage() {
-
- {graphqlData.data.projects.data.map((project) => { +
+ {graphqlData.data.projects.data.map((project: any) => { let previewImage = project?.attributes?.previewImage?.data?.attributes ?.url; @@ -81,11 +81,11 @@ export default async function ProjectsPage() { } return ( - +
@@ -108,10 +108,12 @@ export default async function ProjectsPage() { {project?.attributes?.title}

- {SlicePreviewText( - project?.attributes?.content ?? - [], - )} + + {SlicePreviewText( + project?.attributes + ?.content ?? [], + )} +

diff --git a/frontend/src/app/satellites/[satelliteSlug]/page.tsx b/frontend/src/app/satellites/[satelliteSlug]/page.tsx index 63b197e..30cb72b 100644 --- a/frontend/src/app/satellites/[satelliteSlug]/page.tsx +++ b/frontend/src/app/satellites/[satelliteSlug]/page.tsx @@ -81,22 +81,25 @@ export default async function SatelliteInfoPage({
{/* Related projects */} - {satelliteInfo.relatedProjects?.length != 0 ? ( -
-

Related Projects

- -
- {satelliteInfo.relatedProjects?.map( - (project: ProjectOrSatellite) => ( - - ), - )} -
-
- ) : null} +
+ {satelliteInfo.relatedProjects?.length != 0 ? ( + <> +
+

Related Projects

+
+
+ {satelliteInfo.relatedProjects?.map( + (project: ProjectOrSatellite) => ( + + ), + )} +
+ + ) : null} +
); } diff --git a/frontend/src/components/RelatedProjectsAndSatellites.tsx b/frontend/src/components/RelatedProjectsAndSatellites.tsx index 3815383..4b48518 100644 --- a/frontend/src/components/RelatedProjectsAndSatellites.tsx +++ b/frontend/src/components/RelatedProjectsAndSatellites.tsx @@ -23,11 +23,11 @@ export default function RelatedProjectsAndSatellites({ return ( - + {project.title} diff --git a/frontend/src/components/shadcn/card.tsx b/frontend/src/components/shadcn/card.tsx index b07d192..91ba51c 100644 --- a/frontend/src/components/shadcn/card.tsx +++ b/frontend/src/components/shadcn/card.tsx @@ -9,7 +9,7 @@ const Card = React.forwardRef<