From e30e1855bf045e1c9b5a66255b4bf94ae9172d85 Mon Sep 17 00:00:00 2001 From: Benson Cho <100653148+bcho892@users.noreply.github.com> Date: Fri, 19 Jul 2024 22:55:07 +1200 Subject: [PATCH] Update about page items style (#656) * make about page items fit new style * add divider * adjust headings --- client/src/app/about/page.tsx | 51 ++++++----- .../generic/AboutSection/AboutSection.tsx | 88 ++++++++----------- 2 files changed, 67 insertions(+), 72 deletions(-) diff --git a/client/src/app/about/page.tsx b/client/src/app/about/page.tsx index dfcf638d0..35f0aa8d7 100644 --- a/client/src/app/about/page.tsx +++ b/client/src/app/about/page.tsx @@ -17,27 +17,36 @@ const About = async () => { const aboutItems = await sanityQuery(ABOUT_ITEMS_GROQ_QUERY) return ( -
-

- About us -

- {aboutItems.map((item, index) => { - // Even => Left, Odd => Right - const side = index % 2 === 0 ? "left" : "right" - return ( -
- -
- ) - })} - -
-
+ <> +
+
+

+ About us +

+ {aboutItems.map((item, index) => { + // Even => Left, Odd => Right + const side = index % 2 === 0 ? "left" : "right" + return ( +
+ + { + // Don't need divider for last row + index < aboutItems.length - 1 && ( +
+ ) + } +
+ ) + })} +
+
+
+ ) } diff --git a/client/src/components/generic/AboutSection/AboutSection.tsx b/client/src/components/generic/AboutSection/AboutSection.tsx index 646c9c82c..ee8f51cc7 100644 --- a/client/src/components/generic/AboutSection/AboutSection.tsx +++ b/client/src/components/generic/AboutSection/AboutSection.tsx @@ -2,9 +2,23 @@ import Image, { StaticImageData } from "next/image" type ImageSideVariants = "left" | "right" interface IAboutSectionProps { + /** + * The text that describes the name of the about section + * @example "Our Purpose: Snowboarding and Skiing" + */ title: string + /** + * The smaller text giving more detail about the section + * @example "lorem ipsum" + */ text: string + /** + * "left" or "right" based on the side the image is on + */ variant: ImageSideVariants + /** + * The image url, or `StaticImageData` originating from importing the image + */ imageSrc: string | StaticImageData } @@ -14,61 +28,33 @@ type Props = IAboutSectionProps const TextStyler = ({ title, text }: Omit) => { return ( -
-

- {title} -

-

{text}

-
+ <> +

{title}

+

{text}

+ ) } -const AboutSection = ({ title, text, imageSrc, variant }: Props) => { - if (variant === "left") { - return ( -
- about page image -
- -
-
- ) - } else { - return ( -
- <> -
- -
- about page image - - <> - about page image -
- -
- +const AboutSection = ({ title, text, imageSrc, variant = "left" }: Props) => { + return ( +
+ + about page image +
+
- ) - } +
+ ) } export default AboutSection