react-github-fork-ribbon
Version:
Pure inline style github fork ribbon on React component
1 lines • 4.2 kB
JavaScript
!function e(t,o,r){function n(i,a){if(!o[i]){if(!t[i]){var b="function"==typeof require&&require;if(!a&&b)return b(i,!0);if(l)return l(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var d=o[i]={exports:{}};t[i][0].call(d.exports,function(e){var o=t[i][1][e];return n(o?o:e)},d,d.exports,e,t,o,r)}return o[i].exports}for(var l="function"==typeof require&&require,i=0;i<r.length;i++)n(r[i]);return n}({1:[function(e,t,o){(function(t){"use strict";function r(e,t){var o={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}Object.defineProperty(o,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},l=window.React,i=function(e){return e&&e.__esModule?e:{default:e}}(l),a=e("./ribbonStyle"),b={left:[a.RibbonStyle.leftStyle,a.RibbonStyleWrapper.leftStyle],right:[a.RibbonStyle.rightStyle,a.RibbonStyleWrapper.rightStyle],"left-bottom":[a.RibbonStyle.leftBottomStyle,a.RibbonStyleWrapper.leftBottomStyle],"right-bottom":[a.RibbonStyle.rightBottomStyle,a.RibbonStyleWrapper.rightBottomStyle]},f={red:a.RibbonStyle.redColor,orange:a.RibbonStyle.orangeColor,black:a.RibbonStyle.blackColor,green:a.RibbonStyle.greenColor},d=function(e){var t=e.position,o=void 0===t?"right":t,l=e.href,d=e.target,p=e.color,g=void 0===p?"red":p,s=e.className,y=void 0===s?"":s,u=e.children,S=r(e,["position","href","target","color","className","children"]),c=b[o]||[a.RibbonStyle.rightStyle,a.RibbonStyleWrapper.rightStyle],h=f[g]||a.RibbonStyle.redColor;c[0]===a.RibbonStyle.rightStyle&&(o="right");var m=n({},a.RibbonStyle.baseStyle,c[0],h),x=n({},a.RibbonStyleWrapper.baseStyle,c[1]);return i.default.createElement("div",n({},S,{className:"github-fork-ribbon-wrapper "+o+" "+y,style:x}),i.default.createElement("div",{className:"github-fork-ribbon",style:m},i.default.createElement("a",{href:l,target:d,style:a.RibbonStyle.urlStyle,rel:"noopener"},u)))};o.default=t.RibbonStyle=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ribbonStyle":2}],2:[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0});o.RibbonStyle={baseStyle:{position:"absolute",padding:"2px 0",backgroundColor:"#a00",backgroundImage:"linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15))",WebkitBoxShadow:"0 2px 3px 0 rgba(0, 0, 0, 0.5)",MozBoxShadow:"0 2px 3px 0 rgba(0, 0, 0, 0.5)",boxShadow:"0 2px 3px 0 rgba(0, 0, 0, 0.5)",font:'700 13px "Helvetica Neue", Helvetica, Arial, sans-serif',zIndex:"9999",pointerEvents:"auto"},urlStyle:{color:"#fff",textDecoration:"none",textShadow:"0 -1px rgba(0, 0, 0, 0.5)",textAlign:"center",width:"200px",lineHeight:"20px",display:"inline-block",padding:"2px 0",borderWidth:"1px 0",borderStyle:"dashed",borderColor:"rgba(255, 255, 255, 0.7)"},redColor:{backgroundColor:"#a00"},orangeColor:{backgroundColor:"#f80"},blackColor:{backgroundColor:"#333"},greenColor:{backgroundColor:"#090"},leftStyle:{top:"42px",left:"-43px",WebkitTransform:"rotate(-45deg)",MozTransform:"rotate(-45deg)",msTransform:"rotate(-45deg)",OTransform:"rotate(-45deg)",transform:"rotate(-45deg)"},rightStyle:{top:"42px",right:"-43px",WebkitTransform:"rotate(45deg)",MozTransform:"rotate(45deg)",msTransform:"rotate(45deg)",OTransform:"rotate(45deg)",transform:"rotate(45deg)"},leftBottomStyle:{top:"80px",left:"-43px",WebkitTransform:"rotate(45deg)",MozTransform:"rotate(45deg)",msTransform:"rotate(45deg)",OTransform:"rotate(45deg)",transform:"rotate(45deg)"},rightBottomStyle:{top:"80px",right:"-43px",WebkitTransform:"rotate(-45deg)",MozTransform:"rotate(-45deg)",msTransform:"rotate(-45deg)",OTransform:"rotate(-45deg)",transform:"rotate(-45deg)"}},o.RibbonStyleWrapper={baseStyle:{width:"150px",height:"150px",position:"absolute",overflow:"hidden",top:0,zIndex:"9999",pointerEvents:"none"},fixedStyle:{position:"fixed"},leftStyle:{left:0},rightStyle:{right:0},leftBottomStyle:{position:"fixed",top:"inherit",bottom:0,left:0},rightBottomStyle:{position:"fixed",top:"inherit",bottom:0,right:0}}},{}]},{},[1]);