-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make container ID as optional prop #110
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -24,7 +24,12 @@ import { TBrand } from './types'; | |||||
* | ||||||
* @see {@link https://www.mercadopago.com.ar/developers/en/docs/checkout-bricks/brand-brick/introduction Brand Brick documentation} for more information. | ||||||
*/ | ||||||
const Brand = ({ onReady = onReadyDefault, customization, locale }: TBrand) => { | ||||||
const Brand = ({ | ||||||
onReady = onReadyDefault, | ||||||
customization, | ||||||
locale, | ||||||
divId = 'brandBrick_container', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}: TBrand) => { | ||||||
useEffect(() => { | ||||||
// Brand uses a debounce to prevent unnecessary reRenders. | ||||||
let timer: ReturnType<typeof setTimeout>; | ||||||
|
@@ -37,7 +42,7 @@ const Brand = ({ onReady = onReadyDefault, customization, locale }: TBrand) => { | |||||
}, | ||||||
}, | ||||||
name: 'brand', | ||||||
divId: 'brandBrick_container', | ||||||
divId, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
controller: 'brandBrickController', | ||||||
}; | ||||||
|
||||||
|
@@ -50,7 +55,7 @@ const Brand = ({ onReady = onReadyDefault, customization, locale }: TBrand) => { | |||||
window.brandBrickController?.unmount(); | ||||||
}; | ||||||
}, [customization, onReady]); | ||||||
return <div id="brandBrick_container"></div>; | ||||||
return <div id={divId}></div>; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}; | ||||||
|
||||||
export default Brand; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,6 +18,10 @@ export type TBrand = { | |||||
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/additional-content/select-language Bricks language customization} documentation. | ||||||
*/ | ||||||
locale?: 'es-AR' | 'es-CL' | 'es-CO' | 'es-MX' | 'es-VE' | 'es-UY' | 'es-PE' | 'pt-BR' | 'en-US'; | ||||||
/** | ||||||
* Optional. Container ID where the Brick will be rendered. Default: 'walletBrick_container' | ||||||
*/ | ||||||
divId?: string; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}; | ||||||
|
||||||
export interface IBrandCustomization { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.