1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00

docs: add stories file for API request component

This commit is contained in:
Thomas Heartman 2022-04-01 13:48:26 +02:00
parent 032176576b
commit d167de76d8
3 changed files with 58 additions and 1 deletions

View File

@ -63,6 +63,7 @@
"@tsconfig/docusaurus": "^1.0.4",
"babel-loader": "^8.2.3",
"enhanced-resolve": "^5.9.2",
"react-router": "^6.3.0",
"storybook-addon-root-attribute": "^1.0.2",
"typescript": "^4.6.2"
}

View File

@ -0,0 +1,56 @@
import React from 'react';
import Component from './index';
import Layout from '@theme/Layout';
import { BrowserRouter } from 'react-router-dom';
export default {
title: 'API request component',
component: Component,
};
const Template = (args) => (
<BrowserRouter>
<Layout>
<Component {...args} />
</Layout>
</BrowserRouter>
);
export const Step1 = Template.bind({});
Step1.args = {
open: true,
seedData: {
currentStep: 1,
},
};
export const Step2 = Template.bind({});
Step2.args = {
seedData: {
currentStep: 2,
},
open: true,
};
export const Step3 = Template.bind({});
Step3.args = {
seedData: {
currentStep: 3,
},
open: true,
};
export const Step4 = Template.bind({});
Step4.args = {
seedData: {
currentStep: 4,
},
open: true,
};
export const WithLocalStorage = Template.bind({});
WithLocalStorage.args = {
open: true,
};
export const Closed = Template.bind({});

View File

@ -22,7 +22,7 @@ const Component = ({ verb, payload, url, title }) => {
const prettyPayload = JSON.stringify(payload, null, indentation);
return (
<Tabs groupId="api-request">
<Tabs>
<TabItem value="http" label="HTTP">
<CodeBlock language="http" title={title}>
{`