From 1e0991e44042a4b158c3df8432145033235b866a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=BCndig?= Date: Mon, 12 Aug 2024 22:49:07 +0200 Subject: [PATCH] feature(website): update approaches and quotes sections on new landing page (#892) --- ui/src/components/carousel.tsx | 1 + ui/src/components/typography/typography.tsx | 1 - ui/src/globals.css | 4 +- ui/src/interfaces/color.ts | 4 -- ui/tailwind.config.ts | 5 +-- .../v2/(home)/(components)/approach-cards.tsx | 36 ------------------ .../v2/(home)/(components)/income-input.tsx | 2 +- .../v2/(home)/(components)/mux-video.tsx | 1 + .../(home)/(components)/quotes-carousel.tsx | 12 +++--- .../v2/(home)/(sections)/approach.tsx | 37 ++++++++++++++----- .../[region]/v2/(home)/(sections)/quotes.tsx | 2 +- .../(home)/(sections)/recipient-selection.tsx | 2 +- .../[region]/v2/(home)/(sections)/sdgoals.tsx | 2 +- .../app/[lang]/[region]/v2/(home)/page.tsx | 6 ++- 14 files changed, 49 insertions(+), 66 deletions(-) delete mode 100644 website/src/app/[lang]/[region]/v2/(home)/(components)/approach-cards.tsx diff --git a/ui/src/components/carousel.tsx b/ui/src/components/carousel.tsx index 9eb01227a..98778fba3 100644 --- a/ui/src/components/carousel.tsx +++ b/ui/src/components/carousel.tsx @@ -118,6 +118,7 @@ const CarouselDots = ({ itemsLength, selectedIndex, onClick }: CarouselDots) => key={index} className={cn('bg-muted-foreground h-2 w-2 rounded-full transition-all duration-300', { 'opacity-50': !selected, + 'cursor-pointer': onClick, })} onClick={() => onClick?.(index)} > diff --git a/ui/src/components/typography/typography.tsx b/ui/src/components/typography/typography.tsx index 26ff4c778..627897fab 100644 --- a/ui/src/components/typography/typography.tsx +++ b/ui/src/components/typography/typography.tsx @@ -29,7 +29,6 @@ const FONT_WEIGHT_MAP: { [key in FontWeight]: string } = { const FONT_COLOR_MAP: { [key in FontColor]: string } = { background: 'text-background', foreground: 'text-foreground', - 'foreground-dark': 'text-primary-dark', primary: 'text-primary', 'primary-foreground': 'text-primary-foreground', secondary: 'text-secondary', diff --git a/ui/src/globals.css b/ui/src/globals.css index dcdc44aaa..b3bb26532 100644 --- a/ui/src/globals.css +++ b/ui/src/globals.css @@ -83,7 +83,9 @@ .theme-v2 { --background: 50 33% 96%; --foreground: 206 99% 31%; - --foreground-dark: 212 59% 40%; + + --muted: 222 100% 98%; + --muted-foreground: 212 59% 40%; } .theme-blue-v2 { diff --git a/ui/src/interfaces/color.ts b/ui/src/interfaces/color.ts index 0f6ca8544..9a00ae11b 100644 --- a/ui/src/interfaces/color.ts +++ b/ui/src/interfaces/color.ts @@ -1,6 +1,5 @@ export const COLORS = [ 'foreground', - 'foreground-dark', 'background', 'border', 'input', @@ -29,7 +28,6 @@ export const COLORS = [ 'bg-pink-50', 'bg-muted', 'bg-primary', - 'bg-foreground-dark', 'bg-background', 'bg-transparent', ] as const; @@ -38,7 +36,6 @@ export type Color = (typeof COLORS)[number]; export type FontColor = Extract< Color, | 'foreground' - | 'foreground-dark' | 'background' | 'primary' | 'primary-foreground' @@ -67,7 +64,6 @@ export type BackgroundColor = Extract< | 'bg-purple-50' | 'bg-pink-50' | 'bg-muted' - | 'bg-foreground-dark' | 'bg-background' | 'bg-transparent' >; diff --git a/ui/tailwind.config.ts b/ui/tailwind.config.ts index e0ca144ce..50f5639a8 100644 --- a/ui/tailwind.config.ts +++ b/ui/tailwind.config.ts @@ -20,10 +20,7 @@ module.exports = { input: 'hsl(var(--input) / )', ring: 'hsl(var(--ring) / )', background: 'hsl(var(--background) / )', - foreground: { - DEFAULT: 'hsl(var(--foreground) / )', - dark: 'hsl(var(--foreground-dark) / )', - }, + foreground: 'hsl(var(--foreground) / )', muted: { DEFAULT: 'hsl(var(--muted) / )', foreground: 'hsl(var(--muted-foreground) / )', diff --git a/website/src/app/[lang]/[region]/v2/(home)/(components)/approach-cards.tsx b/website/src/app/[lang]/[region]/v2/(home)/(components)/approach-cards.tsx deleted file mode 100644 index aa9e33789..000000000 --- a/website/src/app/[lang]/[region]/v2/(home)/(components)/approach-cards.tsx +++ /dev/null @@ -1,36 +0,0 @@ -'use client'; -import { Card, CardContent, CardHeader, Typography } from '@socialincome/ui'; - -type ApproachCardProps = { - category: string; - title: string; - points: { - text: string; - }[]; -}; - -export function ApproachCard({ category, title, points }: ApproachCardProps) { - return ( - - - - {category} - - - {title} - - - -
    - {points.map((point, key) => { - return ( -
  • - {point.text} -
  • - ); - })} -
-
-
- ); -} diff --git a/website/src/app/[lang]/[region]/v2/(home)/(components)/income-input.tsx b/website/src/app/[lang]/[region]/v2/(home)/(components)/income-input.tsx index f8a06d0a9..41d3d9492 100644 --- a/website/src/app/[lang]/[region]/v2/(home)/(components)/income-input.tsx +++ b/website/src/app/[lang]/[region]/v2/(home)/(components)/income-input.tsx @@ -36,7 +36,7 @@ export function IncomeInput() { useEffect(() => { form.setValue('currency', currency); - }, [currency]); + }, [form, currency]); const onSubmit = async (values: FormSchema) => { alert(`You entered: ${values.value} ${values.currency}`); diff --git a/website/src/app/[lang]/[region]/v2/(home)/(components)/mux-video.tsx b/website/src/app/[lang]/[region]/v2/(home)/(components)/mux-video.tsx index 46768d0c1..26f11ff53 100644 --- a/website/src/app/[lang]/[region]/v2/(home)/(components)/mux-video.tsx +++ b/website/src/app/[lang]/[region]/v2/(home)/(components)/mux-video.tsx @@ -27,6 +27,7 @@ const MuxVideoComponent = () => { return () => { setBackgroundColor('bg-background'); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [entry]); useEffect(() => { diff --git a/website/src/app/[lang]/[region]/v2/(home)/(components)/quotes-carousel.tsx b/website/src/app/[lang]/[region]/v2/(home)/(components)/quotes-carousel.tsx index fe89f010c..9b4738faa 100644 --- a/website/src/app/[lang]/[region]/v2/(home)/(components)/quotes-carousel.tsx +++ b/website/src/app/[lang]/[region]/v2/(home)/(components)/quotes-carousel.tsx @@ -35,24 +35,26 @@ export function QuotesCarousel(cardsObj: CarouselCardProps) { slidesToScroll = 3; break; } + + // TODO: update carousel content return ( {cardsArr.map((card, index) => ( - -
+ + {card.quote.map((title, index) => ( - + {title.text}{' '} ))} -
+ UN symbol {card.author} diff --git a/website/src/app/[lang]/[region]/v2/(home)/(sections)/approach.tsx b/website/src/app/[lang]/[region]/v2/(home)/(sections)/approach.tsx index 02034120c..9406c8784 100644 --- a/website/src/app/[lang]/[region]/v2/(home)/(sections)/approach.tsx +++ b/website/src/app/[lang]/[region]/v2/(home)/(sections)/approach.tsx @@ -1,7 +1,6 @@ import { DefaultParams } from '@/app/[lang]/[region]'; import { Translator } from '@socialincome/shared/src/utils/i18n'; -import { BaseContainer, Typography } from '@socialincome/ui'; -import { ApproachCard } from '../(components)/approach-cards'; +import { Card, CardContent, CardHeader, Typography } from '@socialincome/ui'; type ApproachCardProps = { category: string; @@ -19,15 +18,35 @@ export async function Approach({ lang, region }: DefaultParams) { const cards = translator.t('section-7.cards'); return ( - - +
+ {translator.t('section-7.title-1')} -
- {cards.map((card, key) => { - return ; - })} +
+ {cards.map((card) => ( + + + + {card.category} + + + {card.title} + + + +
    + {card.points.map((point) => { + return ( +
  • + {point.text} +
  • + ); + })} +
+
+
+ ))}
- +
); } diff --git a/website/src/app/[lang]/[region]/v2/(home)/(sections)/quotes.tsx b/website/src/app/[lang]/[region]/v2/(home)/(sections)/quotes.tsx index ec7d374ae..39f2d00ae 100644 --- a/website/src/app/[lang]/[region]/v2/(home)/(sections)/quotes.tsx +++ b/website/src/app/[lang]/[region]/v2/(home)/(sections)/quotes.tsx @@ -12,7 +12,7 @@ export async function Quotes({ lang, region }: DefaultParams) { const cards = translator.t('section-8.cards'); return ( - + ); diff --git a/website/src/app/[lang]/[region]/v2/(home)/(sections)/recipient-selection.tsx b/website/src/app/[lang]/[region]/v2/(home)/(sections)/recipient-selection.tsx index 2f5aa1976..574a82952 100644 --- a/website/src/app/[lang]/[region]/v2/(home)/(sections)/recipient-selection.tsx +++ b/website/src/app/[lang]/[region]/v2/(home)/(sections)/recipient-selection.tsx @@ -12,7 +12,7 @@ export async function RecipientSelection({ lang, region }: DefaultParams) { }); return ( - +
{translator.t<{ text: string; color?: FontColor }[]>('section-9.title-1').map((title, index) => ( diff --git a/website/src/app/[lang]/[region]/v2/(home)/(sections)/sdgoals.tsx b/website/src/app/[lang]/[region]/v2/(home)/(sections)/sdgoals.tsx index 69b132c59..b7367a407 100644 --- a/website/src/app/[lang]/[region]/v2/(home)/(sections)/sdgoals.tsx +++ b/website/src/app/[lang]/[region]/v2/(home)/(sections)/sdgoals.tsx @@ -26,7 +26,7 @@ export async function Sdgoals({ lang, region }: DefaultParams) { Sustainable Development Goals Logo
-
+
{translator.t('section-10.sdg-1-title')} diff --git a/website/src/app/[lang]/[region]/v2/(home)/page.tsx b/website/src/app/[lang]/[region]/v2/(home)/page.tsx index 17313b5f0..07c7d688f 100644 --- a/website/src/app/[lang]/[region]/v2/(home)/page.tsx +++ b/website/src/app/[lang]/[region]/v2/(home)/page.tsx @@ -1,4 +1,6 @@ import { DefaultPageProps } from '@/app/[lang]/[region]'; +import { Approach } from '@/app/[lang]/[region]/v2/(home)/(sections)/approach'; +import { Quotes } from '@/app/[lang]/[region]/v2/(home)/(sections)/quotes'; import { Translator } from '@socialincome/shared/src/utils/i18n'; import { ExplainerVideo } from './(sections)/explainer-video'; import { HeroVideo } from './(sections)/hero-video'; @@ -19,8 +21,8 @@ export default async function Page({ params: { lang, region } }: DefaultPageProp {/**/} - {/**/} - {/**/} + + {/**/} {/**/} {/**/}