Skip to content

Commit

Permalink
dynamic title (#488)
Browse files Browse the repository at this point in the history
* add useTitle

* remove header from home and decaptitalize

* fix home bug
  • Loading branch information
ariyin authored Nov 22, 2024
1 parent 18679be commit b08cabd
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/General/useTitle.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useEffect } from 'react';

const useTitle = title => {
useEffect(() => {
document.title = `UCLA ACM Hack${title}`;
}, []);
};

export default useTitle;
2 changes: 2 additions & 0 deletions src/pages/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div id='about'>
<div className='about-header'>
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Archive.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Blog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Events.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<div id='events'>
<div className='events-header'>
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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('');

const Container1 = ({ children }) => (
<section className='white-container'>
<div className='container-md'>{children}</div>
Expand Down

0 comments on commit b08cabd

Please sign in to comment.