refactor: fix update class bindings in HTML templates#35155
refactor: fix update class bindings in HTML templates#35155
Conversation
|
Claude finished @nicobytes's task in 1m 11s —— View job PR Review
One real issue, one observation worth flagging: 1. Silent class change in The original binding was: [ngClass]="{ 'border-b border-(--gray-300)': topBarHasMessages }"The PR replaces it with: [class.border-b]="topBarHasMessages"
[class.border-gray-300]="topBarHasMessages"
2. The element now has Everything else looks correct. The |
…w component template
… 32713-classes-migration
There was a problem hiding this comment.
Pull request overview
This PR refactors a set of Angular component templates to stop using NgClass and instead rely on Angular class bindings ([class] / [class.some-class]) for conditional styling, reducing directive imports and making template class logic more explicit.
Changes:
- Replaced
[ngClass]usages in selected templates with explicit class bindings. - Removed
NgClassfrom standalone componentimportsarrays where it’s no longer used. - Split combined conditional class strings into multiple conditional class bindings for readability.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| core-web/libs/edit-content/src/lib/components/dot-edit-content-layout/dot-edit-content.layout.component.ts | Removes NgClass import from standalone component imports. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-layout/dot-edit-content.layout.component.html | Replaces [ngClass] on the top bar with class bindings (one binding needs adjustment). |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-compare/dot-edit-content-compare.component.ts | Removes NgClass from standalone component imports. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-compare/dot-edit-content-compare.component.html | Replaces [ngClass] with multiple [class.*] bindings for sidebar toggle transitions. |
| core-web/apps/dotcms-ui/src/app/view/components/_common/dot-action-button/dot-action-button.component.ts | Removes NgClass from standalone component imports. |
| core-web/apps/dotcms-ui/src/app/view/components/_common/dot-action-button/dot-action-button.component.html | Replaces [ngClass] with [class.*] bindings for disabled label styling. |
| core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/fields/content-type-fields-add-row/content-type-fields-add-row.component.html | Splits a combined conditional class entry into separate conditional class entries within [class] map. |
This pull request refactors several Angular components to remove the use of the
NgClassdirective in favor of using Angular's built-in[class]and[class.class-name]bindings for conditional styling. This change simplifies the codebase, reduces unnecessary imports, and improves readability and maintainability.Refactoring and code simplification:
[ngClass]with explicit[class]and[class.class-name]bindings in component templates, making conditional class application clearer and more idiomatic. [1] [2] [3] [4]NgClassimports from component TypeScript files and theirimportsarrays, as it is no longer needed after the template changes. [1] [2] [3] [4] [5] [6]Related: #32713