File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
packages/donate-button-v4/src/components/widget
components/PaymentProcess/PaymentMethodSelect Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -187,8 +187,9 @@ export const LargePaymentMethodSelect = () => {
187187export const SmallPaymentMethodSelect = ( ) => {
188188 const methods = usePaymentMethods ( ) ;
189189 const { primaryColor} = useConfigContext ( ) ;
190+ const { showMorePaymentMethods, setShowMorePaymentMethods} =
191+ useWidgetContext ( ) ;
190192
191- const [ showMore , setShowMore ] = useState ( false ) ;
192193 if ( methods . length === 1 ) {
193194 return null ;
194195 }
@@ -200,19 +201,19 @@ export const SmallPaymentMethodSelect = () => {
200201 { methods . slice ( 0 , 4 ) . map ( ( method ) => (
201202 < PaymentMethodListItem key = { method } small method = { method } />
202203 ) ) }
203- { showMore &&
204+ { showMorePaymentMethods &&
204205 methods
205206 . slice ( 4 )
206207 . map ( ( method ) => (
207208 < PaymentMethodListItem key = { method } small method = { method } />
208209 ) ) }
209210 </ ul >
210- { ! showMore && (
211+ { ! showMorePaymentMethods && (
211212 < button
212213 type = "button"
213214 className = { showMoreButtonCss ( primaryColor ) }
214215 onClick = { ( ) => {
215- setShowMore ( true ) ;
216+ setShowMorePaymentMethods ( true ) ;
216217 } }
217218 >
218219 More options
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ interface WidgetContextProps {
2222 selectedPaymentMethod : PaymentMethod ;
2323 setSelectedPaymentMethod : StateUpdater < PaymentMethod > ;
2424
25+ showMorePaymentMethods : boolean ;
26+ setShowMorePaymentMethods : StateUpdater < boolean > ;
27+
2528 stockAmount ?: number ;
2629 setStockAmount : StateUpdater < number | undefined > ;
2730
@@ -80,6 +83,9 @@ export const WidgetContextProvider: FunctionalComponent<{hide: () => void}> = ({
8083 }
8184 } , [ config . methods , selectedPaymentMethod ] ) ;
8285
86+ const [ showMorePaymentMethods , setShowMorePaymentMethods ] =
87+ useState < boolean > ( false ) ;
88+
8389 const [ stockAmount , setStockAmount ] = useState < number > ( ) ;
8490 const [ stockSymbol , setStockSymbol ] = useState < string > ( ) ;
8591
@@ -107,6 +113,8 @@ export const WidgetContextProvider: FunctionalComponent<{hide: () => void}> = ({
107113 setSubmitError,
108114 selectedPaymentMethod,
109115 setSelectedPaymentMethod,
116+ showMorePaymentMethods,
117+ setShowMorePaymentMethods,
110118 stockAmount,
111119 setStockAmount,
112120 stockSymbol,
You can’t perform that action at this time.
0 commit comments