2021-08-13 19:46:42 +00:00
|
|
|
import { ArrowRightIcon } from "@heroicons/react/outline";
|
2021-09-14 08:45:28 +00:00
|
|
|
import { ArrowLeftIcon } from "@heroicons/react/solid";
|
2021-09-22 19:52:38 +00:00
|
|
|
import classnames from "classnames";
|
|
|
|
import Link from "next/link";
|
2021-12-09 23:51:30 +00:00
|
|
|
import { TeamPageProps } from "pages/team/[slug]";
|
2021-09-22 19:52:38 +00:00
|
|
|
import React from "react";
|
|
|
|
|
2021-10-08 11:43:48 +00:00
|
|
|
import { useLocale } from "@lib/hooks/useLocale";
|
|
|
|
|
2021-09-22 19:52:38 +00:00
|
|
|
import Avatar from "@components/ui/Avatar";
|
2021-09-14 13:27:41 +00:00
|
|
|
import Button from "@components/ui/Button";
|
2021-09-22 19:52:38 +00:00
|
|
|
import Text from "@components/ui/Text";
|
2021-08-13 19:46:42 +00:00
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
type TeamType = TeamPageProps["team"];
|
|
|
|
type MembersType = TeamType["members"];
|
|
|
|
type MemberType = MembersType[number];
|
|
|
|
|
|
|
|
const Team = ({ team }: TeamPageProps) => {
|
2021-10-12 13:11:33 +00:00
|
|
|
const { t } = useLocale();
|
2021-10-08 11:43:48 +00:00
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
const Member = ({ member }: { member: MemberType }) => {
|
2021-08-13 19:46:42 +00:00
|
|
|
const classes = classnames(
|
|
|
|
"group",
|
|
|
|
"relative",
|
|
|
|
"flex flex-col",
|
|
|
|
"space-y-4",
|
|
|
|
"p-4",
|
2021-08-22 12:48:33 +00:00
|
|
|
"bg-white dark:bg-neutral-900 dark:border-0 dark:bg-opacity-8",
|
2021-08-13 19:46:42 +00:00
|
|
|
"border border-neutral-200",
|
|
|
|
"hover:cursor-pointer",
|
2021-11-04 14:30:37 +00:00
|
|
|
"hover:border-brand dark:border-neutral-700 dark:hover:border-neutral-600",
|
2021-08-13 19:46:42 +00:00
|
|
|
"rounded-sm",
|
|
|
|
"hover:shadow-md"
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
2021-12-09 23:51:30 +00:00
|
|
|
<Link key={member.id} href={`/${member.username}`}>
|
2021-08-13 19:46:42 +00:00
|
|
|
<div className={classes}>
|
|
|
|
<ArrowRightIcon
|
|
|
|
className={classnames(
|
|
|
|
"text-black dark:text-white",
|
|
|
|
"absolute top-4 right-4",
|
|
|
|
"h-4 w-4",
|
|
|
|
"transition-opacity",
|
|
|
|
"opacity-0 group-hover:opacity-100 group-hover:block"
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
<div>
|
2021-12-09 23:51:30 +00:00
|
|
|
<Avatar alt={member.name || ""} imageSrc={member.avatar} className="w-12 h-12" />
|
2021-09-14 08:45:28 +00:00
|
|
|
<section className="space-y-2">
|
2021-12-09 23:51:30 +00:00
|
|
|
<Text variant="title">{member.name}</Text>
|
|
|
|
<Text variant="subtitle" className="w-6/8">
|
|
|
|
{member.bio}
|
2021-09-14 08:45:28 +00:00
|
|
|
</Text>
|
|
|
|
</section>
|
|
|
|
</div>
|
2021-08-13 19:46:42 +00:00
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
const Members = ({ members }: { members: MembersType }) => {
|
2021-08-13 19:46:42 +00:00
|
|
|
if (!members || members.length === 0) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2021-12-09 23:51:30 +00:00
|
|
|
<section className="flex flex-wrap justify-center max-w-5xl min-w-full mx-auto lg:min-w-lg gap-x-12 gap-y-6">
|
2021-08-13 19:46:42 +00:00
|
|
|
{members.map((member) => {
|
2021-12-09 23:51:30 +00:00
|
|
|
return member.username !== null && <Member key={member.id} member={member} />;
|
2021-08-13 19:46:42 +00:00
|
|
|
})}
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
2021-09-14 08:45:28 +00:00
|
|
|
<div>
|
2021-08-13 19:46:42 +00:00
|
|
|
<Members members={team.members} />
|
2021-09-30 09:24:02 +00:00
|
|
|
{team.eventTypes.length > 0 && (
|
2021-12-09 23:51:30 +00:00
|
|
|
<aside className="mt-8 text-center dark:text-white">
|
2021-09-14 13:27:41 +00:00
|
|
|
<Button color="secondary" href={`/team/${team.slug}`} shallow={true} StartIcon={ArrowLeftIcon}>
|
2021-10-08 11:43:48 +00:00
|
|
|
{t("go_back")}
|
2021-09-14 13:27:41 +00:00
|
|
|
</Button>
|
2021-09-14 08:45:28 +00:00
|
|
|
</aside>
|
|
|
|
)}
|
|
|
|
</div>
|
2021-08-13 19:46:42 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Team;
|