vcc-ui
Version:
VCC UI is a collection of React UI Components that can be used for developing front-end applications at Volvo Car Corporation.
52 lines (50 loc) • 1.99 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import React from "react";
import { storiesOf } from "@storybook/react";
import { withBackgrounds } from "@storybook/addon-backgrounds";
import { object, withKnobs } from "@storybook/addon-knobs/react";
import { TextInput } from "../../index";
import { render } from "../../../stories/render";
import { ThemeProvider } from "../../theme-provider";
import { BREAKPOINTS } from "../../constants/breakpoints";
var listOfLightBackgrounds = [{
name: "white",
value: "#fff",
default: true
}, {
name: "gray",
value: "#ccc"
}];
var textInputProps = {
placeholder: "Search for.."
};
storiesOf("TextInput", module).addDecorator(withBackgrounds(listOfLightBackgrounds)).addDecorator(withKnobs).addDecorator(render).addWithJSX("default", function () {
return React.createElement(TextInput, textInputProps);
}).addWithJSX("with theme", function () {
var themeValue = {
textInput: {
padding: "0 10px",
color: "#000",
borderBottom: "1px solid lightgrey"
}
};
var themePropsConfig = object("", themeValue);
return React.createElement(ThemeProvider, {
theme: themePropsConfig
}, React.createElement(TextInput, textInputProps));
}).addWithJSX("with theme and media queries", function () {
var _textInput;
var themeValue = {
textInput: (_textInput = {}, _defineProperty(_textInput, BREAKPOINTS.onS, {
borderBottom: "1px solid lightgrey"
}), _defineProperty(_textInput, BREAKPOINTS.onM, {
borderBottom: "1px solid magenta"
}), _defineProperty(_textInput, BREAKPOINTS.onL, {
borderBottom: "1px solid orange"
}), _textInput)
};
var themePropsConfig = object("", themeValue);
return React.createElement(ThemeProvider, {
theme: themePropsConfig
}, React.createElement(TextInput, textInputProps));
});