1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports["default"] = linearGradient;
|
5 | var _constructGradientValue = _interopRequireDefault(require("../internalHelpers/_constructGradientValue"));
|
6 | var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
|
7 | var _templateObject;
|
8 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
9 | function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | function linearGradient(_ref) {
|
40 | var colorStops = _ref.colorStops,
|
41 | fallback = _ref.fallback,
|
42 | _ref$toDirection = _ref.toDirection,
|
43 | toDirection = _ref$toDirection === void 0 ? '' : _ref$toDirection;
|
44 | if (!colorStops || colorStops.length < 2) {
|
45 | throw new _errors["default"](56);
|
46 | }
|
47 | return {
|
48 | backgroundColor: fallback || colorStops[0].replace(/,\s+/g, ',').split(' ')[0].replace(/,(?=\S)/g, ', '),
|
49 | backgroundImage: (0, _constructGradientValue["default"])(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["linear-gradient(", "", ")"])), toDirection, colorStops.join(', ').replace(/,(?=\S)/g, ', '))
|
50 | };
|
51 | }
|
52 | module.exports = exports.default; |
\ | No newline at end of file |