Skip to content

Commit 8a6378a

Browse files
feat(checkout-widgets): Make on-ramp widget header customisable (#2720)
Co-authored-by: priyaleedman <priya.leedman@gmail.com>
1 parent 6a157d0 commit 8a6378a

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

packages/checkout/sdk/src/widgets/definitions/configurations/onramp.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { WidgetConfiguration } from './widget';
66
export type OnrampWidgetConfiguration = {
77
/** Whether to show the menu in the Transak widget (default: true) */
88
showMenu?: boolean;
9+
/** The custom title to display in the widget header */
10+
customTitle?: string;
911
/** The custom subtitle to display on the exchange screen in the Transak widget (default: 'Buy') */
1012
customSubTitle?: string;
1113
} & WidgetConfiguration;

packages/checkout/widgets-lib/src/widgets/on-ramp/OnRampWidget.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export default function OnRampWidget({
141141
}
142142
showBackButton={showBackButton}
143143
showMenu={onrampConfig?.showMenu}
144+
customTitle={onrampConfig?.customTitle}
144145
customSubTitle={onrampConfig?.customSubTitle}
145146
/>
146147
)}

packages/checkout/widgets-lib/src/widgets/on-ramp/views/OnRampMain.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ interface OnRampProps {
4343
passport?: Passport;
4444
showBackButton?: boolean;
4545
showMenu?: boolean;
46+
customTitle?: string;
4647
customSubTitle?: string;
4748
}
4849
export function OnRampMain({
@@ -52,6 +53,7 @@ export function OnRampMain({
5253
tokenAddress,
5354
showBackButton,
5455
showMenu,
56+
customTitle,
5557
customSubTitle,
5658
}: OnRampProps) {
5759
const { connectLoaderState } = useContext(ConnectLoaderContext);
@@ -275,7 +277,7 @@ export function OnRampMain({
275277
<SimpleLayout
276278
header={(
277279
<HeaderNavigation
278-
title={t('views.ONRAMP.header.title')}
280+
title={customTitle ?? t('views.ONRAMP.header.title')}
279281
onCloseButtonClick={() => sendOnRampWidgetCloseEvent(eventTarget)}
280282
showBack={showBack}
281283
onBackButtonClick={() => {

packages/checkout/widgets-sample-app/src/components/ui/checkout/checkout.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,13 @@ function CheckoutUI() {
291291
TRANSFER: {
292292
customTitle: "Dromedary Transfer",
293293
},
294-
// ONRAMP: {},
294+
/*
295+
ONRAMP: {
296+
customTitle: "Dromedary On-Ramp",
297+
customSubTitle: "Camel On-Ramp",
298+
showMenu: true,
299+
},
300+
*/
295301
},
296302
});
297303
}, [widgetsFactory, browserProvider, renderAfterConnect]);

0 commit comments

Comments
 (0)