@chief-editor/shape
Version:
Shape for chief editor
1 lines • 1.31 kB
JavaScript
;var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,a=arguments.length;r<a;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(r[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(t);i<a.length;i++)e.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(t,a[i])&&(r[a[i]]=t[a[i]])}return r},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});var react_1=__importDefault(require("react"));function Triangle(t){var e=t.width,r=t.height,a=t.ratio,i=void 0===a?"none":a,o=t.strokeWidth,n=void 0===o?0:o,s=t.strokeDasharray,l=__rest(t,["width","height","ratio","strokeWidth","strokeDasharray"]),h=300,_=300;return s&&(h+=n,_+=n),react_1.default.createElement("svg",{width:e,height:r,viewBox:-n/2+" "+-n/2+" "+h+" "+_,fill:"none",preserveAspectRatio:i},react_1.default.createElement("path",__assign({},l,{strokeDasharray:s,strokeWidth:n,d:"M150 0L300 300H0L150 0Z"})))}exports.Triangle=Triangle;