Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic title #488

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}`;
ariyin marked this conversation as resolved.
Show resolved Hide resolved
}, []);
};

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('Home');
ariyin marked this conversation as resolved.
Show resolved Hide resolved

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