1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

convert knobs and actions to controls / args (#13203)

* changed knobs

* review updates
This commit is contained in:
dragana8 2022-01-13 12:36:27 +01:00 committed by GitHub
parent d4b6e95f89
commit 76bfc399b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 35 deletions

View File

@ -1,22 +1,22 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { number, boolean } from '@storybook/addon-knobs';
import GasFeeDisplay from './gas-fee-display.component';
export default {
title: 'Pages/Send/SendContent/SendGasRow/GasFeeDisplay',
id: __filename,
argTypes: {
gasTotal: { control: 'number' },
gasLoadingError: { control: 'boolean' },
onReset: { action: 'OnReset' },
},
};
export const DefaultStory = () => {
const gasTotal = number('Gas Total', 10000000000);
return (
<GasFeeDisplay
gasTotal={gasTotal}
gasLoadingError={boolean('Gas Loading Error', false)}
onReset={action('OnReset')}
/>
);
export const DefaultStory = (args) => {
return <GasFeeDisplay {...args} />;
};
DefaultStory.storyName = 'Default';
DefaultStory.args = {
gasTotal: 10000000000,
gasLoadingError: false,
};

View File

@ -1,21 +1,24 @@
import React from 'react';
import { boolean } from '@storybook/addon-knobs';
import SendHexDataRow from './send-hex-data-row.component';
export default {
title: 'Pages/Send/SendContent/SendHexDataRow',
id: __filename,
argTypes: {
inError: { control: 'boolean' },
updateSendHexData: { action: 'updateSendHexData' },
},
};
export const DefaultStory = () => {
export const DefaultStory = (args) => {
return (
<div style={{ width: 450 }}>
<SendHexDataRow
inError={boolean('In Error', false)}
updateSendHexData={() => null}
/>
<SendHexDataRow {...args} updateSendHexData={() => null} />
</div>
);
};
DefaultStory.storyName = 'Default';
DefaultStory.args = {
inError: false,
};

View File

@ -1,30 +1,33 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { boolean } from '@storybook/addon-knobs';
import SendFooter from './send-footer.component';
export default {
title: 'Pages/Send/SendFooter',
id: __filename,
argTypes: {
clearSend: { action: 'clearSend' },
sign: { action: 'sign' },
from: { control: 'object' },
disabled: { control: 'boolean' },
mostRecentOverviewPage: { control: 'text' },
sendErrors: { control: 'object' },
history: { action: 'history' },
addToAddressBookIfNew: { action: 'addToAddressBookIfNew' },
resetSendState: { action: 'resetSendState' },
},
};
export const DefaultStory = () => {
const disabled = boolean('Disabled', false);
return (
<SendFooter
clearSend={() => action('Cancel Button Pressed')()}
sign={() => action('Next Button Pressed')()}
// The other props below are only to make the component show no error
from={{ address: '' }}
history={{ push: () => undefined }}
addToAddressBookIfNew={() => undefined}
disabled={disabled}
mostRecentOverviewPage=""
resetSendState={() => undefined}
sendErrors={{}}
/>
);
export const DefaultStory = (args) => {
return <SendFooter {...args} />;
};
DefaultStory.storyName = 'Default';
DefaultStory.args = {
from: {
address: '',
},
disabled: false,
mostRecentOverviewPage: '',
sendErrors: {},
};