Skip to content

Fix styled component inconsistent naming and missing component definition#246

Merged
bernaferrari merged 10 commits intobernaferrari:mainfrom
team-monolith-product:fix/styled-component-name
Jan 3, 2026
Merged

Fix styled component inconsistent naming and missing component definition#246
bernaferrari merged 10 commits intobernaferrari:mainfrom
team-monolith-product:fix/styled-component-name

Conversation

@a3626a
Copy link
Contributor

@a3626a a3626a commented Jan 3, 2026

Issues Found

Problem 1 : Inconsistent Naming

image

Expected: Styled Component must be defined and referenced with same name.
Actual: Styled Component is defined as StyledDescriptionspan but referenced as StyledDescription

Problem 2 : Missing Text Wrapper Definition

image

Expected: Wrapper component for text is defined properly.
Actual: Wrapper component for text is not defined at all.

Changes

[Major] Save component name in cssCollection for better consistency

  • component name is now saved in cssCollection
  • nodeName is not used any more, so removed.
    • nodeName was only used to calculate component name.
  • component name is calculated inside html builders, along with other css collection values.

[Major] Always render both wrapper and segment component for htmlText

  • Author's decision is required :
    • Choice 1) Always render both wrapper and segment component
    • Choice 2) Merge wrapper and segment component when there's only 1 segment.
    • I choose 1) just because it is easy to implement.

[Minor] Change getComponentName

  • Change paraemeter type to match changes of callers

Testing

Problem 1

Now it is consistent. (+ New wrapper component is added)

image

Problem 2

Wrapper component is correctly defined

image

Some Notes

Automated tests are necessary for this project.

Intermediate representation will greatly increase maintainability. CSS Collection can be expanded into IR. IR will have classname, data attributes, styles, component names ALWAYS(not conditionally). IR will be conditaionally referenced by each render mode(html, svelte, style-component ...).

@a3626a a3626a changed the title Fix styled component inconsistent naming and missing component definition [WIP] Fix styled component inconsistent naming and missing component definition Jan 3, 2026
return `\n<${componentName}>${content}</${componentName}>`;
}
const wrapperComponentName =
cssCollection[layoutBuilder.cssClassName!]?.componentName || "div";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if mode === "styled-components", and after layoutBuilder.build(),
layoutBuilder always has cssClassName

@a3626a a3626a changed the title [WIP] Fix styled component inconsistent naming and missing component definition Fix styled component inconsistent naming and missing component definition Jan 3, 2026
@bernaferrari bernaferrari merged commit 6fcdcc3 into bernaferrari:main Jan 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants