From 2720883d01657ab034175c96211614cd086baa43 Mon Sep 17 00:00:00 2001
From: mde3
Date: Wed, 4 Dec 2024 14:47:54 +0300
Subject: [PATCH] chore: added new reusable contact & partner cards
---
apps/website/src/app/contact/page.tsx | 67 ++++-------
.../src/components/segments/ParterWithUs.tsx | 34 +++---
apps/website/src/components/shared/Card.tsx | 48 --------
.../src/components/shared/ContactCard.tsx | 95 +++++++++++++++
.../src/components/shared/PartnerCard.tsx | 113 ++++++++++++++++++
apps/website/src/components/shared/index.tsx | 2 +
6 files changed, 253 insertions(+), 106 deletions(-)
create mode 100644 apps/website/src/components/shared/ContactCard.tsx
create mode 100644 apps/website/src/components/shared/PartnerCard.tsx
diff --git a/apps/website/src/app/contact/page.tsx b/apps/website/src/app/contact/page.tsx
index a993cd42..725c5867 100644
--- a/apps/website/src/app/contact/page.tsx
+++ b/apps/website/src/app/contact/page.tsx
@@ -1,4 +1,5 @@
import {
+ ContactCard,
GridContainer,
PageTitle,
} from "@/components/shared";
@@ -29,47 +30,31 @@ export default function ContactPage() {
If you have any questions or need assistance, feel free to reach out to us through our contact details below.
-
-
-
-
-
-
-
-
-
-
Our Head Office
-
Norrsken House Kigali
1 KN 78 St, Kigali - Rwanda
-
-
-
-
-
-
+
+
+ Norrsken House Kigali
+ 1 KN 78 St, Kigali - Rwanda
+ >
+ }
+ colorScheme="blue"
+ />
+
diff --git a/apps/website/src/components/segments/ParterWithUs.tsx b/apps/website/src/components/segments/ParterWithUs.tsx
index 2643273d..251fe847 100644
--- a/apps/website/src/components/segments/ParterWithUs.tsx
+++ b/apps/website/src/components/segments/ParterWithUs.tsx
@@ -14,27 +14,27 @@ export const ParterWithUs = () => {
title="Partner with Us"
textCentered={true}
/>
-
);
-};
+};
\ No newline at end of file
diff --git a/apps/website/src/components/shared/Card.tsx b/apps/website/src/components/shared/Card.tsx
index 6dee6a80..68ae8093 100644
--- a/apps/website/src/components/shared/Card.tsx
+++ b/apps/website/src/components/shared/Card.tsx
@@ -1,7 +1,5 @@
import Image, { StaticImageData } from "next/image";
-import Link from "next/link";
import { twMerge } from "tailwind-merge";
-import { HiOutlineArrowUpRight } from "react-icons/hi2";
interface ShortCardProps {
subtitle?: string;
@@ -11,13 +9,6 @@ interface ShortCardProps {
image?: StaticImageData;
}
-interface PartnerCardProps {
- title?: string;
- description?: string;
- link?: string;
- className?: string;
-}
-
export const Card = ({ title, subtitle, description, className, image }: ShortCardProps) => {
const defaultClass="mt-8 flex w-auto pt-0 flex-col items-start justify-center rounded-lg lg:mt-0";
const mergedClass=twMerge(defaultClass, className);
@@ -42,42 +33,3 @@ export const Card = ({ title, subtitle, description, className, image }: ShortCa
);
};
-
-export const PartnerCard = ({ title, description, link, className }: PartnerCardProps) => {
- const defaultClass="h-full p-8 border border-zinc-200 rounded-lg bg-gray-50";
- const mergedClass=twMerge(defaultClass, className);
- return (
-
-
-
-
{title}
-
- {description}
-
- {link && (
-
- Continue
-
-
-
-
- )}
-
-
-
- );
-};
-
-export const PartnerTitle = ({ title, description }: PartnerCardProps) => {
- return (
-
-
{title}
-
- {description}
-
-
- );
-};
diff --git a/apps/website/src/components/shared/ContactCard.tsx b/apps/website/src/components/shared/ContactCard.tsx
new file mode 100644
index 00000000..df8ea9a3
--- /dev/null
+++ b/apps/website/src/components/shared/ContactCard.tsx
@@ -0,0 +1,95 @@
+import { IconType } from 'react-icons';
+
+interface ContactCardProps {
+ icon: IconType;
+ title: string;
+ content: string | React.ReactNode;
+ linkHref?: string;
+ colorScheme?: 'green' | 'blue' | 'purple';
+}
+
+export const ContactCard = ({
+ icon: Icon,
+ title,
+ content,
+ linkHref,
+ colorScheme = 'green'
+}: ContactCardProps) => {
+ const colorVariants = {
+ green: {
+ hover: 'hover:bg-green-50 hover:border-green-300',
+ iconHover: 'group-hover:text-green-700',
+ titleHover: 'group-hover:text-green-700',
+ contentHover: 'group-hover:text-green-700',
+ bgColors: ['bg-green-200', 'bg-green-300']
+ },
+ blue: {
+ hover: 'hover:bg-blue-50 hover:border-blue-300',
+ iconHover: 'group-hover:text-blue-700',
+ titleHover: 'group-hover:text-blue-700',
+ contentHover: 'group-hover:text-blue-400',
+ bgColors: ['bg-blue-200', 'bg-blue-300']
+ },
+ purple: {
+ hover: 'hover:bg-purple-50 hover:border-purple-300',
+ iconHover: 'group-hover:text-purple-700',
+ titleHover: 'group-hover:text-purple-700',
+ contentHover: 'group-hover:text-purple-400',
+ bgColors: ['bg-purple-200', 'bg-purple-300']
+ }
+ };
+
+ const colors = colorVariants[colorScheme];
+
+ const renderContent = () => {
+ if (typeof content === 'string' && linkHref) {
+ return (
+
+ {content}
+
+ );
+ }
+ return (
+
+ {content}
+
+ );
+ };
+
+ return (
+
+
+
+
+
+
+
+
+ {title}
+
+ {renderContent()}
+
+ {colors.bgColors.map((bgColor, index) => (
+
+ ))}
+
+ );
+};
diff --git a/apps/website/src/components/shared/PartnerCard.tsx b/apps/website/src/components/shared/PartnerCard.tsx
new file mode 100644
index 00000000..6e955d34
--- /dev/null
+++ b/apps/website/src/components/shared/PartnerCard.tsx
@@ -0,0 +1,113 @@
+import Link from "next/link";
+import { HiOutlineArrowUpRight } from "react-icons/hi2";
+
+interface PartnerCardProps {
+ title: string;
+ description: string;
+ linkHref: string;
+ colorScheme?: 'purple' | 'blue' | 'neutral';
+}
+
+interface PartnerTitleProps {
+ title: string;
+ description: string;
+}
+
+export const PartnerCard = ({
+ title,
+ description,
+ linkHref,
+ colorScheme = 'purple'
+}: PartnerCardProps) => {
+ const colorVariants = {
+ purple: {
+ hover: 'hover:bg-purple-50 hover:border-purple-300',
+ titleHover: 'group-hover:text-purple-700',
+ descHover: 'group-hover:text-purple-400',
+ btnHover: 'group-hover:bg-purple-600',
+ bgColors: ['bg-purple-200', 'bg-purple-300']
+ },
+ blue: {
+ hover: 'hover:bg-blue-50 hover:border-blue-300',
+ titleHover: 'group-hover:text-blue-700',
+ descHover: 'group-hover:text-blue-400',
+ btnHover: 'group-hover:bg-blue-600',
+ bgColors: ['bg-blue-200', 'bg-blue-300']
+ },
+ neutral: {
+ hover: 'hover:bg-neutral-50 hover:border-neutral-300',
+ titleHover: 'group-hover:text-neutral-700',
+ descHover: 'group-hover:text-neutral-400',
+ btnHover: 'group-hover:bg-neutral-600',
+ bgColors: ['bg-neutral-200', 'bg-neutral-300']
+ }
+ };
+
+ const colors = colorVariants[colorScheme];
+
+ return (
+
+
+
+ {title}
+
+
+ {description}
+
+
+ Continue
+
+
+
+
+
+ {colors.bgColors.map((bgColor, index) => (
+
+ ))}
+
+ );
+};
+
+export const PartnerTitle = ({ title, description }: PartnerTitleProps) => {
+ return (
+
+
{title}
+
+ {description}
+
+
+ );
+};
diff --git a/apps/website/src/components/shared/index.tsx b/apps/website/src/components/shared/index.tsx
index 9e0a0f57..a87403aa 100644
--- a/apps/website/src/components/shared/index.tsx
+++ b/apps/website/src/components/shared/index.tsx
@@ -6,3 +6,5 @@ export * from "./SectionTitle";
export * from "./Card";
export * from "./Form";
export * from "./JourneySection";
+export * from "./ContactCard";
+export * from "./PartnerCard";