UNPKG

maille

Version:

Component library for MithrilJS

55 lines (54 loc) 2.93 kB
"use strict"; // This file was built automatically via the convert-ux-wing-svg.js script (v0.0.1) // This icon was obtained from UXWing.com var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const mithril_1 = __importDefault(require("mithril")); // +standalone 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 Basket { constructor() { this.defaults = { height: "1em", width: "1em", fill: "black", }; } view(vnode) { return mithril_1.default("svg", Object.assign({}, this.genAttrs(vnode)), // tslint:disable-next-line mithril_1.default.trust('<path d="M62.717 218.873h49.123L232.054 84.202c10.69-11.965 29.197-13.016 41.162-2.339v.012c11.976 10.678 13.016 29.21 2.339 41.174l-85.525 95.824h262.102l-85.537-95.824c-10.689-11.965-9.638-30.496 2.327-41.174h.012c11.965-10.689 30.485-9.638 41.174 2.327l120.214 134.671h46.96l.639.012h44.103c9.885 0 17.976 8.079 17.976 17.965v50.67c0 9.885-8.09 17.964-17.976 17.964h-38.162L564.22 553.046c-.532 6.804-5.646 12.461-12.473 12.461H88.241c-6.827 0-11.93-5.634-12.46-12.46L56.125 305.483H17.965c-9.886 0-17.977-8.079-17.977-17.964v-50.67c0-9.886 8.09-17.965 17.977-17.965h44.114l.638-.012zm341.792 96.332h56.8v164.222h-56.8V315.205zm-110.517 0h56.788v164.222h-56.788V315.205zm-110.517 0h56.8v164.222h-56.8V315.205z"/>')); } 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 basket"; attrs.className = attrs.className ? (attrs.className + " " + additionalClasses) : additionalClasses; return attrs; } } exports.default = Basket;