Skip to content

Commit

Permalink
Merge pull request #201 from nwplus/www-enhancements
Browse files Browse the repository at this point in the history
QA + mobile/animations
  • Loading branch information
DonaldKLee authored Sep 15, 2024
2 parents 583602b + 8772762 commit 27a0557
Show file tree
Hide file tree
Showing 48 changed files with 8,322 additions and 1,158 deletions.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
96 changes: 96 additions & 0 deletions components/AboutUsGallery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import React, { useEffect, useState } from 'react';
import ImageTileContainer from './ImageTileContainer';
import Carousel from './Carousel';
import styled from 'styled-components';

const GalleryContainer = styled.div`
display: flex;
flex-direction: row;
height: 400px;
width: 100%;
gap: 16px;
& > * {
flex-basis: 50%;
}
${(p) => p.theme.mediaQueries.mobile} {
flex-direction: column;
height: auto;
& > * {
flex-basis: auto;
}
}
`;

const GalleryVideo = styled.iframe`
height: 400px;
width: 100%;
margin-bottom: 10px;
border: none;
border-radius: 6px;
${(p) => p.theme.mediaQueries.mobile} {
height: 225px;
}
`;

const Image = styled.img`
height: 400px;
width: 100%;
margin-bottom: 10px;
border-radius: 6px;
object-fit: cover;
${(p) => p.theme.mediaQueries.mobile} {
height: 225px;
}
`;

/**
*
* @param {{ videoSrc: string, images: import('./ImageTileContainer').ImageTileRow[] }} param0
* @returns
*/
function AboutUsGallery({ videoSrc, images }) {
const [width, setWidth] = useState(0);
const mobileBreakpoint = 768;

useEffect(() => {
setWidth(window.innerWidth);
window.addEventListener('resize', () => setWidth(window.innerWidth));
}, []);

return width <= mobileBreakpoint ? (
<Carousel
items={[
<GalleryVideo
src={videoSrc}
title='YouTube video player'
allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'
referrerpolicy='strict-origin-when-cross-origin'
allowFullScreen
key='video'
></GalleryVideo>,
...images.flatMap((imgTileRow) => [
<Image src={imgTileRow.leftImg} key={imgTileRow.leftImg} />,
<Image src={imgTileRow.rightImg} key={imgTileRow.rightImg} />,
]),
]}
/>
) : (
<GalleryContainer>
<GalleryVideo
src={videoSrc}
title='YouTube video player'
allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'
referrerpolicy='strict-origin-when-cross-origin'
allowFullScreen
></GalleryVideo>
<ImageTileContainer rows={images} />;
</GalleryContainer>
);
}

export default AboutUsGallery;
16 changes: 4 additions & 12 deletions components/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ const EmptyDiamond = styled.div`
cursor: pointer;
`;

const Image = styled.img`
height: 100%;
width: 100%;
margin-bottom: 10px;
border-radius: 6px;
object-fit: cover;
`;

const BaseArrow = css`
border: solid ${(p) => p.theme.colors.primary};
border-width: 0 2px 2px 0;
Expand All @@ -70,9 +62,9 @@ const LeftArrow = styled.i`
left: 5%;
`

export default function Carousel ({ images, height, width }) {
export default function Carousel ({ items, height, width }) {
const [imageIndex, setImageIndex] = useState(0);
const numImages = images.length;
const numImages = items.length;

useEffect(() => {
const interval = setInterval(() => {
Expand All @@ -89,9 +81,9 @@ export default function Carousel ({ images, height, width }) {
<Container width={width} height={height}>
<RightArrow onClick={() => setImageIndex(imageIndex == numImages - 1 ? 0 : imageIndex + 1)}/>
<LeftArrow onClick={() => setImageIndex(imageIndex == 0 ? numImages - 1 : imageIndex - 1)}/>
<Image src={images[imageIndex]} />
{items[imageIndex]}
<FlexBox>
{images.map((item, index) => {
{items.map((item, index) => {
return index == imageIndex
? <FilledDiamond key={index} />
: <EmptyDiamond key={index} onClick={() => setImageIndex(index)}/>
Expand Down
10 changes: 5 additions & 5 deletions components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ const profiles = [
name: 'Alissa Guo',
emoji: 'πŸ₯˜',
color: '#FFC0CB',
title: 'Cmd-f logistics coordinator',
title: 'cmd-f Logistics Coordinator',
social: 'https://www.linkedin.com/in/alissa-guo/'
},
{
img: '/assets/profiles/Allison_Chu.png',
name: 'Allison Chu',
emoji: 'πŸš…',
color: '#01DACC',
title: '',
title: 'Design Coordinator',
social: ''
},
{
Expand Down Expand Up @@ -301,7 +301,7 @@ const profiles = [
name: 'Khoa Bui',
emoji: '🐧',
color: '#e46060',
title: 'Logistics Coordinator',
title: 'nwHacks Logistics Coordinator',
social: ''
},
{
Expand Down Expand Up @@ -365,15 +365,15 @@ const profiles = [
name: 'Michelle Wan',
emoji: 'πŸ™†πŸ»β€β™€οΈ',
color: '#e8dcfc',
title: 'Sponsorships Coordinator',
title: 'Sponsorship Coordinator',
social: 'https://mwchelle.me'
},
{
img: '/assets/profiles/Michelle_Wang.png',
name: 'Michelle Wang',
emoji: '❄️',
color: '#9CDDFB',
title: 'Tres',
title: 'Treasurer',
social: 'https://www.linkedin.com/in/michelle-wang-mw/'
},
{
Expand Down
Loading

0 comments on commit 27a0557

Please sign in to comment.