website/app/components/ContactButton.tsx

82 lines
2.5 KiB
TypeScript
Raw Permalink Normal View History

2023-12-23 11:21:03 +07:00
import Link from "next/link";
import React from "react";
import * as icons from 'simple-icons';
interface ContactButtonProps {
platform: string;
title: string;
description: string;
href: string;
username: string;
}
const ContactButton: React.FC<ContactButtonProps> = ({platform, title, description, href, username}) => {
let buttonColor;
let iconFile;
switch (platform.toLowerCase()) {
2024-05-03 10:41:57 +07:00
case 'activitypub':
buttonColor = "#F1007E";
iconFile = icons.siActivitypub.svg;
2023-12-23 11:21:03 +07:00
break;
2024-05-03 10:41:57 +07:00
case 'git':
buttonColor = "#FB923C";
iconFile = icons.siForgejo.svg;
2023-12-23 11:21:03 +07:00
break;
2024-05-03 10:41:57 +07:00
case 'matrix':
buttonColor = "#000";
iconFile = icons.siMatrix.svg;
2023-12-23 11:21:03 +07:00
break;
case 'facebook':
buttonColor = "#0866FF";
iconFile = icons.siFacebook.svg;
break;
2024-07-08 11:21:01 +07:00
case 'peertube':
buttonColor = "#F1680D";
iconFile = icons.siPeertube.svg;
break;
2023-12-23 11:21:03 +07:00
default:
buttonColor = "";
iconFile = "";
break;
}
return (
2024-07-08 11:21:01 +07:00
<div className="flex flex-col gap-4 sm:max-lg:items-center">
2023-12-23 11:21:03 +07:00
<div className="flex flex-col">
<p className="text-xl font-bold"> { title } </p>
<p className="text-base text-slate-600 dark:text-slate-300">
{ description }
</p>
</div>
2024-07-08 11:21:01 +07:00
<div>
2023-12-23 11:21:03 +07:00
<Link
href={ href }
>
<button
style={
{ ['backgroundColor' as any] : buttonColor}
}
2024-05-03 10:41:57 +07:00
className="text-white font-bold rounded-xl px-4 py-2.5 shadow-lg flex flex-row gap-2 transition ease-in-out delay-150 hover:scale-110 duration-300">
2023-12-23 11:21:03 +07:00
<i
className="text-white"
style={
{['width']: '24px', ['height']: '24px', ['fill']: 'white'}
}
dangerouslySetInnerHTML={{ __html: iconFile }}>
</i>
<p className="flex flex-col justify-center text-white">
{ username }
</p>
</button>
</Link>
</div>
</div>
);
};
export default ContactButton;