mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix signature-request for new Storybook format (#12755)
* signature request storybook * remove clearConfirmTransaction * fix text
This commit is contained in:
parent
08ed32dfe6
commit
363f81db11
15
ui/components/app/signature-request/README.mdx
Normal file
15
ui/components/app/signature-request/README.mdx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
|
||||||
|
|
||||||
|
import SignatureRequest from '.';
|
||||||
|
|
||||||
|
# Signature Request
|
||||||
|
|
||||||
|
dApp requesting a signature from the user.
|
||||||
|
|
||||||
|
<Canvas>
|
||||||
|
<Story id="ui-components-app-signature-request-signature-request-stories-js--default-story" />
|
||||||
|
</Canvas>
|
||||||
|
|
||||||
|
## Component API
|
||||||
|
|
||||||
|
<ArgsTable of={SignatureRequest} />
|
@ -8,15 +8,33 @@ import Message from './signature-request-message';
|
|||||||
|
|
||||||
export default class SignatureRequest extends PureComponent {
|
export default class SignatureRequest extends PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
/**
|
||||||
|
* The display content of transaction data
|
||||||
|
*/
|
||||||
txData: PropTypes.object.isRequired,
|
txData: PropTypes.object.isRequired,
|
||||||
|
/**
|
||||||
|
* The display content of sender account
|
||||||
|
*/
|
||||||
fromAccount: PropTypes.shape({
|
fromAccount: PropTypes.shape({
|
||||||
address: PropTypes.string.isRequired,
|
address: PropTypes.string.isRequired,
|
||||||
balance: PropTypes.string,
|
balance: PropTypes.string,
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
/**
|
||||||
|
* Check if the wallet is ledget wallet or not
|
||||||
|
*/
|
||||||
isLedgerWallet: PropTypes.bool,
|
isLedgerWallet: PropTypes.bool,
|
||||||
|
/**
|
||||||
|
* Handler for cancel button
|
||||||
|
*/
|
||||||
cancel: PropTypes.func.isRequired,
|
cancel: PropTypes.func.isRequired,
|
||||||
|
/**
|
||||||
|
* Handler for sign button
|
||||||
|
*/
|
||||||
sign: PropTypes.func.isRequired,
|
sign: PropTypes.func.isRequired,
|
||||||
|
/**
|
||||||
|
* Whether the hardware wallet requires a connection disables the sign button if true.
|
||||||
|
*/
|
||||||
hardwareWalletRequiresConnection: PropTypes.bool.isRequired,
|
hardwareWalletRequiresConnection: PropTypes.bool.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,40 +1,60 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import testData from '../../../../.storybook/test-data';
|
import testData from '../../../../.storybook/test-data';
|
||||||
|
import README from './README.mdx';
|
||||||
import SignatureRequest from './signature-request.component';
|
import SignatureRequest from './signature-request.component';
|
||||||
|
|
||||||
const primaryIdentity = Object.values(testData.metamask.identities)[0];
|
const primaryIdentity = Object.values(testData.metamask.identities)[0];
|
||||||
|
|
||||||
const containerStyle = {
|
|
||||||
width: '357px',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Components/App/SignatureRequest',
|
title: 'Components/App/SignatureRequest',
|
||||||
id: __filename,
|
id: __filename,
|
||||||
|
component: SignatureRequest,
|
||||||
|
parameters: {
|
||||||
|
docs: {
|
||||||
|
page: README,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
argTypes: {
|
||||||
|
txData: { control: 'object' },
|
||||||
|
fromAccount: {
|
||||||
|
table: {
|
||||||
|
address: { control: 'text' },
|
||||||
|
balance: { control: 'text' },
|
||||||
|
name: { control: 'text' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
isLedgerWallet: { control: 'boolean' },
|
||||||
|
clearConfirmTransaction: { action: 'Clean Confirm' },
|
||||||
|
cancel: { action: 'Cancel' },
|
||||||
|
sign: { action: 'Sign' },
|
||||||
|
hardwareWalletRequiresConnection: {
|
||||||
|
action: 'hardwareWalletRequiresConnection',
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DefaultStory = () => {
|
export const DefaultStory = (args) => {
|
||||||
return (
|
return <SignatureRequest {...args} />;
|
||||||
<div style={containerStyle}>
|
};
|
||||||
<SignatureRequest
|
|
||||||
txData={{
|
DefaultStory.storyName = 'Default';
|
||||||
msgParams: {
|
|
||||||
data: JSON.stringify({
|
DefaultStory.args = {
|
||||||
domain: {
|
txData: {
|
||||||
name: 'happydapp.website',
|
msgParams: {
|
||||||
},
|
data: JSON.stringify({
|
||||||
message: {
|
domain: {
|
||||||
string: 'haay wuurl',
|
name: 'happydapp.website',
|
||||||
number: 42,
|
},
|
||||||
},
|
message: {
|
||||||
}),
|
string: 'haay wuurl',
|
||||||
origin: 'https://happydapp.website/governance?futarchy=true',
|
number: 42,
|
||||||
},
|
},
|
||||||
}}
|
}),
|
||||||
fromAccount={primaryIdentity}
|
origin: 'https://happydapp.website/governance?futarchy=true',
|
||||||
/>
|
},
|
||||||
</div>
|
},
|
||||||
);
|
fromAccount: primaryIdentity,
|
||||||
};
|
};
|
||||||
|
|
||||||
DefaultStory.storyName = 'Default';
|
DefaultStory.storyName = 'Default';
|
||||||
|
Loading…
Reference in New Issue
Block a user