File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import React , { useState } from 'react' ;
1+ import { useSearchParams } from 'react-router-dom ' ;
22import useScrollAnimation from '../hooks/useScrollAnimation' ;
33import { internationalTiers , localTiers , sponsorshipDeckUrl } from '../data/sponsors' ;
44
55const Sponsor = ( ) => {
66 useScrollAnimation ( ) ;
7- const [ isLocal , setIsLocal ] = useState ( false ) ;
7+ const [ searchParams , setSearchParams ] = useSearchParams ( ) ;
8+ const isLocal = searchParams . get ( 'deck' ) === 'local' ;
9+
10+ const handleToggle = ( local ) => {
11+ setSearchParams ( { deck : local ? 'local' : 'international' } , { replace : true } ) ;
12+ } ;
813 const tiers = isLocal ? localTiers : internationalTiers ;
914
1015 return (
@@ -123,7 +128,7 @@ const Sponsor = () => {
123128 border : '1px solid var(--color-border)' ,
124129 } } >
125130 < button
126- onClick = { ( ) => setIsLocal ( false ) }
131+ onClick = { ( ) => handleToggle ( false ) }
127132 style = { {
128133 padding : '0.6rem 1.5rem' ,
129134 borderRadius : '50px' ,
@@ -139,7 +144,7 @@ const Sponsor = () => {
139144 International (USD)
140145 </ button >
141146 < button
142- onClick = { ( ) => setIsLocal ( true ) }
147+ onClick = { ( ) => handleToggle ( true ) }
143148 style = { {
144149 padding : '0.6rem 1.5rem' ,
145150 borderRadius : '50px' ,
You can’t perform that action at this time.
0 commit comments