Skip to content

Commit 1a2d0e1

Browse files
feat(checkout-widgets): Allow hide header on On-Ramp widget (#2723)
Co-authored-by: priyaleedman <priya.leedman@gmail.com>
1 parent c0ac194 commit 1a2d0e1

5 files changed

Lines changed: 9 additions & 3 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
@@ -10,4 +10,6 @@ export type OnrampWidgetConfiguration = {
1010
customTitle?: string;
1111
/** The custom subtitle to display on the exchange screen in the Transak widget (default: 'Buy') */
1212
customSubTitle?: string;
13+
/** Whether to show the header (default: true) */
14+
showHeader?: boolean;
1315
} & 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
@@ -143,6 +143,7 @@ export default function OnRampWidget({
143143
showMenu={onrampConfig?.showMenu}
144144
customTitle={onrampConfig?.customTitle}
145145
customSubTitle={onrampConfig?.customSubTitle}
146+
showHeader={onrampConfig?.showHeader}
146147
/>
147148
)}
148149

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ interface OnRampProps {
4545
showMenu?: boolean;
4646
customTitle?: string;
4747
customSubTitle?: string;
48+
showHeader?: boolean;
4849
}
4950
export function OnRampMain({
5051
passport,
@@ -55,6 +56,7 @@ export function OnRampMain({
5556
showMenu,
5657
customTitle,
5758
customSubTitle,
59+
showHeader = true,
5860
}: OnRampProps) {
5961
const { connectLoaderState } = useContext(ConnectLoaderContext);
6062
const { checkout, provider } = connectLoaderState;
@@ -275,7 +277,7 @@ export function OnRampMain({
275277
return (
276278
<Box sx={boxMainStyle(showIframe)}>
277279
<SimpleLayout
278-
header={(
280+
header={showHeader ? (
279281
<HeaderNavigation
280282
title={customTitle ?? t('views.ONRAMP.header.title')}
281283
onCloseButtonClick={() => sendOnRampWidgetCloseEvent(eventTarget)}
@@ -288,7 +290,7 @@ export function OnRampMain({
288290
);
289291
}}
290292
/>
291-
)}
293+
) : undefined}
292294
footerBackgroundColor="base.color.translucent.emphasis.200"
293295
>
294296
<Box sx={containerStyle(showIframe)}>

packages/checkout/widgets-lib/src/widgets/on-ramp/views/onRampStyles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const containerStyle = (showIframe:boolean) => ({
22
position: 'relative',
33
maxWidth: '420px',
4-
height: '565px',
4+
height: '100%',
55
borderRadius: 'base.borderRadius.x6',
66
overflow: 'hidden',
77
marginLeft: 'base.spacing.x2',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ function CheckoutUI() {
300300
customTitle: "Dromedary On-Ramp",
301301
customSubTitle: "Camel On-Ramp",
302302
showMenu: true,
303+
showHeader: true,
303304
},
304305
*/
305306
},

0 commit comments

Comments
 (0)