From 367a4a85a4292319cd202105ba598cfa3d244cfb Mon Sep 17 00:00:00 2001 From: Surdu Date: Tue, 2 Jun 2020 03:45:58 +0300 Subject: [PATCH 1/2] Started using knobs --- src/components/button/button.stories.js | 59 +++++++------------------ 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/src/components/button/button.stories.js b/src/components/button/button.stories.js index 0560a84..588e56f 100644 --- a/src/components/button/button.stories.js +++ b/src/components/button/button.stories.js @@ -1,56 +1,31 @@ import React from "react"; import { Button } from "./button"; +import { withKnobs, text, boolean, select } from "@storybook/addon-knobs"; -export default { title: "Button" }; +export default { + title: "Button", + decorators: [withKnobs] +}; function sayMyName() { alert("Hello Friend"); } -export const primary = () => { - return ( - - ); -}; - -export const inverted = () => { - return ( - - ); -}; - -export const disabled = () => { - return ( - - ); -}; - -export const disabledAndInverted = () => { - return ( - - ); +const typeOptions = { + Primary: "primary", + Danger: "danger", + Warning: "warning" }; -export const danger = () => { - return ( - - ); -}; - -export const warning = () => { +export const primary = () => { return ( - ); }; From c4ff77b29b33586c26915b0b8b42ca89f84cd3b9 Mon Sep 17 00:00:00 2001 From: Surdu Date: Fri, 9 Oct 2020 00:04:12 +0300 Subject: [PATCH 2/2] Added knobs for all components that needed them --- src/components/banner/banner.stories.js | 29 ++--- src/components/button/button.stories.js | 14 +-- .../data-table-item.stories.js | 37 +++--- .../developed-by/developed-by.stories.js | 34 +++-- .../dropdown-search.stories.js | 54 ++------ src/components/header/header.stories.js | 22 ++-- src/components/hero/hero.stories.js | 33 ++--- .../incubated-by/incubated-by.stories.js | 38 ++++-- src/components/input/input.stories.js | 117 +++++++++--------- src/components/label/label.stories.js | 14 ++- src/components/list-item/list-item.stories.js | 35 ++---- .../search-input/search-input.stories.js | 35 ++---- 12 files changed, 205 insertions(+), 257 deletions(-) diff --git a/src/components/banner/banner.stories.js b/src/components/banner/banner.stories.js index 23ec1f0..babaeb5 100644 --- a/src/components/banner/banner.stories.js +++ b/src/components/banner/banner.stories.js @@ -1,26 +1,23 @@ import React from "react"; import { Banner } from "./banner"; +import { withKnobs, select } from "@storybook/addon-knobs"; -export default { title: "Banner" }; -export const defaultColor = () => ( - -); +export default { + title: "Banner", + decorators: [withKnobs] +}; + +const colorOptions = { + Default: null, + Yellow: "yellow", + Green: "green" +}; -export const green = () => ( - -); -export const yellow = () => ( +export const banner = () => ( diff --git a/src/components/button/button.stories.js b/src/components/button/button.stories.js index 588e56f..2306d6e 100644 --- a/src/components/button/button.stories.js +++ b/src/components/button/button.stories.js @@ -11,18 +11,18 @@ function sayMyName() { alert("Hello Friend"); } -const typeOptions = { - Primary: "primary", - Danger: "danger", - Warning: "warning" -}; +const colorOptions = [ + "primary", + "danger", + "warning" +]; -export const primary = () => { +export const button = () => { return (