UNPKG

react-demo-page

Version:

Build a demo page for your react component with ease

68 lines (51 loc) 4.24 kB
"use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } exports.__esModule = true; exports["default"] = void 0; var _propTypes = _interopRequireDefault(require("prop-types")); var _react = _interopRequireDefault(require("react")); var _styledComponents = _interopRequireDefault(require("styled-components")); var variables = _interopRequireWildcard(require("../../variables.js")); var _this = void 0, _jsxFileName = "/Users/cedricdelpoux/Development/perso/react-demo-page/src/components/Html/index.js"; function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _templateObject() { var data = _taggedTemplateLiteralLoose(["\n word-wrap: break-word;\n\n &:first-child {\n margin-top: 0;\n }\n\n img {\n max-width: 100%;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-top: 2rem;\n margin-bottom: 1rem;\n font-weight: normal;\n color: ", ";\n }\n\n a {\n color: ", ";\n }\n\n p {\n margin-bottom: 1em;\n }\n\n ul,\n ol {\n margin-top: 0;\n }\n\n blockquote {\n padding: 0 1rem;\n margin-left: 0;\n border-left: 0.3rem solid ", ";\n\n > :first-child {\n margin-top: 0;\n }\n\n > :last-child {\n margin-bottom: 0;\n }\n }\n\n table {\n display: block;\n width: 100%;\n overflow: auto;\n word-break: normal;\n word-break: keep-all;\n\n th {\n font-weight: bold;\n }\n\n th,\n td {\n padding: 0.5rem 1rem;\n border: 1px solid ", ";\n }\n }\n\n dl {\n padding: 0;\n\n dt {\n padding: 0;\n margin-top: 1rem;\n font-size: 1rem;\n font-weight: bold;\n }\n\n dd {\n padding: 0;\n margin-bottom: 1rem;\n }\n }\n\n hr {\n height: 2px;\n padding: 0;\n margin: 1rem 0;\n background-color: ", ";\n border: 0;\n }\n"]); _templateObject = function _templateObject() { return data; }; return data; } function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; } var Wrapper = _styledComponents["default"].div(_templateObject(), function (_ref) { var color = _ref.color; return color; }, function (_ref2) { var color = _ref2.color; return color; }, variables.borderColor, variables.borderColor, variables.borderColor); var Html = function Html(_ref3) { var color = _ref3.color, html = _ref3.html; return /*#__PURE__*/_react["default"].createElement(Wrapper, { color: color, dangerouslySetInnerHTML: { __html: html }, __self: _this, __source: { fileName: _jsxFileName, lineNumber: 100, columnNumber: 3 } }); }; Html.propTypes = process.env.NODE_ENV !== "production" ? { color: _propTypes["default"].string.isRequired, html: _propTypes["default"].string } : {}; var _default = Html; exports["default"] = _default; module.exports = exports.default;