Skip to content

Commit

Permalink
Merge pull request #100 from kiisi/feat/HNG-83-integrations-page-admi…
Browse files Browse the repository at this point in the history
…n-dashboard-card-component

FEAT: Integrations Card component on the Integrations Page- Admin Dashboard
  • Loading branch information
chumex412 authored Jul 20, 2024
2 parents 81605e9 + 95906da commit efeb799
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 122 deletions.
55 changes: 55 additions & 0 deletions app/components/ui/card/card-platform.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { useState } from "react";
import { cn } from "~/lib/utils/cn";

type PlatformCardProps = {
/**
* Displaying the platform name or title.
*/
heading: string;

/**
* Displaying the platform logo or icon.
*/
logo: string;
/**
* Providing a brief overview of the platform.
*/
description: string;
/**
* Additional class names for customizing the container style.
*/
containerClassName?: string;
};

/**
* A card component that displays platform details including a heading, logo, description, and a toggle switch.
* The toggle switch allows admins to activate or deactivate the platform.
*
* @param {PlatformCardProps} props - The properties for the component.
* @returns The CardPlatform component.
*/

export default function CardPlatform({ heading, logo, description, containerClassName }: PlatformCardProps) {

const [isActivated, setIsActivated] = useState(false)

const toggleSwitchHandler = () => setIsActivated(prev => !prev)

return (
<div className={cn("w-full bg-white border-[1px] border-[#CBD5E1] rounded-[6px] py-[24px] px-[16px]", containerClassName)}>
<header className="flex items-center justify-between mb-[24px]">
<figure>
<img src={logo} alt={heading} className="w-[32px] h-[32px]" />
</figure>
<button onClick={toggleSwitchHandler} className={cn("h-[22px] w-[46px] rounded-full px-[2px]", isActivated ? "bg-[#F97316]" : "bg-[#D0D6D6]")}>
<div className={cn("h-[18px] w-[18px] rounded-full transition duration-300", isActivated ? "bg-white translate-x-[24px]" : "bg-[#F9F9F9] translate-x-0")}>
</div>
</button>
</header>
<div>
<h2 className="text-[16px] text-[#0A0A0A] font-semibold mb-[6px]">{heading}</h2>
<p className="text-[#0A0A0A] text-[12px]">{description}</p>
</div>
</div>
);
}
9 changes: 9 additions & 0 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { MetaFunction } from "@remix-run/node";
import { Button } from "~/components/ui/button";
import CardPlatform from "~/components/ui/card/card-platform";

export const meta: MetaFunction = () => {
return [
Expand Down Expand Up @@ -34,6 +35,14 @@ export default function Index() {
</a>
</li>
<Button>Hello</Button>
<div className="p-2">
<CardPlatform
logo="/images/g-drive-icon.svg"
heading="Drive"
description="Store, share, and collaborate on documents and files securely"
containerClassName="max-w-[341px]"
/>
</div>
<li>
<a
className="text-blue-700 underline visited:text-purple-900"
Expand Down
Loading

0 comments on commit efeb799

Please sign in to comment.