Skip to content

Commit

Permalink
Refactor: Migrate 'pages' ES6 functional components to ES5
Browse files Browse the repository at this point in the history
- 'AboutPage.tsx'.
- 'AccessPage.tsx'.
- 'ContactPage.tsx'.
- 'ExpertiseSummaryPage.tsx'.
- 'HomePage.tsx'.
- 'NotFoundPage.tsx'.
- 'ProjectsPage.tsx'.
  • Loading branch information
ITurres committed Apr 10, 2024
1 parent e2a7741 commit beaeeae
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
8 changes: 5 additions & 3 deletions src/components/pages/AboutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import ExpertiseLinks from '../UI/ExpertiseLinks.tsx';

import setPageTitle from '../../utils/setPageTitle.ts';

const AboutPage: React.FC = () => {
function AboutPage(): React.ReactElement {
const $aboutPage = useRef<HTMLElement>(null);

setPageTitle('About me 🙋‍♂️');

useEffect(() => {
if ($aboutPage.current) {
$aboutPage.current.style.display = 'flex'; // ?overrides the {display: none} on 'aboutPage.scss'. This is to prevent the aboutPage from showing before animation is applied.
// * overrides the {display: none} on 'aboutPage.scss'.
// * This is to prevent the aboutPage from showing before animation is applied.
$aboutPage.current.style.display = 'flex';
$aboutPage.current.classList.add('blend-in-out');
}
});
Expand Down Expand Up @@ -68,6 +70,6 @@ const AboutPage: React.FC = () => {
</div>
</main>
);
};
}

export default AboutPage;
4 changes: 2 additions & 2 deletions src/components/pages/AccessPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const AstronautStyleProps = {
},
};

const AccessPage = () => {
function AccessPage(): React.ReactElement {
const $accessPageMain = useRef<HTMLElement>(null);
const $videoElement = useRef<HTMLVideoElement>(null);
const navigate = useNavigate();
Expand Down Expand Up @@ -79,6 +79,6 @@ const AccessPage = () => {
<AccessPageVideo $videoElement={$videoElement} />
</div>
);
};
}

export default AccessPage;
4 changes: 2 additions & 2 deletions src/components/pages/ContactPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ContactForm from '../UI/ContactForm.tsx';

import setPageTitle from '../../utils/setPageTitle.ts';

const ContactPage: React.FC = () => {
function ContactPage(): React.ReactElement {
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
const laptopWidth = 1366;

Expand Down Expand Up @@ -42,6 +42,6 @@ const ContactPage: React.FC = () => {
</div>
</div>
);
};
}

export default ContactPage;
4 changes: 2 additions & 2 deletions src/components/pages/ExpertiseSummaryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../../styles/pages/ExpertiseSummaryPage.scss';

import setPageTitle from '../../utils/setPageTitle.ts';

const ExpertiseSummaryPage: React.FC = () => {
function ExpertiseSummaryPage(): React.ReactElement {
setPageTitle('My expertise 💼');

return (
Expand Down Expand Up @@ -35,6 +35,6 @@ const ExpertiseSummaryPage: React.FC = () => {
</div>
</div>
);
};
}

export default ExpertiseSummaryPage;
4 changes: 2 additions & 2 deletions src/components/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ProjectsPage from './ProjectsPage.tsx';
import NotFoundPage from './NotFoundPage.tsx';
import FileTabsNavbar from '../UI/FileTabsNavbar.tsx';

const HomePage: React.FC = () => {
function HomePage(): React.ReactElement {
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
const minWith = 768;

Expand All @@ -36,6 +36,6 @@ const HomePage: React.FC = () => {
</Routes>
</>
);
};
}

export default HomePage;
6 changes: 4 additions & 2 deletions src/components/pages/NotFoundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const AstronautStyleProps = {
},
};

const NotFoundPage: React.FC<NotFoundPageProps> = ({ fromPath }) => {
function NotFoundPage(props: NotFoundPageProps): React.ReactElement {
const { fromPath } = props;

const isWildCardAtAccessPage = fromPath === '/';

const pathTo = isWildCardAtAccessPage ? '/' : '/homepage';
Expand Down Expand Up @@ -63,6 +65,6 @@ const NotFoundPage: React.FC<NotFoundPageProps> = ({ fromPath }) => {
</header>
</main>
);
};
}

export default NotFoundPage;
4 changes: 2 additions & 2 deletions src/components/pages/ProjectsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import setPageTitle from '../../utils/setPageTitle.ts';

import involvement from '../../services/involvementAPI/involvementAPI.ts';

const ProjectsPage: React.FC = () => {
function ProjectsPage(): React.ReactElement {
setPageTitle('My projects 😊');

const [projectsLikes, setProjectsLikes] = useState([{}]);
Expand Down Expand Up @@ -49,6 +49,6 @@ const ProjectsPage: React.FC = () => {
</main>
</div>
);
};
}

export default ProjectsPage;

0 comments on commit beaeeae

Please sign in to comment.