diff --git a/src/components/General/useTitle.jsx b/src/components/General/useTitle.jsx new file mode 100644 index 000000000..70bc9ba38 --- /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 (