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 {
|
||||
static propTypes = {
|
||||
/**
|
||||
* The display content of transaction data
|
||||
*/
|
||||
txData: PropTypes.object.isRequired,
|
||||
/**
|
||||
* The display content of sender account
|
||||
*/
|
||||
fromAccount: PropTypes.shape({
|
||||
address: PropTypes.string.isRequired,
|
||||
balance: PropTypes.string,
|
||||
name: PropTypes.string,
|
||||
}).isRequired,
|
||||
/**
|
||||
* Check if the wallet is ledget wallet or not
|
||||
*/
|
||||
isLedgerWallet: PropTypes.bool,
|
||||
/**
|
||||
* Handler for cancel button
|
||||
*/
|
||||
cancel: PropTypes.func.isRequired,
|
||||
/**
|
||||
* Handler for sign button
|
||||
*/
|
||||
sign: PropTypes.func.isRequired,
|
||||
/**
|
||||
* Whether the hardware wallet requires a connection disables the sign button if true.
|
||||
*/
|
||||
hardwareWalletRequiresConnection: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
|
@ -1,40 +1,60 @@
|
||||
import React from 'react';
|
||||
import testData from '../../../../.storybook/test-data';
|
||||
import README from './README.mdx';
|
||||
import SignatureRequest from './signature-request.component';
|
||||
|
||||
const primaryIdentity = Object.values(testData.metamask.identities)[0];
|
||||
|
||||
const containerStyle = {
|
||||
width: '357px',
|
||||
};
|
||||
|
||||
export default {
|
||||
title: 'Components/App/SignatureRequest',
|
||||
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 = () => {
|
||||
return (
|
||||
<div style={containerStyle}>
|
||||
<SignatureRequest
|
||||
txData={{
|
||||
msgParams: {
|
||||
data: JSON.stringify({
|
||||
domain: {
|
||||
name: 'happydapp.website',
|
||||
},
|
||||
message: {
|
||||
string: 'haay wuurl',
|
||||
number: 42,
|
||||
},
|
||||
}),
|
||||
origin: 'https://happydapp.website/governance?futarchy=true',
|
||||
},
|
||||
}}
|
||||
fromAccount={primaryIdentity}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
export const DefaultStory = (args) => {
|
||||
return <SignatureRequest {...args} />;
|
||||
};
|
||||
|
||||
DefaultStory.storyName = 'Default';
|
||||
|
||||
DefaultStory.args = {
|
||||
txData: {
|
||||
msgParams: {
|
||||
data: JSON.stringify({
|
||||
domain: {
|
||||
name: 'happydapp.website',
|
||||
},
|
||||
message: {
|
||||
string: 'haay wuurl',
|
||||
number: 42,
|
||||
},
|
||||
}),
|
||||
origin: 'https://happydapp.website/governance?futarchy=true',
|
||||
},
|
||||
},
|
||||
fromAccount: primaryIdentity,
|
||||
};
|
||||
|
||||
DefaultStory.storyName = 'Default';
|
||||
|
Loading…
Reference in New Issue
Block a user