UNPKG

@navinc/base-react-components

Version:
65 lines (64 loc) 2.92 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const styled_components_1 = __importDefault(require("styled-components")); const react_1 = require("@storybook/react"); const copy_1 = __importDefault(require("./copy")); const theme = __importStar(require("./theme.js")); const Container = styled_components_1.default.div ` display: flex; flex-wrap: wrap; `; const Row = styled_components_1.default.div ` display: flex; width: 100%; & > ${copy_1.default} { margin-top: 8px; margin-right: 8px; } `; const ColorItem = styled_components_1.default.div ` flex: 1 1 160px; padding: 16px; & > * { text-align: center; margin: 0 auto; } `; const ColorDot = styled_components_1.default.div ` height: 32px; width: 32px; background-color: ${({ color }) => color}; border-radius: 50%; `; (0, react_1.storiesOf)('2. Misc | Theme', module).add('theme', () => ((0, jsx_runtime_1.jsx)(Container, { children: Object.entries(theme).map(([key, value]) => { if (typeof value === 'string' && (value.startsWith('#') || value.startsWith('rgba'))) return ((0, jsx_runtime_1.jsxs)(ColorItem, { children: [(0, jsx_runtime_1.jsx)(copy_1.default, Object.assign({ bold: true }, { children: key }), void 0), (0, jsx_runtime_1.jsx)(copy_1.default, Object.assign({ light: true }, { children: value }), void 0), (0, jsx_runtime_1.jsx)(ColorDot, { color: value }, void 0)] }, void 0)); else return ((0, jsx_runtime_1.jsxs)(Row, { children: [(0, jsx_runtime_1.jsx)(copy_1.default, Object.assign({ bold: true }, { children: key }), void 0), (0, jsx_runtime_1.jsx)(copy_1.default, { children: typeof value === 'function' ? 'is function, see theme.js for details.' : JSON.stringify(value) }, void 0)] }, void 0)); }) }, void 0)), { info: { disable: true }, }); //# sourceMappingURL=story.js.map