Skip to content

Commit b08cabd

Browse files
authored
dynamic title (#488)
* add useTitle * remove header from home and decaptitalize * fix home bug
1 parent 18679be commit b08cabd

File tree

6 files changed

+22
-0
lines changed

6 files changed

+22
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { useEffect } from 'react';
2+
3+
const useTitle = title => {
4+
useEffect(() => {
5+
document.title = `UCLA ACM Hack${title}`;
6+
}, []);
7+
};
8+
9+
export default useTitle;

src/pages/About.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import '../styles/About.css';
33
import Team from '../components/About/Team';
44
import Alumni from '../components/About/Alumni';
55
import { teamIntro } from '../data/profiles.js';
6+
import useTitle from '../components/General/useTitle.jsx';
67

78
export default function About() {
9+
useTitle(' | About');
810
return (
911
<div id='about'>
1012
<div className='about-header'>

src/pages/Archive.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import React, { useEffect, useState } from 'react';
22
import EventInfoItem from '../components/Archive/EventInfoItem';
33
import { archiveData } from '../data/archive';
44
import '../styles/Archive.css';
5+
import useTitle from '../components/General/useTitle';
56

67
export default function Archive() {
8+
useTitle(' | Archive');
9+
710
const [data, setData] = useState([]);
811

912
useEffect(() => {

src/pages/Blog.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import React from 'react';
22
import { useParams } from 'react-router-dom';
33
import BlogList from '../components/Blog/BlogList';
44
import BlogPost from '../components/Blog/BlogPost';
5+
import useTitle from '../components/General/useTitle';
56

67
export default function Blog() {
8+
useTitle(' | Blog');
9+
710
const { blogId } = useParams();
811

912
return (

src/pages/Events.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React from 'react';
22
import '../styles/Events.css';
3+
import useTitle from '../components/General/useTitle';
34

45
import famimg from '../images/hack-fam-insta.png';
56
import hackimg from '../images/hack-school-insta.jpg';
67

78
export default function Events() {
9+
useTitle(' | Events');
810
return (
911
<div id='events'>
1012
<div className='events-header'>

src/pages/Home.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import HackDescription from '../components/Home/HackDescription';
44
import PhotoCarousel from '../components/Home/PhotoCarousel';
55
import FAQSection from '../components/Home/FAQSection';
66
import Announcement from '../components/Home/Announcement';
7+
import useTitle from '../components/General/useTitle';
78

89
export default function Home() {
10+
useTitle('');
11+
912
const Container1 = ({ children }) => (
1013
<section className='white-container'>
1114
<div className='container-md'>{children}</div>

0 commit comments

Comments
 (0)