File tree Expand file tree Collapse file tree 2 files changed +43
-4
lines changed
Expand file tree Collapse file tree 2 files changed +43
-4
lines changed Original file line number Diff line number Diff line change 1+ "use client" ;
2+ import { useEffect , useState } from "react" ;
3+
4+ export default function ExecsHeader ( ) {
5+ const [ isDark , setIsDark ] = useState ( false ) ;
6+
7+ useEffect ( ( ) => {
8+ const saved = localStorage . getItem ( "darkMode" ) === "true" ;
9+ setIsDark ( saved ) ;
10+
11+ const onThemeChange = ( e : Event ) => {
12+ const { isDark } = ( e as CustomEvent ) . detail ?? { } ;
13+ if ( typeof isDark === "boolean" ) setIsDark ( isDark ) ;
14+ } ;
15+ window . addEventListener ( "themechange" , onThemeChange ) ;
16+
17+ const onStorage = ( e : StorageEvent ) => {
18+ if ( e . key === "darkMode" && e . newValue != null ) {
19+ setIsDark ( e . newValue === "true" ) ;
20+ }
21+ } ;
22+ window . addEventListener ( "storage" , onStorage ) ;
23+
24+ return ( ) => {
25+ window . removeEventListener ( "themechange" , onThemeChange ) ;
26+ window . removeEventListener ( "storage" , onStorage ) ;
27+ } ;
28+ } , [ ] ) ;
29+
30+ const textColor = isDark ? "#F4EFFF" : "#5f249f" ;
31+
32+ return (
33+ < h2
34+ className = "mt-22 text-3xl md:text-5xl font-bold font-[Montserrat] mb-3 text-center p-6"
35+ style = { { color : textColor } }
36+ >
37+ Meet the Exec Team!
38+ </ h2 >
39+ ) ;
40+ }
Original file line number Diff line number Diff line change 11import Image from "next/image" ;
22import { getPayload } from "payload" ;
33import React from "react" ;
4- import type { Media } from '../../payload-types' ; // adjust path to your generated types
4+ import type { Media } from '../../payload-types' ;
55
66import HomePageBanner from "./components/HomePageBanner" ;
77import ScrollingGallery from "./components/ScrollingGallery" ;
@@ -13,6 +13,7 @@ import SocialsBar from "./components/SocialsBar";
1313import AboutUsSection from "./components/AboutUsSection" ;
1414import SectionHeader from "./components/SectionHeader" ;
1515import SectionDivider from "./components/SectionDivider" ;
16+ import ExecsHeader from "./components/ExecsHeader" ;
1617
1718import config from "@/payload.config" ;
1819
@@ -73,9 +74,7 @@ export default async function HomePage() {
7374 < AboutUsSection aboutus = { aboutus } />
7475
7576 { /*================================MEET THE EXECS================================*/ }
76- < h2 className = "mt-22 text-3xl md:text-5xl text-[#5f249f] font-bold font-[Montserrat] mb-3 text-center p-6" >
77- Meet the Exec Team!
78- </ h2 >
77+ < ExecsHeader />
7978 < div className = "grid grid-cols-2 lg:grid-cols-3 gap-10" >
8079 { execs . docs . map ( ( exec ) => (
8180 < ExecCard
You can’t perform that action at this time.
0 commit comments