Skip to content
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

Add SponsorLogos section above footer #99

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/components/BottomBar.jsx → src/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { getColorTheme } from "../utilities/colors";

// sign-up data lives in this spreadsheet: https://docs.google.com/spreadsheets/d/1XgyHXaReTZ3Nq_r7QS18GDvqK_ht010QqnI6PXAnePA/edit#gid=1988825686

export default (props) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bpvcode what's the reason for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint was complaining about export an unnamed arrow function. The usage of this component should still be identical. This just resolved the ESLint warning.

export default function Footer(props) {
const [isModalVisible, setIsModalVisible] = useState(false); // show of modal
const [isValidName, setIsValidName] = useState(false); // valid name or not
const [isValidEmail, setIsValidEmail] = useState(false); // valid email or not
Expand Down Expand Up @@ -186,18 +186,18 @@ export default (props) => {

return (
<>
<EuiBottomBar position="static" style={{ backgroundColor: `${getColorTheme("bb_bgColor", props.theme)}`,}}>
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween">
<EuiFlexItem grow={false} >
<EuiText color={getColorTheme("text", props.theme)}>
<h4>
Hosted by Dunder Mifflin and Parks and Recreation Department
</h4>
</EuiText>
<EuiText color={getColorTheme("text", props.theme)}>
Group for all paper enthusiasts and bureaucrats
</EuiText>
</EuiFlexItem>
<EuiBottomBar position="static" style={{ backgroundColor: `${getColorTheme("bb_bgColor", props.theme)}` }}>
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween">
<EuiFlexItem grow={false} >
<EuiText color={getColorTheme("text", props.theme)}>
<h4>
Hosted by Dunder Mifflin and Parks and Recreation Department
</h4>
</EuiText>
<EuiText color={getColorTheme("text", props.theme)}>
Group for all paper enthusiasts and bureaucrats
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexGroup
direction="row"
Expand Down
11 changes: 7 additions & 4 deletions src/components/MainPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import {
EuiSpacer,
} from "@elastic/eui";
import Navbar from "./Navbar";
import BottomBar from "./BottomBar";
import Footer from "./Footer";
import EventDetails from "./panels/EventDetails";
import SpeakersPanel from "./panels/SpeakersPanel";
import TalksPanel from "./panels/TalksPanel";
import RecordingsPanel from "./panels/RecordingsPanel";
import FAQsPanel from "./panels/FAQsPanel";
import SponsorLogos from "./SponsorLogos";
import { Routes, Route } from "react-router-dom";
import history from "../utilities/history";

Expand Down Expand Up @@ -78,7 +79,7 @@ function MainPage(props) {
verticalPosition="center"
horizontalPosition="center"
>
<EuiPageContentBody>
<EuiPageContentBody restrictWidth>
<Routes>
<Route path="/" element={<EventDetails />} />
<Route path="/events" element={<EventDetails />} />
Expand All @@ -88,9 +89,11 @@ function MainPage(props) {
<Route path="/faq" element={<FAQsPanel />} />
</Routes>
</EuiPageContentBody>
<EuiSpacer size="l" />
<EuiSpacer size="xl" />
<SponsorLogos />
</EuiPageContent>
<BottomBar theme={props.theme} />
<EuiSpacer size="xl" />
<Footer theme={props.theme} />
</EuiPageBody>
</EuiFlexGroup>
</EuiPage>
Expand Down
108 changes: 108 additions & 0 deletions src/components/SponsorLogos.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { useState } from "react";
import {
EuiFlexGroup,
EuiFlexItem,
EuiTitle,
} from "@elastic/eui";
import { sponsors } from "../data/sponsors";
import { useIsXs, useIsS, useIsM } from "../hooks/responsive";
import loadingSpinner from '../images/sponsor-logos/loading.gif';
import useHover from "../hooks/hover";

export const SponsorLogo = ({ src, name }) => {
const [logo, setLogo] = useState(loadingSpinner);
if (!src.startsWith('http')) {
import(`../images/sponsor-logos/${src}`).then((module) => {
setLogo(module.default);
});
}

const [hoverRef, isHovered] = useHover();
const borderWidth = '2px';
return (
<div ref={hoverRef} style={{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we set these styles in either app.css or create another CSS file to store these styles?

display: 'grid',
placeItems: 'center',
width: '200px',
height: '150px',
position: 'relative',
borderWidth,
borderStyle: 'solid',
borderColor: isHovered ? 'var(--color-accent)' : 'transparent',
transition: 'border-color .15s ease-out',
overflow: 'hidden',
}}>
<img
src={src.startsWith('http') ? src : logo}
alt={name}
title={name}
style={{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same note about these styles

position: 'absolute',
top: '0',
left: '0',
width: '100%',
height: '100%',
objectFit: 'contain',
padding: '1rem',
}}
/>
<div style={{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and these

position: 'absolute',
bottom: '0',
left: `-${borderWidth}`,
width: `calc(100% + (${borderWidth} * 2))`,
height: 'auto',
backgroundColor: 'var(--color-accent)',
border: `${borderWidth} solid var(--color-accent)`,
opacity: isHovered ? 1 : 0,
textDecoration: 'none',
color: 'black',
fontSize: '1rem',
fontWeight: 600,
padding: '2px 4px',
transform: isHovered ? 'translateY(0%)' : 'translateY(100%)',
transition: 'opacity .15s ease-out, transform .15s ease-out',
}}>{name}</div>
</div>
);
};

export default function SponsorLogos() {
const [isXs, isS] = [useIsXs(), useIsS(), useIsM()];
const titleSize = isXs ? "xs" : isS ? "s" : "m";

return (
<>
<EuiFlexGroup
className="xMargin"
direction="column"
>
<div style={{ maxWidth: '1200px' }}>
<EuiTitle size={titleSize}>
<h1 style={{ marginTop: '12px', marginBottom: '24px' }} className="eui-textCenter">Featured Sponsors</h1>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these styles too

</EuiTitle>
<EuiFlexItem style={{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also these styles should be moved to CSS file

display: 'flex',
flexWrap: 'wrap',
flexDirection: 'row',
justifyContent: 'center',
gap: '1rem',
}}>
{sponsors.map(({ name, src, href }) => {
if (href?.length) {
return (
<a href={href} key={name} target="_blank" rel="noreferrer" title={name}>
<SponsorLogo src={src} name={name} />
</a>
);
}
return (
<SponsorLogo src={src} name={name} />
);
})}
</EuiFlexItem>
</div>
</EuiFlexGroup>
</>
);
};
2 changes: 1 addition & 1 deletion src/components/panels/SpeakersPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from "react";
import { useEffect } from "react";
import axios from 'axios'
import { useState } from "react";
import {webAppUrl as url} from '../../utilities/env'
import { webAppUrl as url } from '../../utilities/env'

// speaker data lives in this spreadsheet: https://docs.google.com/spreadsheets/d/1XgyHXaReTZ3Nq_r7QS18GDvqK_ht010QqnI6PXAnePA/edit#gid=0

Expand Down
37 changes: 37 additions & 0 deletions src/data/sponsors.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export const sponsors = [
{
name: "Google",
src: "https://upload.wikimedia.org/wikipedia/commons/2/2f/Google_2015_logo.svg",
href: "https://www.google.com/",
},
{
name: "Sponsor Name",
src: "fake-logo.png",
// `href` is optional, can be ommitted for unlinked sponsors
},
{
name: "Sponsor Name",
src: "fake-logo.png",
href: "#",
},
{
name: "Sponsor Name",
src: "fake-logo.png",
href: "#",
},
{
name: "Sponsor Name",
src: "fake-logo.png",
href: "#",
},
{
name: "Sponsor Name",
src: "fake-logo.png",
href: "#",
},
{
name: "Sponsor Name",
src: "fake-logo.png",
href: "#",
},
];
24 changes: 24 additions & 0 deletions src/hooks/hover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// source: https://usehooks.com/useHover/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandonmcconnell this could be that you are much more senior than me and there is a good reason for all of this, but are we sure this is really necessary for implementing the hover effect? Feel like there should be a simpler way to do it with the styles, but perhaps not actually. I will defer to you on this, but just wanted to comment and check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, absolutely. Using plain CSS< this will be much simpler, so I'll remove this hook when I move the styles over to pure CSS 👍🏼

import { useEffect, useState, useRef } from 'react';

export default function useHover() {
const [value, setValue] = useState(false);
const ref = useRef(null);
const handleMouseOver = () => setValue(true);
const handleMouseOut = () => setValue(false);
useEffect(
() => {
const node = ref.current;
if (node) {
node.addEventListener("mouseover", handleMouseOver);
node.addEventListener("mouseout", handleMouseOut);
return () => {
node.removeEventListener("mouseover", handleMouseOver);
node.removeEventListener("mouseout", handleMouseOut);
};
}
},
[ref.current]
);
return [ref, value];
}
Binary file added src/images/sponsor-logos/fake-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/sponsor-logos/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.