|
| 1 | +import Team from './Team'; |
| 2 | +import { fetchContent } from '../api/apiRoot'; |
| 3 | +import { useState, useEffect } from 'react'; |
| 4 | +import { Tabs, TabsHeader, TabsBody, Tab, TabPanel } from '@material-tailwind/react'; |
| 5 | +import Heading from './Heading'; |
| 6 | +import { UnderlineTypes } from '../utils/underlineType'; |
| 7 | +import CoPresident from "./CoPresident"; |
| 8 | + |
| 9 | +const people = [{ |
| 10 | + name: "John Doe", |
| 11 | + linkedin: "randomlink.com", |
| 12 | + position: "Dev", |
| 13 | + project: "Events", |
| 14 | + pfp: { |
| 15 | + fields: { |
| 16 | + file: { |
| 17 | + url: "//t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" |
| 18 | + } |
| 19 | + } |
| 20 | + }, |
| 21 | + classes: "text-white", |
| 22 | +}, |
| 23 | +{ |
| 24 | + name: "John Doe", |
| 25 | + linkedin: "randomlink.com", |
| 26 | + position: "Dev", |
| 27 | + project: "Events", |
| 28 | + pfp: { |
| 29 | + fields: { |
| 30 | + file: { |
| 31 | + url: "//t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" |
| 32 | + } |
| 33 | + } |
| 34 | + }, |
| 35 | + classes: "text-white", |
| 36 | +}, |
| 37 | +{ |
| 38 | + name: "John Doe", |
| 39 | + linkedin: "randomlink.com", |
| 40 | + position: "Dev", |
| 41 | + project: "Events", |
| 42 | + pfp: { |
| 43 | + fields: { |
| 44 | + file: { |
| 45 | + url: "//t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" |
| 46 | + } |
| 47 | + } |
| 48 | + }, |
| 49 | + classes: "text-white", |
| 50 | +}, |
| 51 | +{ |
| 52 | + name: "John Doe", |
| 53 | + linkedin: "randomlink.com", |
| 54 | + position: "Dev", |
| 55 | + project: "Events", |
| 56 | + pfp: { |
| 57 | + fields: { |
| 58 | + file: { |
| 59 | + url: "//t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" |
| 60 | + } |
| 61 | + } |
| 62 | + }, |
| 63 | + classes: "text-white", |
| 64 | +}, |
| 65 | + |
| 66 | +{ |
| 67 | + name: "John Doe", |
| 68 | + linkedin: "randomlink.com", |
| 69 | + position: "Dev", |
| 70 | + project: "Events", |
| 71 | + pfp: { |
| 72 | + fields: { |
| 73 | + file: { |
| 74 | + url: "//t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" |
| 75 | + } |
| 76 | + } |
| 77 | + }, |
| 78 | + classes: "text-white", |
| 79 | +}, |
| 80 | +{ |
| 81 | + name: "John Doe", |
| 82 | + linkedin: "randomlink.com", |
| 83 | + position: "Dev", |
| 84 | + project: "Events", |
| 85 | + pfp: { |
| 86 | + fields: { |
| 87 | + file: { |
| 88 | + url: "//t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" |
| 89 | + } |
| 90 | + } |
| 91 | + }, |
| 92 | + classes: "text-white", |
| 93 | +}, |
| 94 | +{ |
| 95 | + name: "John Doe", |
| 96 | + linkedin: "randomlink.com", |
| 97 | + position: "Dev", |
| 98 | + project: "Events", |
| 99 | + pfp: { |
| 100 | + fields: { |
| 101 | + file: { |
| 102 | + url: "//t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" |
| 103 | + } |
| 104 | + } |
| 105 | + }, |
| 106 | + classes: "text-white", |
| 107 | +}, |
| 108 | +]; |
| 109 | + |
| 110 | +const TechnicalTeam = () => { |
| 111 | + const [executives, setExecutives] = useState([]); |
| 112 | + const [projects, setProjects] = useState([]); |
| 113 | + const [activeTab, setActiveTab] = useState(''); |
| 114 | + |
| 115 | + useEffect(() => { |
| 116 | + fetchContent('technicalTeam').then((data) => { |
| 117 | + setExecutives(people); |
| 118 | + |
| 119 | + const uniqueProjects = data.map((exec) => exec.project).filter((pos, index, self) => self.indexOf(pos) === index); |
| 120 | + setProjects(["Presidents", "Events", "Finance", "Marketing", "Tech"]); |
| 121 | + |
| 122 | + if (uniqueProjects.length > 0) { |
| 123 | + setActiveTab(uniqueProjects[0]); |
| 124 | + } |
| 125 | + }); |
| 126 | + }, []); |
| 127 | + |
| 128 | + return ( |
| 129 | + <section className="bg-[#7055FD] p-12 h-screen"> |
| 130 | + <div className="mb-9"> |
| 131 | + <Heading underlineType={UnderlineTypes.GREEN_SHORT_UNDERLINE} classes={"text-white"}>Alumni</Heading> |
| 132 | + </div> |
| 133 | + <div> |
| 134 | + {projects.length > 0 && ( |
| 135 | + <Tabs value={activeTab} onChange={(val) => setActiveTab(val)}> |
| 136 | + <TabsHeader className="flex flex-row justify-center"> |
| 137 | + {projects.map((project) => ( |
| 138 | + <Tab className="alumni-tab rounded-full p-1 font-medium" key={project} value={project}> |
| 139 | + {project} |
| 140 | + </Tab> |
| 141 | + ))} |
| 142 | + </TabsHeader> |
| 143 | + <TabsBody> |
| 144 | + {projects.map((project) => ( |
| 145 | + <TabPanel key={project} value={project}> |
| 146 | + {project === "Presidents" ? ( |
| 147 | + <div className="text-white text-center text-xl font-semibold flex justify-center"> |
| 148 | + <CoPresident /> |
| 149 | + </div>) : ( |
| 150 | + <Team executives={executives.filter((exec) => exec.project === project)} /> |
| 151 | + )} |
| 152 | + </TabPanel> |
| 153 | + ))} |
| 154 | + </TabsBody> |
| 155 | + </Tabs> |
| 156 | + )} |
| 157 | + </div> |
| 158 | + </section> |
| 159 | + ); |
| 160 | +}; |
| 161 | + |
| 162 | +export default TechnicalTeam; |
0 commit comments