1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _types = require("@babel/types");
|
9 |
|
10 | const handleSpreadClassName = (path, destinationName, classNamesFromSpread) => {
|
11 | const destinationAttribute = path.node.openingElement.attributes.find(attribute => {
|
12 | return typeof attribute.name !== 'undefined' && attribute.name.name === destinationName;
|
13 | });
|
14 |
|
15 | if (!destinationAttribute) {
|
16 | return;
|
17 | }
|
18 |
|
19 | if ((0, _types.isStringLiteral)(destinationAttribute.value)) {
|
20 | destinationAttribute.value = (0, _types.jsxExpressionContainer)((0, _types.binaryExpression)('+', destinationAttribute.value, (0, _types.binaryExpression)('+', (0, _types.stringLiteral)(' '), classNamesFromSpread)));
|
21 | } else if ((0, _types.isJSXExpressionContainer)(destinationAttribute.value)) {
|
22 | destinationAttribute.value = (0, _types.jsxExpressionContainer)((0, _types.binaryExpression)('+', destinationAttribute.value.expression, (0, _types.binaryExpression)('+', (0, _types.stringLiteral)(' '), classNamesFromSpread)));
|
23 | }
|
24 | };
|
25 |
|
26 | var _default = handleSpreadClassName;
|
27 | exports.default = _default;
|
28 |
|
\ | No newline at end of file |