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:
parent
d4b6e95f89
commit
76bfc399b6
@ -1,22 +1,22 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { action } from '@storybook/addon-actions';
|
|
||||||
import { number, boolean } from '@storybook/addon-knobs';
|
|
||||||
import GasFeeDisplay from './gas-fee-display.component';
|
import GasFeeDisplay from './gas-fee-display.component';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Pages/Send/SendContent/SendGasRow/GasFeeDisplay',
|
title: 'Pages/Send/SendContent/SendGasRow/GasFeeDisplay',
|
||||||
id: __filename,
|
id: __filename,
|
||||||
|
argTypes: {
|
||||||
|
gasTotal: { control: 'number' },
|
||||||
|
gasLoadingError: { control: 'boolean' },
|
||||||
|
onReset: { action: 'OnReset' },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DefaultStory = () => {
|
export const DefaultStory = (args) => {
|
||||||
const gasTotal = number('Gas Total', 10000000000);
|
return <GasFeeDisplay {...args} />;
|
||||||
return (
|
|
||||||
<GasFeeDisplay
|
|
||||||
gasTotal={gasTotal}
|
|
||||||
gasLoadingError={boolean('Gas Loading Error', false)}
|
|
||||||
onReset={action('OnReset')}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DefaultStory.storyName = 'Default';
|
DefaultStory.storyName = 'Default';
|
||||||
|
DefaultStory.args = {
|
||||||
|
gasTotal: 10000000000,
|
||||||
|
gasLoadingError: false,
|
||||||
|
};
|
||||||
|
@ -1,21 +1,24 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { boolean } from '@storybook/addon-knobs';
|
|
||||||
import SendHexDataRow from './send-hex-data-row.component';
|
import SendHexDataRow from './send-hex-data-row.component';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Pages/Send/SendContent/SendHexDataRow',
|
title: 'Pages/Send/SendContent/SendHexDataRow',
|
||||||
id: __filename,
|
id: __filename,
|
||||||
|
argTypes: {
|
||||||
|
inError: { control: 'boolean' },
|
||||||
|
updateSendHexData: { action: 'updateSendHexData' },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DefaultStory = () => {
|
export const DefaultStory = (args) => {
|
||||||
return (
|
return (
|
||||||
<div style={{ width: 450 }}>
|
<div style={{ width: 450 }}>
|
||||||
<SendHexDataRow
|
<SendHexDataRow {...args} updateSendHexData={() => null} />
|
||||||
inError={boolean('In Error', false)}
|
|
||||||
updateSendHexData={() => null}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
DefaultStory.storyName = 'Default';
|
DefaultStory.storyName = 'Default';
|
||||||
|
DefaultStory.args = {
|
||||||
|
inError: false,
|
||||||
|
};
|
||||||
|
@ -1,30 +1,33 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { action } from '@storybook/addon-actions';
|
|
||||||
import { boolean } from '@storybook/addon-knobs';
|
|
||||||
|
|
||||||
import SendFooter from './send-footer.component';
|
import SendFooter from './send-footer.component';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Pages/Send/SendFooter',
|
title: 'Pages/Send/SendFooter',
|
||||||
id: __filename,
|
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 = () => {
|
export const DefaultStory = (args) => {
|
||||||
const disabled = boolean('Disabled', false);
|
return <SendFooter {...args} />;
|
||||||
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={{}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DefaultStory.storyName = 'Default';
|
DefaultStory.storyName = 'Default';
|
||||||
|
DefaultStory.args = {
|
||||||
|
from: {
|
||||||
|
address: '',
|
||||||
|
},
|
||||||
|
disabled: false,
|
||||||
|
mostRecentOverviewPage: '',
|
||||||
|
sendErrors: {},
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user