UNPKG

sanity-plugin-seo-tools

Version:

> Upgrading from V2 to V3 is a breaking change. The `seo-tools` input has been replaced by a SEO pane which needs to be set-up using a custom desk structure as per the installation guide. Secondly, the previously automatically provided fields (focus keywo

101 lines (100 loc) 3.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "SeoRatingBubble", { enumerable: true, get: function() { return SeoRatingBubble; } }); var _react = /*#__PURE__*/ _interopRequireWildcard(require("react")); var _styledComponents = /*#__PURE__*/ _interopRequireDefault(require("styled-components")); var _ui = require("@sanity/ui"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for(var key in obj){ if (key !== "default" && 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 _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } function _templateObject() { var data = _taggedTemplateLiteral([ "\n border-radius: 9999px;\n margin-top: .4rem;\n width: .8rem;\n height: .8rem;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var StyledBubbleBox = (0, _styledComponents.default)(_ui.Box)(_templateObject()); var SeoRatingBubble = function(param) { var rating = param.rating; var color = (0, _react.useMemo)(function() { switch(rating){ case "good": return "#7ad03a"; case "ok": return "#ee7c1b"; case "bad": return "#dc3232"; default: return "#888"; } }, [ rating ]); return /*#__PURE__*/ _react.default.createElement(StyledBubbleBox, { style: { backgroundColor: color } }); }; //# sourceMappingURL=SeoRatingBubble.js.map