Web: Components: added story for RequestLoader

This commit is contained in:
Artem Tarasov 2021-03-10 11:19:30 +03:00
parent 43dc4ec3a4
commit 7bd692d239
3 changed files with 43 additions and 28 deletions

View File

@ -38,6 +38,7 @@ module.exports = {
"../progress-bar/*.stories.@(js|mdx)", "../progress-bar/*.stories.@(js|mdx)",
"../radio-button/*.stories.@(js|mdx)", "../radio-button/*.stories.@(js|mdx)",
"../radio-button-group/*.stories.@(js|mdx)", "../radio-button-group/*.stories.@(js|mdx)",
"../request-loader/*.stories.@(js|mdx)",
], ],
addons: [ addons: [
"@storybook/addon-links", "@storybook/addon-links",

View File

@ -24,15 +24,25 @@ const RequestLoader = (props) => {
}; };
RequestLoader.propTypes = { RequestLoader.propTypes = {
/** Visibility */
visible: PropTypes.bool, visible: PropTypes.bool,
/** CSS z-index */
zIndex: PropTypes.number, zIndex: PropTypes.number,
/** Svg height and width value */
loaderSize: PropTypes.string, loaderSize: PropTypes.string,
/** Svg color */
loaderColor: PropTypes.string, loaderColor: PropTypes.string,
/** Svg aria-label and text label */
label: PropTypes.string, label: PropTypes.string,
/** Text label font size */
fontSize: PropTypes.string, fontSize: PropTypes.string,
/** Text label font color */
fontColor: PropTypes.string, fontColor: PropTypes.string,
/** Accepts class */
className: PropTypes.string, className: PropTypes.string,
/** Accepts id */
id: PropTypes.string, id: PropTypes.string,
/** Accepts css style */
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
}; };

View File

@ -1,30 +1,34 @@
import React from "react"; import React from "react";
import { storiesOf } from "@storybook/react"; import RequestLoader from "./";
import {
withKnobs,
boolean,
number,
text,
color,
} from "@storybook/addon-knobs/react";
import withReadme from "storybook-readme/with-readme";
import Readme from "./README.md";
import RequestLoader from ".";
import Section from "../../../.storybook/decorators/section";
storiesOf("Components|Loaders", module) export default {
.addDecorator(withKnobs) title: "Components/Loaders",
.addDecorator(withReadme(Readme)) component: RequestLoader,
.add("request-loader", () => ( parameters: {
<Section> docs: {
<RequestLoader description: {
visible={boolean("visible", true)} component:
zIndex={number("zIndex", 256)} "equestLoader component is used for displaying loading actions on a page",
loaderSize={text("loaderSize", "16px")} },
loaderColor={color("loaderColor", "#999")} },
label={text("label", "Loading... Please wait...")} },
fontSize={text("fontSize", "12px")} argTypes: {
fontColor={color("fontColor", "#999")} loaderColor: { control: "color" },
/> fontColor: { control: "color" },
</Section> },
)); };
const Template = (args) => {
return <RequestLoader {...args} />;
};
export const Default = Template.bind({});
Default.args = {
visible: true,
zIndex: 256,
loaderSize: "16px",
loaderColor: "#999",
label: "Loading... Please wait...",
fontSize: "12px",
fontColor: "#999",
};