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

initial changes to support controls over knobs in storybook (#18502)

* initial changes to support controls over knobs in storybook

* fix linting issue
This commit is contained in:
dswilson4 2023-04-10 01:07:07 -07:00 committed by GitHub
parent f31596af24
commit 826ac55c32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
import React from 'react';
import { Provider } from 'react-redux';
import { object } from '@storybook/addon-knobs';
import { panel, text, heading, divider, copyable } from '@metamask/snaps-ui';
import configureStore from '../../../../store/store';
import testData from '../../../../../.storybook/test-data';
@ -10,8 +9,13 @@ const store = configureStore(testData);
export default {
title: 'Components/App/SnapUIRenderer',
component: SnapUIRenderer,
decorators: [(story) => <Provider store={store}>{story()}</Provider>],
argTypes: {
data: {
control: 'object',
},
},
};
const DATA = panel([
@ -22,13 +26,18 @@ const DATA = panel([
copyable('Text you can copy'),
]);
export const DefaultStory = () => (
<SnapUIRenderer
snapId="local:http://localhost:8080/"
data={object('data', DATA)}
/>
export const DefaultStory = (args) => (
<SnapUIRenderer snapId="local:http://localhost:8080/" data={args.data} />
);
export const ErrorStory = () => (
<SnapUIRenderer snapId="local:http://localhost:8080/" data="foo" />
DefaultStory.args = {
data: DATA,
};
export const ErrorStory = (args) => (
<SnapUIRenderer snapId="local:http://localhost:8080/" data={args.data} />
);
ErrorStory.args = {
data: 'foo',
};