From c4a193db08c34704a2d611428726f188987f3d23 Mon Sep 17 00:00:00 2001 From: Jenna Wang Date: Sat, 16 Nov 2024 15:45:15 -0800 Subject: [PATCH 1/2] add useTitle --- src/components/General/useTitle.jsx | 9 +++++++++ src/pages/About.jsx | 2 ++ src/pages/Archive.jsx | 3 +++ src/pages/Blog.jsx | 3 +++ src/pages/Events.jsx | 2 ++ src/pages/Home.jsx | 3 +++ 6 files changed, 22 insertions(+) create mode 100644 src/components/General/useTitle.jsx diff --git a/src/components/General/useTitle.jsx b/src/components/General/useTitle.jsx new file mode 100644 index 000000000..4e817cb39 --- /dev/null +++ b/src/components/General/useTitle.jsx @@ -0,0 +1,9 @@ +import { useEffect } from 'react'; + +const useTitle = title => { + useEffect(() => { + document.title = `UCLA ACM HACK | ${title}`; + }, []); +}; + +export default useTitle; diff --git a/src/pages/About.jsx b/src/pages/About.jsx index ae5ae95a0..7bdd78968 100644 --- a/src/pages/About.jsx +++ b/src/pages/About.jsx @@ -3,8 +3,10 @@ import '../styles/About.css'; import Team from '../components/About/Team'; import Alumni from '../components/About/Alumni'; import { teamIntro } from '../data/profiles.js'; +import useTitle from '../components/General/useTitle.jsx'; export default function About() { + useTitle('About'); return (
diff --git a/src/pages/Archive.jsx b/src/pages/Archive.jsx index df8591633..b08600cae 100644 --- a/src/pages/Archive.jsx +++ b/src/pages/Archive.jsx @@ -2,8 +2,11 @@ import React, { useEffect, useState } from 'react'; import EventInfoItem from '../components/Archive/EventInfoItem'; import { archiveData } from '../data/archive'; import '../styles/Archive.css'; +import useTitle from '../components/General/useTitle'; export default function Archive() { + useTitle('Archive'); + const [data, setData] = useState([]); useEffect(() => { diff --git a/src/pages/Blog.jsx b/src/pages/Blog.jsx index 1ee02521e..156f2a658 100644 --- a/src/pages/Blog.jsx +++ b/src/pages/Blog.jsx @@ -2,8 +2,11 @@ import React from 'react'; import { useParams } from 'react-router-dom'; import BlogList from '../components/Blog/BlogList'; import BlogPost from '../components/Blog/BlogPost'; +import useTitle from '../components/General/useTitle'; export default function Blog() { + useTitle('Blog'); + const { blogId } = useParams(); return ( diff --git a/src/pages/Events.jsx b/src/pages/Events.jsx index db923acbc..da9208ce1 100644 --- a/src/pages/Events.jsx +++ b/src/pages/Events.jsx @@ -1,10 +1,12 @@ import React from 'react'; import '../styles/Events.css'; +import useTitle from '../components/General/useTitle'; import famimg from '../images/hack-fam-insta.png'; import hackimg from '../images/hack-school-insta.jpg'; export default function Events() { + useTitle('Events'); return (
diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index f78dfa5b1..84a48249e 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -4,8 +4,11 @@ import HackDescription from '../components/Home/HackDescription'; import PhotoCarousel from '../components/Home/PhotoCarousel'; import FAQSection from '../components/Home/FAQSection'; import Announcement from '../components/Home/Announcement'; +import useTitle from '../components/General/useTitle'; export default function Home() { + useTitle('Home'); + const Container1 = ({ children }) => (
{children}
From 37621ea87e95eb2c8e3779b226108a811b07af62 Mon Sep 17 00:00:00 2001 From: Jenna Wang Date: Mon, 18 Nov 2024 01:10:14 -0800 Subject: [PATCH 2/2] remove header from home and decaptitalize --- src/components/General/useTitle.jsx | 2 +- src/pages/Home.jsx | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/General/useTitle.jsx b/src/components/General/useTitle.jsx index 4e817cb39..70bc9ba38 100644 --- a/src/components/General/useTitle.jsx +++ b/src/components/General/useTitle.jsx @@ -2,7 +2,7 @@ import { useEffect } from 'react'; const useTitle = title => { useEffect(() => { - document.title = `UCLA ACM HACK | ${title}`; + document.title = `UCLA ACM Hack | ${title}`; }, []); }; diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index 84a48249e..f78dfa5b1 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -4,11 +4,8 @@ import HackDescription from '../components/Home/HackDescription'; import PhotoCarousel from '../components/Home/PhotoCarousel'; import FAQSection from '../components/Home/FAQSection'; import Announcement from '../components/Home/Announcement'; -import useTitle from '../components/General/useTitle'; export default function Home() { - useTitle('Home'); - const Container1 = ({ children }) => (
{children}