Fix #1303: Remove color prop from Icon#1371
Fix #1303: Remove color prop from Icon#1371josemontespg wants to merge 4 commits intogoogle:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the color property and its associated inline styling from the IconComponent, along with the AnyDuringSchemaAlignment import. Feedback focuses on maintaining code cleanliness by removing extra empty lines and ensuring that tests are updated to reflect the component's API changes, in accordance with the repository's style guide.
| import {IconApi} from '@a2ui/web_core/v0_9/basic_catalog'; | ||
| import {AnyDuringSchemaAlignment} from '../types'; | ||
|
|
There was a problem hiding this comment.
This change leaves an extra empty line between the imports and the constants. It's recommended to maintain only one empty line for better readability.
Additionally, since this PR addresses #1303, please check if AnyDuringSchemaAlignment in types.ts can now be removed or if its documentation needs updating, as it specifically references this issue.
| import {IconApi} from '@a2ui/web_core/v0_9/basic_catalog'; | |
| import {AnyDuringSchemaAlignment} from '../types'; | |
| import {IconApi} from '@a2ui/web_core/v0_9/basic_catalog'; |
| export class IconComponent extends BasicCatalogComponent<typeof IconApi> { | ||
| readonly color = computed(() => (this.props() as AnyDuringSchemaAlignment)['color']?.value()); | ||
|
|
There was a problem hiding this comment.
The color property has been removed from the IconComponent, which is a significant change to the component's API. According to the repository style guide, all code changes should be accompanied by tests. Please ensure that the corresponding test files (e.g., icon.component.spec.ts) are updated to reflect this change and to verify that the component still renders correctly using CSS variables.
Additionally, avoid leaving an empty line at the beginning of a class definition.
| export class IconComponent extends BasicCatalogComponent<typeof IconApi> { | |
| readonly color = computed(() => (this.props() as AnyDuringSchemaAlignment)['color']?.value()); | |
| export class IconComponent extends BasicCatalogComponent<typeof IconApi> { |
References
- If there are code changes, code should have tests. (link)
What
Removed support for the
colorproperty in the v0.9 Angular implementation of theIconcomponent.Why
The
colorproperty was not part of the v0.9 specification, leading to inconsistency. As discussed in issue #1303, it was decided to remove it from the renderer and rely on CSS overrides (using the existing--a2ui-icon-colorvariable) rather than adding it to the spec, to avoid introducing colors into the spec.