Start catalog gift button

This commit is contained in:
Bill 2021-07-17 23:47:46 -04:00
parent 9ef6750474
commit 1c2800bfe3
3 changed files with 26 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import { LocalizeText } from '../../../../../utils/LocalizeText';
import { CurrencyIcon } from '../../../../shared/currency-icon/CurrencyIcon'; import { CurrencyIcon } from '../../../../shared/currency-icon/CurrencyIcon';
import { CatalogPurchaseViewProps } from './CatalogPurchaseView.types'; import { CatalogPurchaseViewProps } from './CatalogPurchaseView.types';
import { CatalogPurchaseButtonView } from './purchase-button/CatalogPurchaseButtonView'; import { CatalogPurchaseButtonView } from './purchase-button/CatalogPurchaseButtonView';
import { CatalogPurchaseGiftButtonView } from './purchase-gift-button/CatalogPurchaseGiftButtonView';
export const CatalogPurchaseView: FC<CatalogPurchaseViewProps> = props => export const CatalogPurchaseView: FC<CatalogPurchaseViewProps> = props =>
{ {
@ -70,7 +71,7 @@ export const CatalogPurchaseView: FC<CatalogPurchaseViewProps> = props =>
</div> </div>
<div className="d-flex flex-column mt-1"> <div className="d-flex flex-column mt-1">
<CatalogPurchaseButtonView className="btn-sm w-100" offer={ offer } pageId={ pageId } extra={ extraData } quantity={ quantity } /> <CatalogPurchaseButtonView className="btn-sm w-100" offer={ offer } pageId={ pageId } extra={ extraData } quantity={ quantity } />
{ offer.giftable && <button type="button" className="btn btn-secondary btn-sm w-100 mt-1">{ LocalizeText('catalog.purchase_confirmation.gift') }</button> } { offer.giftable && <CatalogPurchaseGiftButtonView className="btn-sm w-100 mt-1" offer={ offer } pageId={ pageId } extra={ extraData } quantity={ quantity } /> }
</div> </div>
</div> </div>
); );

View File

@ -0,0 +1,12 @@
import { FC } from 'react';
import { LocalizeText } from '../../../../../../utils/LocalizeText';
import { CatalogPurchaseGiftButtonViewProps } from './CatalogPurchaseGiftButtonView.types';
export const CatalogPurchaseGiftButtonView: FC<CatalogPurchaseGiftButtonViewProps> = props =>
{
const { className = '', offer = null, pageId = -1, extra = null, quantity = 1, isPurchaseAllowed = true, beforePurchase = null } = props;
return (
<button type="button" className={ 'btn btn-secondary ' + className }>{ LocalizeText('catalog.purchase_confirmation.gift') }</button>
);
}

View File

@ -0,0 +1,12 @@
import { CatalogPageOfferData } from 'nitro-renderer';
export interface CatalogPurchaseGiftButtonViewProps
{
className?: string;
offer: CatalogPageOfferData;
pageId: number;
extra?: string;
quantity?: number;
isPurchaseAllowed?: boolean;
beforePurchase?: () => void;
}