freemium-survey-components 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/.eslintrc +24 -0
  2. package/.prettierrc +10 -0
  3. package/.storybook/main.js +59 -0
  4. package/.storybook/manager.js +9 -0
  5. package/.storybook/preview.js +1 -0
  6. package/README.md +3 -0
  7. package/index.ts +3 -0
  8. package/lib/index.cjs.js +1 -0
  9. package/lib/index.esm.js +1 -0
  10. package/lib/types/index.d.ts +3 -0
  11. package/lib/types/src/components/button/index.d.ts +25 -0
  12. package/lib/types/src/components/checkbox/index.d.ts +14 -0
  13. package/lib/types/src/components/index.d.ts +6 -0
  14. package/lib/types/src/components/nps/index.d.ts +23 -0
  15. package/lib/types/src/components/progressbar/index.d.ts +8 -0
  16. package/lib/types/src/components/radio-button/index.d.ts +25 -0
  17. package/lib/types/src/components/text-input/index.d.ts +52 -0
  18. package/lib/types/src/index.d.ts +1 -0
  19. package/lib/types/src/mock.d.ts +215 -0
  20. package/lib/types/src/survey/index.d.ts +4 -0
  21. package/lib/types/src/survey/question.d.ts +3 -0
  22. package/lib/types/src/survey/widget.d.ts +4 -0
  23. package/lib/types/src/utils.d.ts +3 -0
  24. package/package.json +97 -0
  25. package/postcss.config.js +4 -0
  26. package/rollup.config.ts +32 -0
  27. package/src/components/button/button.stories.tsx +23 -0
  28. package/src/components/button/index.tsx +67 -0
  29. package/src/components/button/style.css +41 -0
  30. package/src/components/checkbox/checkbox.stories.tsx +34 -0
  31. package/src/components/checkbox/index.tsx +118 -0
  32. package/src/components/checkbox/style.css +85 -0
  33. package/src/components/index.tsx +6 -0
  34. package/src/components/nps/index.tsx +69 -0
  35. package/src/components/nps/nps.stories.tsx +34 -0
  36. package/src/components/nps/style.css +154 -0
  37. package/src/components/progressbar/index.tsx +21 -0
  38. package/src/components/progressbar/progressbar.stories.tsx +22 -0
  39. package/src/components/progressbar/style.css +14 -0
  40. package/src/components/radio-button/index.tsx +66 -0
  41. package/src/components/radio-button/radio.stories.tsx +26 -0
  42. package/src/components/radio-button/style.css +60 -0
  43. package/src/components/text-input/index.tsx +155 -0
  44. package/src/components/text-input/style.css +102 -0
  45. package/src/components/text-input/text-input.stories.tsx +84 -0
  46. package/src/index.tsx +1 -0
  47. package/src/mock.ts +363 -0
  48. package/src/survey/index.tsx +269 -0
  49. package/src/survey/question.tsx +79 -0
  50. package/src/survey/style.css +58 -0
  51. package/src/survey/survey.stories.tsx +28 -0
  52. package/src/survey/widget.css +46 -0
  53. package/src/survey/widget.tsx +17 -0
  54. package/src/theme/index.css +72 -0
  55. package/src/typings/index.d.ts +1 -0
  56. package/src/utils.tsx +12 -0
  57. package/tsconfig.json +22 -0
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import './widget.css';
3
+ declare const WidgetSurvey: ({ children }: any) => JSX.Element;
4
+ export default WidgetSurvey;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const withDefaults: <P, DP>(component: React.ComponentType<P>, defaultProps: DP) => React.ComponentType<Partial<DP> & Pick<P, Exclude<keyof P, keyof DP>>>;
3
+ export { withDefaults };
package/package.json ADDED
@@ -0,0 +1,97 @@
1
+ {
2
+ "name": "freemium-survey-components",
3
+ "version": "0.1.0",
4
+ "description": "React Survey Ui Components",
5
+ "main": "lib/index.cjs.js",
6
+ "module": "lib/index.esm.js",
7
+ "types": "lib/types",
8
+ "directories": {
9
+ "lib": "lib"
10
+ },
11
+ "scripts": {
12
+ "storybook": "start-storybook -p 6006",
13
+ "build-storybook": "build-storybook",
14
+ "lint": "eslint src --fix",
15
+ "start": "webpack-dev-server --config webpack.config.js",
16
+ "build:dev": "webpack --config webpack.config.js",
17
+ "build": "rollup -c rollup.config.ts",
18
+ "test": "echo \"Error: no test specified\" && exit 1",
19
+ "prepublishOnly": "rollup -c rollup.config.ts"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/freshdesk/freemium-survey-components.git"
24
+ },
25
+ "publishConfig": {
26
+ "registry": "https://registry.npmjs.org/"
27
+ },
28
+ "keywords": [
29
+ "Freemium survey",
30
+ "React",
31
+ "UI",
32
+ "Freshsurvey"
33
+ ],
34
+ "author": "Freshworks",
35
+ "bugs": {
36
+ "url": "https://github.com/freshdesk/freemium-survey-components/issues"
37
+ },
38
+ "homepage": "https://github.com/freshdesk/freemium-survey-components#readme",
39
+ "peerDependencies": {
40
+ "react": ">=17.0.2",
41
+ "react-dom": ">=17.0.2"
42
+ },
43
+ "devDependencies": {
44
+ "@rollup/plugin-commonjs": "13.0.0",
45
+ "@rollup/plugin-node-resolve": "8.1.0",
46
+ "@storybook/addon-actions": "~6.3.12",
47
+ "@storybook/addon-docs": "~6.3.12",
48
+ "@storybook/addon-info": "~5.3.19",
49
+ "@storybook/addon-knobs": "~6.3.0",
50
+ "@storybook/addon-links": "~6.3.0",
51
+ "@storybook/addon-postcss": "^2.0.0",
52
+ "@storybook/addons": "~6.3.12",
53
+ "@storybook/react": "~6.3.12",
54
+ "@storybook/theming": "~6.3.12",
55
+ "@types/jest": "25.1.4",
56
+ "@types/node": "13.9.0",
57
+ "@types/react": "^17.0.30",
58
+ "@types/react-dom": "^17.0.9",
59
+ "@types/react-transition-group": "^4.4.0",
60
+ "@types/storybook__addon-knobs": "5.2.1",
61
+ "@types/storybook__react": "5.2.1",
62
+ "@types/styled-components": "^5.1.0",
63
+ "@typescript-eslint/eslint-plugin": "^3.0.2",
64
+ "@typescript-eslint/parser": "^3.0.2",
65
+ "babel-loader": "8.1.0",
66
+ "clean-webpack-plugin": "^3.0.0",
67
+ "copy-webpack-plugin": "^6.0.1",
68
+ "css-loader": "^3.5.3",
69
+ "eslint": "^7.1.0",
70
+ "eslint-config-prettier": "^6.11.0",
71
+ "eslint-loader": "^4.0.2",
72
+ "eslint-plugin-prettier": "^3.1.3",
73
+ "eslint-plugin-react": "^7.20.0",
74
+ "eslint-plugin-react-hooks": "^4.0.4",
75
+ "file-loader": "^6.0.0",
76
+ "fork-ts-checker-webpack-plugin": "4.1.1",
77
+ "html-loader": "^1.1.0",
78
+ "html-webpack-plugin": "^4.3.0",
79
+ "jest": "25.2.0",
80
+ "postcss": "^8.3.11",
81
+ "postcss-preset-env": "^6.7.0",
82
+ "prettier": "^2.0.5",
83
+ "react": "^17.0.2",
84
+ "react-docgen-typescript-loader": "3.7.1",
85
+ "react-dom": "^17.0.2",
86
+ "rollup": "2.18.0",
87
+ "rollup-plugin-postcss": "^4.0.1",
88
+ "rollup-plugin-terser": "^7.0.2",
89
+ "rollup-plugin-typescript2": "0.27.1",
90
+ "ts-jest": "25.2.1",
91
+ "ts-loader": "^7.0.5",
92
+ "typescript": "^3.9.3",
93
+ "webpack": "^4.43.0",
94
+ "webpack-cli": "^3.3.11",
95
+ "webpack-dev-server": "^3.11.0"
96
+ }
97
+ }
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ // Add your installed PostCSS plugins here:
3
+ plugins: [require('postcss-preset-env')],
4
+ }
@@ -0,0 +1,32 @@
1
+ import commonjs from '@rollup/plugin-commonjs'
2
+ import resolve from '@rollup/plugin-node-resolve'
3
+ import typescript from 'rollup-plugin-typescript2'
4
+ import postcss from 'rollup-plugin-postcss'
5
+ import {terser} from 'rollup-plugin-terser'
6
+ import pkg from './package.json'
7
+
8
+ const external = (id) => /^react|react-dom/.test(id)
9
+
10
+ export default {
11
+ input: 'index.ts',
12
+ output: [
13
+ {
14
+ file: pkg.main,
15
+ format: 'cjs',
16
+ },
17
+ {
18
+ file: pkg.module,
19
+ format: 'es',
20
+ },
21
+ ],
22
+ external,
23
+ plugins: [
24
+ resolve(),
25
+ commonjs(),
26
+ typescript({
27
+ useTsconfigDeclarationDir: true,
28
+ }),
29
+ postcss(),
30
+ terser(),
31
+ ],
32
+ }
@@ -0,0 +1,23 @@
1
+ import {
2
+ // boolean,
3
+ // select,
4
+ // text,
5
+ withKnobs,
6
+ } from '@storybook/addon-knobs'
7
+ import {storiesOf} from '@storybook/react'
8
+ import React from 'react'
9
+ import {Button} from '.'
10
+
11
+ const stories = storiesOf('Button', module)
12
+ stories.addDecorator(withKnobs)
13
+ stories.addDecorator((story) => {
14
+ return <div style={{margin: '200px'}}>{story()}</div>
15
+ })
16
+
17
+ stories.add('Variants', () => (
18
+ <div style={{display: 'flex'}}>
19
+ <Button size="normal" inline type="primary">
20
+ Button
21
+ </Button>
22
+ </div>
23
+ ))
@@ -0,0 +1,67 @@
1
+ import React, {RefObject} from 'react'
2
+ import './style.css'
3
+ const Loader = () => <>...</>
4
+
5
+ export const BUTTON_SIZE_VARIANTS = {
6
+ LARGE: 'large',
7
+ MINI: 'mini',
8
+ NORMAL: 'normal',
9
+ }
10
+
11
+ export type ButtonSizeKey = 'large' | 'mini' | 'normal' | undefined
12
+ export type buttonHTMLType = 'button' | 'reset' | 'submit' | undefined
13
+ export type buttonType = 'primary' | 'secondary' | 'danger' | 'link'
14
+
15
+ interface ButtonContainerProps {
16
+ inline: boolean
17
+ size: ButtonSizeKey
18
+ ref?: RefObject<HTMLButtonElement>
19
+ _type: string
20
+ btnLoading: boolean
21
+ }
22
+
23
+ export type ButtonProps = {
24
+ type?: buttonType
25
+ htmlType?: buttonHTMLType
26
+ size?: ButtonSizeKey
27
+ inline?: boolean
28
+ disabled?: boolean
29
+ large?: boolean
30
+ className?: string
31
+ ref?: any
32
+ onClick?: any
33
+ overrideStyleClassName?: string
34
+ loading?: boolean
35
+ children: any
36
+ }
37
+
38
+ export const Button = (
39
+ props: ButtonProps & React.HTMLAttributes<HTMLButtonElement>,
40
+ ) => {
41
+ const {
42
+ inline = false,
43
+ children,
44
+ disabled,
45
+ className = '',
46
+ htmlType,
47
+ type = 'primary',
48
+ onClick,
49
+ size,
50
+ overrideStyleClassName = '',
51
+ loading = false,
52
+ ...rest
53
+ } = props
54
+ return (
55
+ <button
56
+ style={inline ? {display: 'inline-block'} : {}}
57
+ disabled={disabled}
58
+ className={`action-button ${className} ${overrideStyleClassName}`}
59
+ type={htmlType}
60
+ onClick={onClick}
61
+ // btnLoading={Boolean(loading)}
62
+ {...rest}
63
+ >
64
+ {loading ? <Loader /> : children}
65
+ </button>
66
+ )
67
+ }
@@ -0,0 +1,41 @@
1
+ .action-button {
2
+ width: auto;
3
+ display: block;
4
+ margin: 0;
5
+ padding: 8px 16px;
6
+ cursor: pointer;
7
+ line-height: 1.5;
8
+ text-align: center;
9
+ font-weight: 500;
10
+ letter-spacing: 0.3px;
11
+ border-radius: 4px;
12
+ white-space: nowrap;
13
+ user-select: none;
14
+ color: #fff;
15
+ background: var(--primary-button-color);
16
+ border: 1px solid var(--primary-button-color);
17
+ border-radius: 4px;
18
+ min-width: 200px;
19
+ }
20
+ @media (max-width: 550px) {
21
+ .action-button {
22
+ min-width: 120px;
23
+ }
24
+ }
25
+
26
+ .action-button:not([disabled]):hover {
27
+ background: var(--primary-button-hover-color);
28
+ /* background-color: ${hover}; */
29
+ }
30
+
31
+ .action-button:not([disabled]):active {
32
+ }
33
+
34
+ .action-button[disabled] {
35
+ cursor: not-allowed;
36
+ }
37
+
38
+ button:focus:not(:active) {
39
+ border: 1px solid transparent;
40
+ /* box-shadow: 0 0 0 2px ${pseudo.focus}; */
41
+ }
@@ -0,0 +1,34 @@
1
+ import {withKnobs} from '@storybook/addon-knobs'
2
+ import {storiesOf} from '@storybook/react'
3
+ import React from 'react'
4
+ import {Checkbox, CheckboxGroup} from './'
5
+ import {useState} from '@storybook/addons'
6
+
7
+ const stories = storiesOf('Checkbox', module)
8
+ stories.addDecorator(withKnobs)
9
+ stories.addDecorator((story) => {
10
+ return <div style={{margin: '50px'}}>{story()}</div>
11
+ })
12
+
13
+ stories.add('Basic', () => {
14
+ const [checked, setChecked] = useState(['checkA'])
15
+ return (
16
+ <div>
17
+ <div className="question-container">
18
+ <div className="question">
19
+ Thank you for your score!. We would like to do better. How can we
20
+ improve your experience?
21
+ </div>
22
+
23
+ <CheckboxGroup
24
+ values={checked}
25
+ onChangeHandler={(values) => setChecked(values)}
26
+ options={[
27
+ {id: 'checkA', label: 'Option A'},
28
+ {id: 'checkB', label: 'Option B'},
29
+ ]}
30
+ />
31
+ </div>
32
+ </div>
33
+ )
34
+ })
@@ -0,0 +1,118 @@
1
+ import React, {forwardRef} from 'react'
2
+ import {withDefaults} from '../../utils'
3
+
4
+ import './style.css'
5
+
6
+ interface CheckboxProps {
7
+ checked: boolean
8
+ disabled?: boolean
9
+ readOnly?: boolean
10
+ children: string
11
+ name: string
12
+ value?: string | number
13
+ onChange: (
14
+ event:
15
+ | React.ChangeEvent<HTMLInputElement>
16
+ | React.KeyboardEvent<HTMLInputElement>,
17
+ checked: boolean,
18
+ ) => void
19
+ id?: string
20
+ autoFocus?: boolean
21
+ }
22
+ const defaultProps = {
23
+ checked: false,
24
+ }
25
+ const TickIcon = () => (
26
+ <svg
27
+ id="tick"
28
+ className="tick-icon"
29
+ xmlns="http://www.w3.org/2000/svg"
30
+ aria-labelledby="title"
31
+ viewBox="0 0 10 10"
32
+ >
33
+ <path
34
+ d="M3 5.87c-.18666814.00267463-.36667109-.06932655-.5-.2L.21 3.41c-.1786328-.17863279-.24839684-.43899577-.1830127-.6830127.06538414-.24401694.25598306-.43461586.5-.5C.77100423 2.16160316 1.0313672 2.23136721 1.21 2.41L3 4.18 6.8.33c.27679776-.27455556.72320224-.27455556 1 0 .13696438.13025306.21450026.31098915.21450026.5S7.93696438 1.19974694 7.8 1.33L3.45 5.67c-.12082534.11896945-.28072735.19003701-.45.2Z"
35
+ fill="#fff"
36
+ fillRule="evenodd"
37
+ />
38
+ </svg>
39
+ )
40
+ type Option = {
41
+ id: string
42
+ name?: string
43
+ label: string
44
+ }
45
+ interface CheckboxGroupInterface {
46
+ options: Array<Option>
47
+ values: string[]
48
+ onChangeHandler: (newValues: string[]) => void
49
+ }
50
+ const CheckboxGroup = ({
51
+ values,
52
+ options,
53
+ onChangeHandler,
54
+ }: CheckboxGroupInterface) => {
55
+ return (
56
+ <div className="checkbox-group">
57
+ {options.map((option, index) => (
58
+ <Checkbox
59
+ key={option.id}
60
+ checked={values?.includes(option.id)}
61
+ name={option.name ?? option.id}
62
+ id={option.id}
63
+ autoFocus={index === 0}
64
+ onChange={(event: any, checked: boolean) => {
65
+ // if this is present already, remove the value from the array
66
+ // else, add the value to the array
67
+ if (checked) {
68
+ onChangeHandler([...(values || []), option.id])
69
+ } else {
70
+ const index = values.indexOf(option.id)
71
+ if (index > -1) {
72
+ values.splice(index, 1)
73
+ }
74
+ onChangeHandler([...values])
75
+ }
76
+ }}
77
+ >
78
+ {option.label}
79
+ </Checkbox>
80
+ ))}
81
+ </div>
82
+ )
83
+ }
84
+ const CheckboxComponent = forwardRef(
85
+ (props: CheckboxProps, ref?: React.Ref<HTMLInputElement>) => {
86
+ return (
87
+ <label className={`checkbox-label ${props.disabled && 'disabled'}`}>
88
+ <input
89
+ ref={ref}
90
+ id={props.id}
91
+ type="checkbox"
92
+ name={props.name}
93
+ readOnly={props.readOnly}
94
+ disabled={props.disabled}
95
+ aria-disabled={props.disabled}
96
+ value={props.value}
97
+ checked={props.checked}
98
+ autoFocus={props.autoFocus}
99
+ onChange={
100
+ props.readOnly
101
+ ? () => undefined
102
+ : (e) => props.onChange(e, e.target.checked)
103
+ }
104
+ />
105
+ <div className="checkbox">
106
+ {props.checked && (
107
+ <div className="icon-container">
108
+ <TickIcon />{' '}
109
+ </div>
110
+ )}
111
+ </div>
112
+ <div>{props.children}</div>
113
+ </label>
114
+ )
115
+ },
116
+ )
117
+ const Checkbox = withDefaults(CheckboxComponent, defaultProps)
118
+ export {CheckboxGroup}
@@ -0,0 +1,85 @@
1
+ .checkbox-group {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 12px;
5
+ flex-direction: column;
6
+ white-space: nowrap;
7
+ flex-wrap: wrap;
8
+ }
9
+ .icon-container {
10
+ display: inline-block;
11
+ flex: 0 0 12px;
12
+ width: 12px;
13
+ height: 12px;
14
+ min-width: 12px;
15
+ min-height: 12px;
16
+ color: inherit;
17
+ position: absolute;
18
+ left: 1px;
19
+ top: 2px;
20
+ }
21
+ .tick-icon {
22
+ position: absolute;
23
+ top: 0;
24
+ right: 0;
25
+ bottom: 0;
26
+ left: 0;
27
+ height: 100%;
28
+ width: 100%;
29
+ color: inherit;
30
+ fill: currentColor;
31
+ }
32
+ input[type='checkbox'] {
33
+ clip: rect(0px 0px 0px 0px);
34
+ width: 0px;
35
+ height: 0px;
36
+ }
37
+ input[type='checkbox']:focus ~ .checkbox {
38
+ /* box-shadow: ${pseudo.focus} 0px 0px 0px 2px; */
39
+ box-shadow: var(--input-highlight-color) 0px 0px 0px 2px;
40
+ border-color: transparent;
41
+ }
42
+ .checkbox-label {
43
+ display: flex;
44
+ align-items: center;
45
+ user-select: none;
46
+ opacity: 1;
47
+ cursor: pointer;
48
+ font-size: 1rem;
49
+ font-weight: 500;
50
+ padding: 16px;
51
+ min-width: 200px;
52
+ border: 1px solid #ebeff3;
53
+ box-shadow: 0px 2px 5px rgb(18 52 77 / 10%);
54
+ border-radius: 4px;
55
+ }
56
+ .checkbox-label.disabled {
57
+ opacity: 0.5;
58
+ cursor: 'not-allowed';
59
+ }
60
+ .checkbox {
61
+ transition: background-color ease-in 0.2s;
62
+ min-width: 14px;
63
+ min-height: 14px;
64
+ border-radius: 2px;
65
+ position: relative;
66
+ margin-right: 10px;
67
+ background-color: #fff;
68
+ border: 1px solid;
69
+ border-color: var(--input-highlight-color);
70
+ }
71
+ .checkbox:hover {
72
+ border-color: var(--input-highlight-color);
73
+ box-shadow: var(--focus-box-shadow-color) 0px 0px 0px 5px;
74
+ }
75
+ input[type='checkbox']:checked ~ .checkbox {
76
+ background-color: var(--input-highlight-color);
77
+ border-color: var(--input-highlight-color);
78
+ }
79
+ input[type='checkbox']:checked ~ .checkbox:hover {
80
+ border-color: var(--input-highlight-color);
81
+ }
82
+ input[type='checkbox']:disabled ~ .checkbox:hover {
83
+ box-shadow: unset;
84
+ border-color: unset;
85
+ }
@@ -0,0 +1,6 @@
1
+ export * from './nps'
2
+ export * from './text-input'
3
+ export * from './checkbox'
4
+ export * from './radio-button'
5
+ export * from './progressbar'
6
+ export * from './button'
@@ -0,0 +1,69 @@
1
+ import React, {useRef} from 'react'
2
+ import './style.css'
3
+
4
+ export type ButtonShapeType = 'rounded' | 'square' | 'curved'
5
+
6
+ type NPSProps = {
7
+ type_info: {
8
+ linear_scale: {
9
+ button_shape: ButtonShapeType
10
+ button_style: any
11
+ }
12
+ validation: {
13
+ min: number
14
+ }
15
+ score_presets: {start: string; end: string}
16
+ footer_text: string
17
+ }
18
+ onChangeHandler: (value: number) => void
19
+ npsValue: number
20
+ }
21
+
22
+ const NPS = (props: NPSProps) => {
23
+ const {
24
+ type_info: {
25
+ linear_scale: {button_shape, button_style},
26
+ score_presets: {start, end},
27
+ validation: {min},
28
+ footer_text,
29
+ },
30
+ } = props
31
+ const getClassName = (value) => {
32
+ switch (value) {
33
+ case value < 4:
34
+ return 'detractor'
35
+ case value < 7:
36
+ return 'passive'
37
+ default:
38
+ return 'promoter'
39
+ }
40
+ }
41
+ const values = useRef(Array.from({length: 10}, (_, i) => i + min))
42
+ return (
43
+ <div className="container">
44
+ <div className={`widget ${button_shape} ${button_style}`}>
45
+ <div className="button-container">
46
+ <span className="negative-text">{start}</span>
47
+ <div className="choices">
48
+ {values.current.map((eachValue) => (
49
+ <button
50
+ onClick={(e) => {
51
+ props.onChangeHandler(eachValue)
52
+ }}
53
+ className={`choice ${getClassName(eachValue)} ${
54
+ props.npsValue === eachValue && 'active'
55
+ }`}
56
+ >
57
+ {eachValue}
58
+ </button>
59
+ ))}
60
+ </div>
61
+ <span className="positive-text">{end}</span>
62
+ </div>
63
+ </div>
64
+ <div className="footer">{footer_text}</div>
65
+ </div>
66
+ )
67
+ }
68
+
69
+ export {NPS}
@@ -0,0 +1,34 @@
1
+ import {
2
+ // boolean,
3
+ // select,
4
+ // text,
5
+ withKnobs,
6
+ } from '@storybook/addon-knobs'
7
+ import {storiesOf} from '@storybook/react'
8
+ import React from 'react'
9
+ import {NPSContainer} from '.'
10
+
11
+ const stories = storiesOf('Nps', module)
12
+ stories.addDecorator(withKnobs)
13
+ stories.addDecorator((story) => {
14
+ return <div style={{margin: '50px'}}>{story()}</div>
15
+ })
16
+
17
+ stories.add('Desktop', () => (
18
+ <NPSContainer
19
+ onChangeHandler={(value) => {
20
+ console.log(value)
21
+ }}
22
+ values={{buttonShape: 'rounded'}}
23
+ />
24
+ ))
25
+ stories.add('Mobile', () => (
26
+ <div style={{width: '420px', border: '1px solid', margin: '0 auto'}}>
27
+ <NPSContainer
28
+ onChangeHandler={(value) => {
29
+ console.log(value)
30
+ }}
31
+ values={{buttonShape: 'rounded'}}
32
+ />
33
+ </div>
34
+ ))