UNPKG

@geezee/react-ui

Version:

Modern and minimalist React UI library.

30 lines (27 loc) 1.53 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; import _JSXStyle from "styled-jsx/style"; import React from 'react'; import withDefaults from '../utils/with-defaults'; var defaultProps = { block: false, className: '' }; var Code = function Code(_ref) { var children = _ref.children, block = _ref.block, className = _ref.className, width = _ref.width, props = _objectWithoutProperties(_ref, ["children", "block", "className", "width"]); if (!block) return /*#__PURE__*/React.createElement("code", props, children); return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("pre", _extends({}, props, { className: _JSXStyle.dynamic([["640909950", [width ? width : 'initial']]]) + " " + (props && props.className != null && props.className || className || "") }), /*#__PURE__*/React.createElement("code", { className: _JSXStyle.dynamic([["640909950", [width ? width : 'initial']]]) }, children)), /*#__PURE__*/React.createElement(_JSXStyle, { id: "640909950", dynamic: [width ? width : 'initial'] }, "pre.__jsx-style-dynamic-selector{width:".concat(width ? width : 'initial', ";max-width:100%;}.dark.__jsx-style-dynamic-selector{color:white;background:black;}.dark.__jsx-style-dynamic-selector code.__jsx-style-dynamic-selector{color:white;}"))); }; var MemoCode = React.memo(Code); export default withDefaults(MemoCode, defaultProps);