-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from BU-Spark/activeElementFix
Boston Voter App: Active element fix for internal linking buttons
- Loading branch information
Showing
12 changed files
with
76 additions
and
19 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* A context for setting the active page for navbar styling. Needed to allow | ||
* buttons to also change the active page, so made a context. | ||
*/ | ||
'use client'; | ||
|
||
import React, { createContext, useState, useContext, ReactNode } from 'react'; | ||
|
||
interface ActivePageContextProps { | ||
activePage: string; | ||
setActivePage: (page: string) => void; | ||
} | ||
|
||
const ActivePageContext = createContext<ActivePageContextProps | undefined>(undefined); | ||
|
||
export const ActivePageProvider = ({ children }: { children: ReactNode }) => { | ||
const [activePage, setActivePage] = useState<string>('Upcoming Elections'); | ||
return ( | ||
<ActivePageContext.Provider value={{ activePage, setActivePage }}> | ||
{children} | ||
</ActivePageContext.Provider> | ||
); | ||
}; | ||
|
||
export const useActivePage = () => { | ||
const context = useContext(ActivePageContext); | ||
if (context === undefined) { | ||
throw new Error('useActivePage must be used within an ActivePageProvider'); | ||
} | ||
return context; | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// pages/index.tsx | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import NavBar from '../components/nav/NavBar'; | ||
import UpcomingElections from '@/pages/upcomingElections'; // Ensure this is the correct import path | ||
|
||
const Home = () => { | ||
return ( | ||
<div className="m-4"> | ||
<UpcomingElections /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters