Skip to content

Commit 0fa5cb8

Browse files
committed
feat: cleanup and improve custom properties
1 parent f056445 commit 0fa5cb8

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

packages/component/src/Styles/useCustomPropertiesClassName.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ export default function useCustomPropertiesClassName() {
4848
transcriptTerminatorFontSize,
4949
transcriptVisualKeyboardIndicatorColor,
5050
transcriptVisualKeyboardIndicatorStyle,
51-
transcriptVisualKeyboardIndicatorWidth
51+
transcriptVisualKeyboardIndicatorWidth,
52+
transitionDuration
5253
} = styleOptions;
5354

54-
// eslint-disable-next-line no-magic-numbers
55-
const randomClass = `wc-${Math.ceil(random() * Number.MAX_SAFE_INTEGER).toString(36)}` as const;
55+
const randomClass =
56+
// eslint-disable-next-line no-magic-numbers
57+
`w${Math.ceil(random() * Number.MAX_SAFE_INTEGER).toString(36)}_${webchatCustomPropertiesClass.replace('webchat__', '')}` as const;
5658

5759
const contents = `
5860
.${webchatCustomPropertiesClass}.${randomClass} {
@@ -90,11 +92,10 @@ export default function useCustomPropertiesClassName() {
9092
${CustomPropertyNames.MinHeightImageBubble}: ${bubbleImageMinHeight}px;
9193
${CustomPropertyNames.PaddingRegular}: ${paddingRegular}px;
9294
${CustomPropertyNames.SizeAvatar}: ${avatarSize}px;
95+
${CustomPropertyNames.TransitionDuration}: ${transitionDuration};
9396
}
9497
`;
95-
const [style] = makeCreateStyles(contents)();
96-
97-
style.dataset.webchatInjected = 'component';
98+
const [style] = makeCreateStyles(contents)('component');
9899

99100
return [Object.freeze([style]), Object.freeze([`${webchatCustomPropertiesClass} ${randomClass}`] as const)];
100101
}, [styleOptions]);

0 commit comments

Comments
 (0)