8889841cPK ›2[)l&ô´ ´ stories/index.stories.tsxnu „[µü¤ /**
* External dependencies
*/
import type { Story, Meta } from '@storybook/react';
import {
currenciesAPIShape,
currencies,
currencyControl,
} from '@woocommerce/storybook-controls';
/**
* Internal dependencies
*/
import Fees, { TotalsFeesProps } from '..';
export default {
title: 'External Components/Totals/Fees',
component: Fees,
argTypes: {
currency: currencyControl,
},
args: {
total: '',
cartFees: [
{
id: 'my-id',
key: 'my-id',
name: 'Storybook fee',
totals: {
...currenciesAPIShape.USD,
total: '1000',
total_tax: '200',
},
},
],
},
} as Meta< TotalsFeesProps >;
type StorybookTotalFeesProps = TotalsFeesProps & { total: string };
const Template: Story< StorybookTotalFeesProps > = ( args ) => {
return (
);
};
export const Default = Template.bind( {} );
Default.args = {
currency: currencies.USD,
total: '1000',
};
export const AlternativeCurrency = Template.bind( {} );
AlternativeCurrency.args = {
currency: currencies.EUR,
total: '1000',
};
PK ›2[_=ë4³ ³ index.tsxnu „[µü¤ /**
* External dependencies
*/
import classnames from 'classnames';
import { __ } from '@wordpress/i18n';
import { getSetting } from '@woocommerce/settings';
import type { CartFeeItem, Currency } from '@woocommerce/types';
import type { ReactElement } from 'react';
/**
* Internal dependencies
*/
import TotalsItem from '../item';
export interface TotalsFeesProps {
/**
* Currency
*/
currency: Currency;
/**
* Cart fees
*/
cartFees: CartFeeItem[];
/**
* Component wrapper classname
*
* @default 'wc-block-components-totals-fees'
*/
className?: string;
}
const TotalsFees = ( {
currency,
cartFees,
className,
}: TotalsFeesProps ): ReactElement | null => {
return (
<>
{ cartFees.map( ( { id, key, name, totals }, index ) => {
const feesValue = parseInt( totals.total, 10 );
if ( ! feesValue ) {
return null;
}
const feesTaxValue = parseInt( totals.total_tax, 10 );
return (
);
} ) }
>
);
};
export default TotalsFees;
PK ›2[)l&ô´ ´ stories/index.stories.tsxnu „[µü¤ PK ›2[_=ë4³ ³ ý index.tsxnu „[µü¤ PK ¢ é