@geist-ui/react
Version:
Modern and minimalist React UI library.
36 lines (32 loc) • 2.6 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["children", "block", "className"];
import _JSXStyle from "../styled-jsx.es.js";
import React from 'react';
import useScaleable, { withPureProps, withScaleable } from '../use-scaleable';
var defaultProps = {
block: false,
className: ''
};
var CodeComponent = function CodeComponent(_ref) {
var children = _ref.children,
block = _ref.block,
className = _ref.className,
props = _objectWithoutProperties(_ref, _excluded);
var _useScaleable = useScaleable(),
SCALES = _useScaleable.SCALES;
var otherProps = withPureProps(props);
if (!block) return /*#__PURE__*/React.createElement("code", otherProps, children);
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("pre", _extends({}, otherProps, {
className: _JSXStyle.dynamic([["1286851807", [SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(1), SCALES.pr(1.3), SCALES.pb(1), SCALES.pl(1.3), SCALES.mt(1.3), SCALES.mr(0), SCALES.mb(1.3), SCALES.ml(0)]]]) + " " + (otherProps && otherProps.className != null && otherProps.className || className || "")
}), /*#__PURE__*/React.createElement("code", {
className: _JSXStyle.dynamic([["1286851807", [SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(1), SCALES.pr(1.3), SCALES.pb(1), SCALES.pl(1.3), SCALES.mt(1.3), SCALES.mr(0), SCALES.mb(1.3), SCALES.ml(0)]]])
}, children)), /*#__PURE__*/React.createElement(_JSXStyle, {
id: "1286851807",
dynamic: [SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(1), SCALES.pr(1.3), SCALES.pb(1), SCALES.pl(1.3), SCALES.mt(1.3), SCALES.mr(0), SCALES.mb(1.3), SCALES.ml(0)]
}, "pre.__jsx-style-dynamic-selector{max-width:100%;font-size:".concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'initial'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(1), " ").concat(SCALES.pr(1.3), " ").concat(SCALES.pb(1), " ").concat(SCALES.pl(1.3), ";margin:").concat(SCALES.mt(1.3), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(1.3), " ").concat(SCALES.ml(0), ";}.dark.__jsx-style-dynamic-selector{color:white;background:black;}.dark.__jsx-style-dynamic-selector code.__jsx-style-dynamic-selector{color:white;}")));
};
CodeComponent.defaultProps = defaultProps;
CodeComponent.displayName = 'GeistCode';
var Code = withScaleable(CodeComponent);
export default Code;