|
| 1 | +import { useWindowType } from "@/hooks/use-window-type"; |
| 2 | +import { Avatar, Box, Heading, HStack, IconButton, Separator, Stack, Text, useClipboard, Wrap } from "@chakra-ui/react"; |
| 3 | +import { HiOutlineMail, HiCheck } from "react-icons/hi"; |
| 4 | + |
| 5 | +import React from "react"; |
| 6 | +import Card from "@/components/ui/internal/card"; |
| 7 | +import { Tooltip } from "@/components/ui/tooltip"; |
| 8 | +import { toaster } from "@/components/ui/toaster" |
| 9 | +interface Position { |
| 10 | + name: string; |
| 11 | + position: string; |
| 12 | + avatarSrc: string; |
| 13 | + email: string; |
| 14 | +} |
| 15 | + |
| 16 | +interface BoardProps { |
| 17 | + description?: string; |
| 18 | + title?: string; |
| 19 | + positions?: Position[]; |
| 20 | +} |
| 21 | + |
| 22 | +export default function Board({ }: BoardProps) { |
| 23 | + const { isDesktop } = useWindowType(); |
| 24 | + return ( |
| 25 | + <Card> |
| 26 | + <Stack align={"center"}> |
| 27 | + <Heading fontWeight={"bold"} size={isDesktop ? "4xl" : "2xl"} color={"text-3"}> |
| 28 | + Board |
| 29 | + </Heading> |
| 30 | + <Text> |
| 31 | + Meet the heart and soul behind this website — a team of passionate and dedicated students who pour their energy and creativity into making it extraordinary. Here are our amazing Executive Board members! |
| 32 | + </Text> |
| 33 | + </Stack> |
| 34 | + <Stack w="full"> |
| 35 | + <Heading alignSelf={"center"}>Executive Board</Heading> |
| 36 | + <Separator size={"lg"} borderColor={"secondary"} /> |
| 37 | + </Stack> |
| 38 | + |
| 39 | + <Wrap gap={2} padding={8} justify={"space-around"} borderColor={"text-5"} borderWidth={"4px"} borderRadius={"2xl"} borderStyle={"dashed"} w="full" h="full"> |
| 40 | + {positions.map((pos, i) => <PositionCard position={pos} key={i} />)} |
| 41 | + </Wrap> |
| 42 | + |
| 43 | + </Card> |
| 44 | + |
| 45 | + ); |
| 46 | +} |
| 47 | + |
| 48 | + |
| 49 | +function PositionCard({ position }: { position: Position }) { |
| 50 | + const { isDesktop } = useWindowType(); |
| 51 | + const clipboard = useClipboard({ value: position.email, timeout: 2000 }); |
| 52 | + return ( |
| 53 | + <Stack w={isDesktop ? "240px" : "160px"} align={"center"} spaceY={0}> |
| 54 | + <Box h="full" w="full"> |
| 55 | + |
| 56 | + <Avatar.Root |
| 57 | + w={"full"} |
| 58 | + h={"full"} |
| 59 | + shape="rounded" |
| 60 | + > |
| 61 | + <Avatar.Fallback name={position.name} /> |
| 62 | + <Avatar.Image |
| 63 | + src={position.avatarSrc} |
| 64 | + alt={position.name} |
| 65 | + /> |
| 66 | + </Avatar.Root> |
| 67 | + </Box> |
| 68 | + <Stack w="full" align={"center"} justify={"center"} spaceY={-2} m={2}> |
| 69 | + <Heading textAlign={"center"} size={isDesktop ? "lg" : "md"}>{position.name}</Heading> |
| 70 | + <HStack w="full" justify={"center"} spaceX={1} align={"center"}> |
| 71 | + <Text textAlign={"center"} fontSize={isDesktop ? "sm" : "xs"}>{position.position}</Text> |
| 72 | + <Tooltip content={position.email} interactive openDelay={100} showArrow closeDelay={100}> |
| 73 | + <IconButton variant={"plain"} color={"white"} p={1} size={"xs"} onClick={() => { |
| 74 | + clipboard.copy(); |
| 75 | + toaster.create({ |
| 76 | + title: "Email Copied", |
| 77 | + description: `The email has been copied to your clipboard. Contect now with our ${position.position}!`, |
| 78 | + type: "success", |
| 79 | + duration: 2000, |
| 80 | + placement: "top", |
| 81 | + }); |
| 82 | + |
| 83 | + }} aria-label="Search database"> |
| 84 | + {clipboard.copied ? <HiCheck /> : <HiOutlineMail />} |
| 85 | + </IconButton> |
| 86 | + </Tooltip> |
| 87 | + </HStack> |
| 88 | + </Stack> |
| 89 | + </Stack> |
| 90 | + ); |
| 91 | + |
| 92 | +} |
| 93 | + |
| 94 | +const positions: Position[] = [ |
| 95 | + { |
| 96 | + name: "Shahd Elbendary", |
| 97 | + position: "Chairperson", |
| 98 | + avatarSrc: "/Images/board/chairperson.jpeg", |
| 99 | + |
| 100 | + }, |
| 101 | + { |
| 102 | + name: "Amr Yasser Saber", |
| 103 | + position: "Vice Technical Chairman", |
| 104 | + avatarSrc: "/Images/board/vice-technical.jpeg", |
| 105 | + |
| 106 | + }, |
| 107 | + { |
| 108 | + name: "Mustafa Mohamed", |
| 109 | + position: "Vice Managerial Chairman", |
| 110 | + avatarSrc: "/Images/board/vice-managerial.jpeg", |
| 111 | + |
| 112 | + }, |
| 113 | + { |
| 114 | + name: "Samar Nafea", |
| 115 | + position: "Secretary", |
| 116 | + avatarSrc: "/Images/board/secretary.jpeg", |
| 117 | + |
| 118 | + }, |
| 119 | + { |
| 120 | + name: "Mohamed Tarek", |
| 121 | + position: "Branding Officer", |
| 122 | + avatarSrc: "/Images/board/branding-officer.jpeg", |
| 123 | + |
| 124 | + }, |
| 125 | + { |
| 126 | + name: "Sarah Kahwash", |
| 127 | + position: "Treasurer", |
| 128 | + avatarSrc: "/Images/board/treasurer.jpeg", |
| 129 | + |
| 130 | + }, |
| 131 | +]; |
0 commit comments