import React from 'react' ; import { storiesOf } from '@storybook/react' ; import { boolean , object } from '@storybook/addon-knobs' ; import { Price } from '../Price' ; import Decimal from 'decimal.js' ; import { CurrencyValue } from '@brandingbrand/fscommerce/dist/Commerce/CommerceTypes' ; type SerializedPrice = Omit < CurrencyValue , 'value' > & { value : string ; } ; const convertToCurrency = ( priceToConvert ) => ( { ... priceToConvert , value : new Decimal ( priceToConvert . value ) } ) ; const price = { value : '100.00' , currencyCode : 'USD' } ; const originalPrice = { value : '200.00' , currencyCode : 'USD' } ; storiesOf ( 'Price' , module ) . add ( 'basic usage' , ( ) => ( < Price price = { convertToCurrency ( object ( 'Price' , price ) ) } originalPrice = { convertToCurrency ( object ( 'Original Price' , originalPrice ) ) } originalPriceFirst = { boolean ( 'Show Original Price First' , false ) } priceStyle = { object ( 'Price Style' , undefined ) } originalPriceStyle = { object ( 'Original Price Style' , undefined ) } salePriceStyle = { object ( 'Sale Price Style' , undefined ) } / > ) ) ;