Skip to content

Commit 655d2b0

Browse files
committed
Add photo carousel to the Home hero
Replace the static Institute of Computing photo with a HomeCarousel component that slides between photos, with arrows, dots, autoplay (paused on hover and for reduced motion) and a 3:2 frame so photos are not cropped. Add the group photo as the first slide. Also format people.js with Prettier and remove a leftover "supervising students." fragment from Daniel's description.
1 parent fabce71 commit 655d2b0

5 files changed

Lines changed: 143 additions & 12 deletions

File tree

‎web/app/globals.css‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,76 @@ footer {
462462
color: #cedae6;
463463
margin-top: 5px;
464464
}
465+
.campus-carousel {
466+
overflow: hidden;
467+
border-radius: 3px;
468+
}
469+
.campus-hero .intro-campus {
470+
align-self: center;
471+
}
472+
.campus-hero .intro-campus .campus-carousel {
473+
height: auto;
474+
aspect-ratio: 3 / 2;
475+
}
476+
.campus-hero .intro-campus .campus-carousel img {
477+
height: 100%;
478+
min-height: 0;
479+
}
480+
.campus-track {
481+
display: flex;
482+
height: 100%;
483+
transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
484+
}
485+
.campus-track img {
486+
flex: 0 0 100%;
487+
min-width: 0;
488+
}
489+
.campus-prev,
490+
.campus-next {
491+
position: absolute;
492+
top: 50%;
493+
transform: translateY(-50%);
494+
display: flex;
495+
align-items: center;
496+
justify-content: center;
497+
width: 34px;
498+
height: 34px;
499+
border: 0;
500+
border-radius: 50%;
501+
background: #ffffffcc;
502+
color: #061a2f;
503+
cursor: pointer;
504+
}
505+
.campus-prev {
506+
left: 12px;
507+
}
508+
.campus-next {
509+
right: 12px;
510+
}
511+
.campus-dots {
512+
position: absolute;
513+
right: 19px;
514+
bottom: 19px;
515+
display: flex;
516+
gap: 6px;
517+
}
518+
.campus-dots button {
519+
width: 8px;
520+
height: 8px;
521+
padding: 0;
522+
border: 0;
523+
border-radius: 50%;
524+
background: #ffffff80;
525+
cursor: pointer;
526+
}
527+
.campus-dots button.active {
528+
background: #fff;
529+
}
530+
@media (prefers-reduced-motion: reduce) {
531+
.campus-track {
532+
transition: none;
533+
}
534+
}
465535
@media (max-width: 700px) {
466536
.intro-campus figure img {
467537
height: 240px;

‎web/app/home-carousel.js‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
'use client';
2+
import { useEffect, useState } from 'react';
3+
import { ChevronLeft, ChevronRight } from 'lucide-react';
4+
import { assetPath } from '../lib/site-path';
5+
export default function HomeCarousel({ photos }) {
6+
const [index, setIndex] = useState(0);
7+
const [paused, setPaused] = useState(false);
8+
const multiple = photos.length > 1;
9+
useEffect(() => {
10+
if (!multiple || paused || window.matchMedia('(prefers-reduced-motion: reduce)').matches)
11+
return;
12+
const timer = setInterval(() => setIndex((i) => (i + 1) % photos.length), 6000);
13+
return () => clearInterval(timer);
14+
}, [multiple, paused, photos.length]);
15+
const go = (step) => setIndex((index + step + photos.length) % photos.length);
16+
return (
17+
<figure
18+
className="campus-carousel"
19+
onMouseEnter={() => setPaused(true)}
20+
onMouseLeave={() => setPaused(false)}
21+
>
22+
<div className="campus-track" style={{ transform: `translateX(-${index * 100}%)` }}>
23+
{photos.map((photo, i) => (
24+
<img
25+
key={photo.src}
26+
src={assetPath(photo.src)}
27+
alt={photo.alt}
28+
aria-hidden={i !== index}
29+
/>
30+
))}
31+
</div>
32+
<figcaption>
33+
<span>Universidade Federal Fluminense</span>
34+
<small>Institute of Computing · Niterói, RJ</small>
35+
</figcaption>
36+
{multiple && (
37+
<>
38+
<button className="campus-prev" onClick={() => go(-1)} aria-label="Previous photo">
39+
<ChevronLeft size={18} />
40+
</button>
41+
<button className="campus-next" onClick={() => go(1)} aria-label="Next photo">
42+
<ChevronRight size={18} />
43+
</button>
44+
<div className="campus-dots">
45+
{photos.map((photo, i) => (
46+
<button
47+
key={photo.src}
48+
className={i === index ? 'active' : ''}
49+
onClick={() => setIndex(i)}
50+
aria-label={`Photo ${i + 1}`}
51+
/>
52+
))}
53+
</div>
54+
</>
55+
)}
56+
</figure>
57+
);
58+
}

‎web/app/page.js‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Projects from './projects';
44
import LinkedinPosts from './linkedin-posts';
55
import SiteHeader from './site-header';
66
import People from './people';
7+
import HomeCarousel from './home-carousel';
78
import { assetPath } from '../lib/site-path';
89
import { readPeople } from '../lib/people-store';
910

@@ -47,16 +48,18 @@ export default async function Home() {
4748
<div className="intro-location">Institute of Computing · Niterói, Rio de Janeiro</div>
4849
</div>
4950
<aside className="intro-campus">
50-
<figure>
51-
<img
52-
src={assetPath('/instituto.jpg')}
53-
alt="Institute of Computing at Universidade Federal Fluminense"
54-
/>
55-
<figcaption>
56-
<span>Universidade Federal Fluminense</span>
57-
<small>Institute of Computing · Niterói, RJ</small>
58-
</figcaption>
59-
</figure>
51+
<HomeCarousel
52+
photos={[
53+
{
54+
src: '/group.jpeg',
55+
alt: 'Illustration of UFFeScience research group members',
56+
},
57+
{
58+
src: '/instituto.jpg',
59+
alt: 'Institute of Computing at Universidade Federal Fluminense',
60+
},
61+
]}
62+
/>
6063
</aside>
6164
</section>
6265
<section id="novidades" className="news-section">

‎web/app/people.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export default function People({ people }) {
3232
<span className="kicker">RESEARCH AND SUPERVISION</span>
3333
<h3>Daniel de Oliveira</h3>
3434
<p>
35-
Associate Professor at Institute of Computing of Universidade Federal Fluminense. Principal Investigator of UFFeScience research group.
36-
supervising students.
35+
Associate Professor at Institute of Computing of Universidade Federal Fluminense.
36+
Principal Investigator of UFFeScience research group.
3737
</p>
3838
</div>
3939
</div>

‎web/public/group.jpeg‎

313 KB
Loading

0 commit comments

Comments
 (0)