Skip to content

Commit 0349ff7

Browse files
Update core/src/utils/theme.ts
Co-authored-by: Brandy Smith <[email protected]>
1 parent ade5c05 commit 0349ff7

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

core/src/utils/theme.ts

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -376,29 +376,24 @@ export const applyGlobalTheme = (baseTheme: any, userTheme?: any): any => {
376376
* @returns string containing the component's themed CSS variables
377377
*/
378378
export const generateComponentsThemeCSS = (components: any): string => {
379-
let componentsCSS = '';
380-
if (components) {
381-
for (const [component, componentTokens] of Object.entries(components)) {
382-
const componentTag = convertToKebabCase(component);
383-
const vars = generateCSSVars(componentTokens, `--${componentTag}-`);
384-
385-
const componentBlock = `
386-
${CSS_ROOT_SELECTOR} ${componentTag} {
387-
${vars}
388-
}
389-
`;
390-
391-
// 3. Append the block to the main componentsCSS string
392-
componentsCSS += componentBlock;
393-
}
379+
let css = '';
380+
381+
for (const [component, componentTokens] of Object.entries(components)) {
382+
const componentTag = convertToKebabCase(component);
383+
const vars = generateCSSVars(componentTokens, `--${componentTag}-`);
384+
385+
const componentBlock = `
386+
${CSS_ROOT_SELECTOR} ${componentTag} {
387+
${vars}
388+
}
389+
`;
390+
391+
css += componentBlock;
394392
}
395-
console.log('componentsCSS', componentsCSS);
396-
const css = `
397-
${componentsCSS}
398-
`;
399393

400394
return css;
401395
};
396+
};
402397

403398
/**
404399
* Applies a component theme to an element if it exists in the custom theme

0 commit comments

Comments
 (0)