Skip to content

Commit

Permalink
Balances: improved stories && added props description
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytroshch committed Feb 2, 2022
1 parent 8ac8c5f commit 97744bb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
10 changes: 9 additions & 1 deletion packages/core/src/components/Balances/Balances.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,17 @@ Balances.propTypes = {
* A className of Balances container
*/
className: PropTypes.string,

/**
* If true, there are showing deposit and withdraw buttons
*/
showTransfer: PropTypes.bool,
/**
* Callback, invoked when user clicks on deposit button
*/
handleDepositClick: PropTypes.func,
/**
* Callback, invoked when user clicks on withdraw button
*/
handleWithdrawClick: PropTypes.func,
}

Expand Down
32 changes: 26 additions & 6 deletions packages/core/src/components/Balances/stories/Balances.stories.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
import { showTemplateStory, getDefaultMetadata } from '../../../../../storybook/.storybook/helper'
import Component, { Balances, defaultProps } from '../Balances'
/* eslint-disable react/jsx-props-no-spreading */
import React, { useState } from 'react'

import {
showTemplateStory,
getDefaultMetadata,
} from '../../../../../storybook/.storybook/helper'
import { Balances } from '../Balances'
import { data } from './Balances.stories_data'

export default getDefaultMetadata(Balances, 'Components/Balances')

const props = {
...defaultProps,
balances: data,
const Component = (props) => {
const [hideSmallBalances, setHideSmallBalances] = useState(true)

return (
<Balances
hideSmallBalances={hideSmallBalances}
setHideSmallBalances={setHideSmallBalances}
balances={data}
{...props}
/>
)
}

export const basic = showTemplateStory(Component, props)
export const basic = showTemplateStory(Component, {})

export const withTransferButtons = showTemplateStory(Component, {
showTransfer: true,
handleDepositClick: () => alert('User is going to deposit current wallet'),
handleWithdrawClick: () => alert('User is going to withdraw from current wallet'),
})

0 comments on commit 97744bb

Please sign in to comment.