From 2b7486a17775e406bcece0d694042ff4a4083efb Mon Sep 17 00:00:00 2001 From: Jaya Krishna Date: Tue, 3 Sep 2024 14:36:33 +0530 Subject: [PATCH] (fix): Append comp-name only for the attributes of type comp-style --- .../teleport-plugin-common/src/builders/style-builders.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/teleport-plugin-common/src/builders/style-builders.ts b/packages/teleport-plugin-common/src/builders/style-builders.ts index c06d98ea7..10a5233e1 100644 --- a/packages/teleport-plugin-common/src/builders/style-builders.ts +++ b/packages/teleport-plugin-common/src/builders/style-builders.ts @@ -220,7 +220,11 @@ export const setPropValueForCompStyle = (params: { if (templateStyle === 'jsx' && isJSXElement(compInstanceNode)) { compInstanceNode.openingElement?.attributes.forEach((attribute: types.JSXAttribute) => { - if (attribute.value.type === 'StringLiteral' && attribute.value?.value) { + if ( + attribute.value.type === 'StringLiteral' && + attribute.value?.value && + attribute.name.name === attr + ) { attribute.value.value = getClassName(attribute.value.value) } })