maille
Version:
Component library for MithrilJS
50 lines (49 loc) • 2.5 kB
JavaScript
;
// THIS FILE WAS AUTO-GENERATED FOR PACKAGING, DO NOT MODIFY
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = require("../../../types");
// tslint:disable-next-line
const SVG_PROPS = { "xmlns": "http://www.w3.org/2000/svg", "width": "64", "height": "64", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", "fill-rule": "evenodd", "clip-rule": "evenodd", "viewBox": "0 0 640 640" };
class Medal {
constructor() {
this.defaults = {
height: "1em",
width: "1em",
fill: "black",
};
}
view(vnode) {
return m("svg", Object.assign({}, this.genAttrs(vnode)),
// tslint:disable-next-line
m.trust('<path d="M155.73 0h328.091l-.284.484L571.52 112.36 450.136 320.732c30.366 33.886 48.85 78.663 48.85 127.75C498.987 554.263 413.239 640 307.482 640c-105.77 0-191.518-85.737-191.518-191.518 0-57.13 25.04-108.415 64.713-143.494L68.47 112.36 156.204.804l-.473-.803zm193.987 261.653L479.723 6.733l-56.635 92.871H216.192l-53.551-88.217L288.383 257.91c6.283-.615 12.65-.945 19.098-.945 14.516 0 28.642 1.63 42.237 4.689zm-42.237 35.634c83.493 0 151.183 67.678 151.183 151.183 0 83.517-67.69 151.207-151.183 151.207-83.505 0-151.195-67.69-151.195-151.207 0-83.505 67.69-151.183 151.195-151.183z"/>'));
}
genAttrs(vnode) {
const overrides = Object.values(types_1.GeneralIconAttrName)
.reduce((acc, name) => {
if (!name) {
return acc;
}
if (vnode && vnode && vnode.attrs[name]) {
acc[name] = vnode.attrs[name];
return acc;
}
if (name in this.defaults) {
acc[name] = this.defaults[name];
}
return acc;
}, {});
const attrs = Object.assign({}, SVG_PROPS, overrides);
if (!("style" in attrs) || !attrs.style) {
attrs.style = {};
}
if (attrs.style && typeof attrs.style !== "object") {
throw new Error("attr.style must be an object for icons");
}
attrs.style["vertical-align"] = "middle";
attrs.style["min-width"] = "1.25em";
const additionalClasses = "maille maille-uxwing-icon medal";
attrs.className = attrs.className ? (attrs.className + " " + additionalClasses) : additionalClasses;
return attrs;
}
}
exports.default = Medal;