-
Notifications
You must be signed in to change notification settings - Fork 6
Isaiah/previous exec teams #549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
IsaiahA21
wants to merge
39
commits into
main
Choose a base branch
from
isaiah/previousTeams
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
3995d7f
Update colors and styles for TeamSection component. Make the sldier s…
IsaiahA21 d16ba40
Update TeamPage component to include PreviousExecTeam section. Still …
IsaiahA21 2e057ed
Refactor PreviousExecTeam component to include pagination controls an…
IsaiahA21 208e1ce
Refactor PreviousExecTeam component styles and structure.
IsaiahA21 8b96172
added 2023-2024 team data
IsaiahA21 099fc5f
added all the previous team data
IsaiahA21 ae7b5a8
Refactored PreviousExecTeam style
IsaiahA21 ed34939
refactor code
IsaiahA21 2e14a60
Ran prettier
IsaiahA21 33e3702
Remove the Divider line. Made only 1 year visible at a time.
IsaiahA21 9b1191f
Merge branch 'main' into isaiah/previousTeams
IsaiahA21 8ba1112
Add Seisware sponsor logo and link to SponsorSection (#551)
IsaiahA21 1888728
Refactor PreviousExecTeam to include section for image of the prev ex…
IsaiahA21 7357597
added a lightgrey background to each previous exec member
IsaiahA21 542b3b8
ran prettier
IsaiahA21 0057c8f
Bump braces in the npm_and_yarn group across 1 directory
dependabot[bot] a664628
Bump ejs in the npm_and_yarn group across 1 directory
dependabot[bot] 78ec916
Change YearButton from button to div and remove hover effects
IsaiahA21 17ab1a7
added the acutal previous team pictures
IsaiahA21 35de2c1
Updated Ryan's Picture (#548)
Sahitiakella 2acf97d
Update colors and styles for TeamSection component. Make the sldier s…
IsaiahA21 e02dde0
Update TeamPage component to include PreviousExecTeam section. Still …
IsaiahA21 25f1f0f
Refactor PreviousExecTeam component to include pagination controls an…
IsaiahA21 87970d2
Refactor PreviousExecTeam component styles and structure.
IsaiahA21 b6046c4
added 2023-2024 team data
IsaiahA21 0d40c6e
added all the previous team data
IsaiahA21 9fa28be
Refactored PreviousExecTeam style
IsaiahA21 9d305b3
refactor code
IsaiahA21 e8c74e6
Ran prettier
IsaiahA21 1a7ca77
Remove the Divider line. Made only 1 year visible at a time.
IsaiahA21 fd66bcd
Refactor PreviousExecTeam to include section for image of the prev ex…
IsaiahA21 9da29e7
added a lightgrey background to each previous exec member
IsaiahA21 c113374
ran prettier
IsaiahA21 dd312f7
Change YearButton from button to div and remove hover effects
IsaiahA21 c6f450b
added the acutal previous team pictures
IsaiahA21 6acf1fd
wrapped functions in useCallback
IsaiahA21 b9034ef
Merge branch 'isaiah/previousTeams' of https://github.com/techstartuc…
IsaiahA21 39798e0
Refactor PreviousExecTeam component to simplify year selection logic
IsaiahA21 39d5c4c
Remove unused useEffect import
IsaiahA21 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/components/PreviousExecTeam/PreviousExecTeam.styles.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| import styled from "styled-components"; | ||
|
|
||
| export const PrevTeamSection = styled.div` | ||
| margin-left: auto; | ||
| margin-right: auto; | ||
| padding-bottom: 2rem; | ||
| text-align: center; | ||
| background-color: white; | ||
|
|
||
| `; | ||
|
|
||
| export const SectionHeader = styled.div` | ||
| padding: 2rem 0; | ||
| font-size: 2.5rem; | ||
| color: black; | ||
| font-weight: 900; | ||
| text-align: center; | ||
| font-family: Inter, Tahoma, sans-serif; | ||
| line-height: 1; | ||
| `; | ||
|
|
||
| export const PaginationControl = styled.div` | ||
| display: flex; | ||
| /* border: 1px red solid; */ | ||
| margin-left: auto; | ||
| margin-right: auto; | ||
| justify-content: center; | ||
| `; | ||
|
|
||
| export const ArrowButton = styled.button` | ||
| background-color: white; | ||
| border: none; | ||
| border-radius: 50%; | ||
| color: #333; | ||
| font-size: 1.5rem; | ||
| padding: 0.5rem 1rem; | ||
| cursor: pointer; | ||
| transition: background-color 0.3s; | ||
|
|
||
| &:hover { | ||
| background-color: #e0e0e0; | ||
| } | ||
|
|
||
| &:disabled { | ||
| cursor: not-allowed; | ||
| } | ||
| `; | ||
|
|
||
| export const YearButton = styled.div` | ||
| background-color: transparent; | ||
| border: 1px lightgray solid; | ||
| border-radius: 10px; | ||
| color: #333; | ||
| font-size: 1.2rem; | ||
| padding: 0.5rem 2rem; | ||
| margin: 0 0.3rem; | ||
| transition: color 0.3s; | ||
| `; | ||
|
|
||
| export const Carousel = styled.div` | ||
| width: 40%; | ||
| margin: 3rem auto; | ||
| @media(max-width: 768px) { | ||
| width: 80%; | ||
| } | ||
| `; | ||
|
|
||
| export const TeamList = styled.div` | ||
| max-width: 85%; | ||
| margin: 0 auto; | ||
| display: grid; | ||
| grid-template-columns: repeat(3, 1fr); | ||
| gap: 2rem; | ||
|
|
||
| @media (max-width: 768px) { | ||
| grid-template-columns: 1fr 1fr; | ||
| } | ||
| @media (max-width: 600px) { | ||
| grid-template-columns: 1fr; | ||
| } | ||
| `; | ||
|
|
||
| export const TeamMember = styled.div` | ||
| background-color: #f5f5f5; | ||
| border-radius: 0.5rem; | ||
| padding: 1rem 0rem; | ||
| `; | ||
|
|
||
| export const TeamHeader = styled.a` | ||
| font-size: 20px; | ||
| font-weight: bold; | ||
| margin: 0 0 10px 0; | ||
| text-decoration: none; | ||
| color: inherit; | ||
| transition: color 0.3s, text-decoration 0.3; | ||
| &:hover { | ||
| color: #4dd6a8; | ||
| text-decoration: underline; | ||
| } | ||
| `; | ||
|
|
||
| export const TeamRole = styled.p` | ||
| font-size: 16px; | ||
| margin: 0 0 5px 0; | ||
|
|
||
| `; | ||
| export const YearPagination = styled.div``; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,195 @@ | ||
| import React, { useEffect, useState } from "react"; | ||
| import * as S from "./PreviousExecTeam.styles"; | ||
| import { prevExecTeamList, PrevExecTeam } from "./PreviousExecTeamsInfo"; | ||
| // https://react-slick.neostack.com/docs/example/ | ||
| import Divider from "components/Divider"; | ||
| import { | ||
| faChevronLeft, | ||
| faChevronRight, | ||
| } from "@fortawesome/free-solid-svg-icons"; | ||
| import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
|
|
||
| const PAGINATION_VISIBLE_YEARS = 1; | ||
|
|
||
| // interface of the prop | ||
| interface PreviousExecTeamProps { | ||
| desktopView: boolean; | ||
| } | ||
| const PreviousExecTeam = ({ desktopView }: PreviousExecTeamProps) => { | ||
| const [selectedYear, setSelectedYear] = useState( | ||
| prevExecTeamList[prevExecTeamList.length - 1].year | ||
| ); | ||
| const [visibleYears, setVisibleYears] = useState<PrevExecTeam[]>([]); | ||
|
|
||
| useEffect(() => { | ||
| updateVisibleYears(); | ||
| }, [desktopView]); // only run on inital render or when view changes | ||
|
|
||
| // Function to set the visible years | ||
| function updateVisibleYears() { | ||
| const selectedYearIndex = getSelectedYearIndex(); | ||
|
|
||
| // Calculate startIndex based on the selectedYearIndex | ||
| let startIndex = Math.max( | ||
| 0, | ||
| prevExecTeamList.length - PAGINATION_VISIBLE_YEARS | ||
| ); | ||
| // If the selected year is near the beginning, adjust startIndex to show available years | ||
| if (selectedYearIndex < startIndex) { | ||
| startIndex = Math.max( | ||
| 0, | ||
| selectedYearIndex - Math.floor(PAGINATION_VISIBLE_YEARS / 2) | ||
| ); | ||
| } | ||
|
|
||
| // Calculate endIndex based on startIndex | ||
| const endIndex = Math.min( | ||
| prevExecTeamList.length, | ||
| startIndex + PAGINATION_VISIBLE_YEARS | ||
| ); | ||
|
|
||
| setVisibleYears(prevExecTeamList.slice(startIndex, endIndex)); | ||
| } | ||
|
|
||
| const getSelectedYearIndex = (): number => | ||
| prevExecTeamList.findIndex((data) => data.year === selectedYear); | ||
|
|
||
| const handleLeftArrow = () => { | ||
| const selectedYearIndex = getSelectedYearIndex(); | ||
| if (selectedYearIndex > 0) { | ||
| setSelectedYear(prevExecTeamList[selectedYearIndex - 1].year); | ||
|
|
||
| // Recalculate visible years only if necessary | ||
| const currentStartIndex = prevExecTeamList.findIndex( | ||
| (data) => data.year === visibleYears[0].year | ||
| ); | ||
|
|
||
| // if the selectedyear index less that the start of the visible year array | ||
| if (selectedYearIndex - 1 < currentStartIndex) { | ||
| // Only shift the visible years by 1 year to the left so we don't introduce any unnecssary years | ||
| const newStartIndex = Math.max(0, currentStartIndex - 1); | ||
| const newEndIndex = Math.min( | ||
| prevExecTeamList.length, | ||
| newStartIndex + PAGINATION_VISIBLE_YEARS | ||
| ); | ||
| setVisibleYears(prevExecTeamList.slice(newStartIndex, newEndIndex)); | ||
| } | ||
| } | ||
| }; | ||
| const handleRightArrow = () => { | ||
| const selectedYearIndex = getSelectedYearIndex(); | ||
| if (selectedYearIndex < prevExecTeamList.length - 1) { | ||
| setSelectedYear(prevExecTeamList[selectedYearIndex + 1].year); | ||
|
|
||
| // Recalculate visible years only if necessary | ||
| const currentStartIndex = prevExecTeamList.findIndex( | ||
| (data) => data.year === visibleYears[0].year | ||
| ); | ||
|
|
||
| // If the selected year moves beyond the currently visible years | ||
| if ( | ||
| selectedYearIndex + 1 >= | ||
| currentStartIndex + PAGINATION_VISIBLE_YEARS | ||
| ) { | ||
| // Shift the visible years by one to the right | ||
| const newStartIndex = Math.min( | ||
| prevExecTeamList.length - PAGINATION_VISIBLE_YEARS, | ||
| currentStartIndex + 1 | ||
| ); | ||
| const newEndIndex = Math.min( | ||
| prevExecTeamList.length, | ||
| newStartIndex + PAGINATION_VISIBLE_YEARS | ||
| ); | ||
| setVisibleYears(prevExecTeamList.slice(newStartIndex, newEndIndex)); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <S.PrevTeamSection> | ||
| <Divider /> | ||
| <S.SectionHeader>Previous Executives</S.SectionHeader> | ||
| <S.PaginationControl> | ||
| <S.ArrowButton | ||
| className="arrow-button" | ||
| onClick={handleLeftArrow} | ||
| disabled={getSelectedYearIndex() === 0} | ||
| > | ||
| <FontAwesomeIcon | ||
| icon={faChevronLeft} | ||
| size="sm" | ||
| style={{ color: getSelectedYearIndex() === 0 ? "grey" : "black" }} | ||
| /> | ||
| </S.ArrowButton> | ||
| <S.YearPagination> | ||
| {visibleYears.map((data) => ( | ||
| <S.YearButton key={data.year}>{data.year}</S.YearButton> | ||
| ))} | ||
| </S.YearPagination> | ||
| <S.ArrowButton | ||
| className="arrow-button" | ||
| onClick={handleRightArrow} | ||
| disabled={getSelectedYearIndex() === prevExecTeamList.length - 1} | ||
| > | ||
| <FontAwesomeIcon | ||
| icon={faChevronRight} | ||
| size="sm" | ||
| style={{ | ||
| color: | ||
| getSelectedYearIndex() === prevExecTeamList.length - 1 | ||
| ? "grey" | ||
| : "black", | ||
| }} | ||
| /> | ||
| </S.ArrowButton> | ||
| </S.PaginationControl> | ||
|
|
||
| {prevExecTeamList | ||
| .filter((team) => team.year === selectedYear) | ||
| .map((team: PrevExecTeam) => { | ||
| return ( | ||
| <> | ||
| <S.Carousel> | ||
| {team.picture ? ( | ||
| <img | ||
| src={team.picture} | ||
| style={{ | ||
| width: "100%", | ||
| height: "auto", | ||
| borderRadius: "0.75rem", | ||
| objectFit: "cover", | ||
| boxShadow: "0rem 1.5rem 2rem -1.5rem rgba(0, 0, 0, 0.7)", | ||
| }} | ||
| /> | ||
| ) : ( | ||
| <p>No picture available</p> | ||
| )} | ||
| </S.Carousel> | ||
| <S.TeamList> | ||
| {team.members.length > 0 && ( | ||
| <> | ||
| {team.members.map((member, index) => ( | ||
| <S.TeamMember key={index}> | ||
| <div style={{ justifyContent: "center" }}> | ||
| <S.TeamHeader | ||
| href={member.linkedin_url} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| {member.name} | ||
| </S.TeamHeader> | ||
| <S.TeamRole>{member.role}</S.TeamRole> | ||
| </div> | ||
| </S.TeamMember> | ||
| ))} | ||
| </> | ||
| )} | ||
| </S.TeamList> | ||
| </> | ||
| ); | ||
| })} | ||
| </S.PrevTeamSection> | ||
| ); | ||
| }; | ||
|
|
||
| export default React.memo(PreviousExecTeam); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.