2022-12-09 13:05:31 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import { panel, text, heading, divider, copyable } from '@metamask/snaps-ui';
|
|
|
|
import configureStore from '../../../../store/store';
|
|
|
|
import testData from '../../../../../.storybook/test-data';
|
|
|
|
import { SnapUIRenderer } from '.';
|
|
|
|
|
|
|
|
const store = configureStore(testData);
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/App/SnapUIRenderer',
|
2023-04-10 10:07:07 +02:00
|
|
|
component: SnapUIRenderer,
|
2022-12-09 13:05:31 +01:00
|
|
|
decorators: [(story) => <Provider store={store}>{story()}</Provider>],
|
2023-04-10 10:07:07 +02:00
|
|
|
argTypes: {
|
|
|
|
data: {
|
|
|
|
control: 'object',
|
|
|
|
},
|
|
|
|
},
|
2022-12-09 13:05:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const DATA = panel([
|
|
|
|
heading('Foo bar'),
|
|
|
|
text('Description'),
|
|
|
|
divider(),
|
|
|
|
text('More text'),
|
|
|
|
copyable('Text you can copy'),
|
|
|
|
]);
|
|
|
|
|
2023-04-10 10:07:07 +02:00
|
|
|
export const DefaultStory = (args) => (
|
|
|
|
<SnapUIRenderer snapId="local:http://localhost:8080/" data={args.data} />
|
2022-12-09 13:05:31 +01:00
|
|
|
);
|
|
|
|
|
2023-04-10 10:07:07 +02:00
|
|
|
DefaultStory.args = {
|
|
|
|
data: DATA,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const ErrorStory = (args) => (
|
|
|
|
<SnapUIRenderer snapId="local:http://localhost:8080/" data={args.data} />
|
2022-12-09 13:05:31 +01:00
|
|
|
);
|
2023-04-10 10:07:07 +02:00
|
|
|
|
|
|
|
ErrorStory.args = {
|
|
|
|
data: 'foo',
|
|
|
|
};
|