Skip to content

Commit

Permalink
docs: add stories file for API request component
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Apr 1, 2022
1 parent 0321765 commit d167de7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions website/package.json
Expand Up @@ -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"
}
Expand Down
56 changes: 56 additions & 0 deletions website/src/components/ApiRequest/ApiRequest.stories.jsx
@@ -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({});
Expand Up @@ -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}>
{`
Expand Down

0 comments on commit d167de7

Please sign in to comment.