Skip to content

Commit 8ba8c1f

Browse files
Refactoring Hero opacity effect; optimizing project images
1 parent 419a9e5 commit 8ba8c1f

File tree

7 files changed

+3
-16
lines changed

7 files changed

+3
-16
lines changed

components/Hero.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useEffect } from 'react';
1+
import { useState } from 'react';
22
import Image from 'next/image';
33
import Nav from './Nav';
44
import Container from './Container';
@@ -18,16 +18,7 @@ export default function Hero({
1818
setTitleIndex(titleIndex >= dynamicTitles.length - 1 ? 0 : titleIndex + 1);
1919
};
2020

21-
useEffect(() => {
22-
const dynamicTitleEl = document.getElementById('dynamicTitle');
23-
if (dynamicTitleEl.style.opacity === '1') {
24-
dynamicTitleEl.style.opacity = '0';
25-
} else {
26-
dynamicTitleEl.style.opacity = '1';
27-
}
28-
}, [titleIndex]);
29-
30-
setTimeout(handleTitleIndex, 1350);
21+
setTimeout(handleTitleIndex, 1550);
3122

3223
return (
3324
<div
@@ -47,9 +38,7 @@ export default function Hero({
4738
<div className={styles.header__content__upper}>
4839
<h1 className={titleClass ? `${styles[titleClass]}` : ''}>
4940
{title}
50-
{dynamicTitles && (
51-
<span id="dynamicTitle"> {dynamicTitles[titleIndex]}</span>
52-
)}
41+
{dynamicTitles && <span> {dynamicTitles[titleIndex]}</span>}
5342
</h1>
5443
</div>
5544
<div className={styles.header__content__bottom}>

public/images/about-us-bg.png

-11.4 MB
Loading

public/images/home-bg.png

-8.19 MB
Loading

public/images/join-us.jpg

-180 KB
Loading

public/images/mentor.jpg

-20.9 KB
Loading

public/images/volunteer.jpg

-16.8 KB
Loading

styles/Hero.module.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
font-style: italic;
2828
font-weight: bold;
2929
line-height: 3.5rem;
30-
opacity: 0;
31-
@include transition(opacity 1.55s ease-in-out);
3230
@include desktop {
3331
font-size: 4.5rem;
3432
line-height: 5rem;

0 commit comments

Comments
 (0)