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 scrolling photo bar (#9) #10

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Header } from "./components/Header/Header.tsx";
import { PhotoBar } from "./components/PhotoBar/PhotoBar.tsx";
import { Footer } from "./components/Footer/Footer.tsx";
import { Navigation } from "./components/Navigation/Navigation.tsx";
import { SampleSection } from "./components/Sections/SampleSection.tsx";
Expand All @@ -13,6 +14,7 @@ export const App = () => {
{/* sections can go here */}
<SampleSection />

<PhotoBar />
<Footer />
</MainWrapper>
);
Expand Down
4 changes: 0 additions & 4 deletions src/components/Footer/Footer.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
@use "../../shared/colors";

#footer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
Expand Down
47 changes: 47 additions & 0 deletions src/components/PhotoBar/People.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export interface IPerson {
name: string;
position: string;
img: string; // images should have square dimensions
link?: string;
}

const People: ReadonlyArray<IPerson> = [
{
name: "Branden Ghena",
position: "Professor",
img: "https://www.mccormick.northwestern.edu/images/research-and-faculty/directory/ghena-branden.jpg",
link: "https://brandenghena.com/",
},
{
name: "FirstName LastName",
position: "Placeholder",
img: "https://www.thispersondoesnotexist.com",
},
{
name: "FirstName LastName",
position: "Placeholder",
img: "https://www.thispersondoesnotexist.com",
},
{
name: "FirstName LastName",
position: "Placeholder",
img: "https://www.thispersondoesnotexist.com",
},
{
name: "FirstName LastName",
position: "Placeholder",
img: "https://www.thispersondoesnotexist.com",
},
{
name: "FirstName LastName",
position: "Placeholder",
img: "https://www.thispersondoesnotexist.com",
},
{
name: "FirstName LastName",
position: "Placeholder",
img: "https://www.thispersondoesnotexist.com",
},
];

export default People;
76 changes: 76 additions & 0 deletions src/components/PhotoBar/PhotoBar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@use "../../shared/colors";

#photobar {
margin-top: auto;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;

h2 {
margin: 0rem;
text-align: center;
}

.photobar__animation {
animation-name: scroll-left;
animation-timing-function: linear;
animation-iteration-count: infinite;
display: flex;
flex-direction: row;
gap: 4rem;
justify-content: space-evenly;
align-items: center;
padding: 4rem 0rem;
width: max-content;

a {
color: colors.$global-very-dark-green;
}

.photobar__flexbox {
display: flex;
flex-direction: column;
flex-shrink: 0;
align-items: center;
background-color: colors.$global-light;
padding: 1rem;
width: 12rem;

.photobar__image {
img {
width: 100%;
height: 100%;
}
}

h3 {
font-size: 1rem;
text-align: center;
margin: 0rem;
}

p {
text-align: center;
margin: 0rem;
}
}

.photobar__rotate_right {
transform: rotate(5deg);
}

.photobar__rotate_left {
transform: rotate(-5deg);
}
}
}

@keyframes scroll-left {
from {
transform: translateX(100vw);
}
to {
transform: translateX(-100%);
}
}
40 changes: 40 additions & 0 deletions src/components/PhotoBar/PhotoBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import "./PhotoBar.scss";
import { IPerson } from "./People";
import People from "./People";

interface IPhotoBar {}

export const PhotoBar: React.FC<IPhotoBar> = () => {
const secondsPerPerson = 5;
return (
<div id="photobar">
<h2>Meet our Team</h2>
<div
className="photobar__animation"
style={{
animationDuration: `${(People.length * secondsPerPerson).toString()}s`,
}}
>
{People.map((person: IPerson, i) => (
<a
href={person.link ? person.link : "javascript:void(0);"}
rel="noreferrer"
>
<div
key={i}
className={`photobar__flexbox ${i % 2 === 0 ? "photobar__rotate_right" : "photobar__rotate_left"}`}
>
<div className="photobar__image">
<img className="photo" src={person.img} />
</div>
<h3>{person.name}</h3>
<p>{person.position}</p>
</div>
</a>
))}
</div>
</div>
);
};

export default PhotoBar;
Loading