File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -159,13 +159,22 @@ export default function CommunityPage(): JSX.Element {
159159 const scrollToSection = ( sectionId : string ) => {
160160 const element = document . getElementById ( sectionId ) ;
161161 if ( element ) {
162- const offset = 80 ;
162+ const offset = 80 ;
163163 const top = element . offsetTop - offset ;
164164 window . scrollTo ( { top, behavior : "smooth" } ) ;
165165 setSelectedSection ( sectionId ) ;
166166 }
167167 } ;
168168
169+ const [ isMobile , setIsMobile ] = useState ( false ) ;
170+
171+ useEffect ( ( ) => {
172+ const checkMobile = ( ) => setIsMobile ( window . innerWidth < 768 ) ;
173+ checkMobile ( ) ;
174+ window . addEventListener ( 'resize' , checkMobile ) ;
175+ return ( ) => window . removeEventListener ( 'resize' , checkMobile ) ;
176+ } , [ ] ) ;
177+
169178
170179 return (
171180 < Layout
@@ -236,7 +245,10 @@ export default function CommunityPage(): JSX.Element {
236245 < motion . div
237246 key = { section . id }
238247 id = { section . id }
239- className = { `contribution-section ${ selectedSection === section . id ? 'selected' : '' } ` }
248+ className = { `contribution-section ${ ( isMobile ? activeSections . includes ( section . id ) : selectedSection === section . id )
249+ ? 'selected'
250+ : ''
251+ } `}
240252 initial = { { opacity : 0 , y : 30 } }
241253 animate = { { opacity : 1 , y : 0 } }
242254 transition = { { duration : 0.6 , delay : 0.1 * index } }
You can’t perform that action at this time.
0 commit comments