openedx / openedx/frontend-app-authoring
refactor: Color style classes for content library items
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17
- Forks
- 218
- Avg merge
- 9d 20h
- Merged PRs (30d)
- 20
Description
It is necessary to perform the same refactoring discussed in https://github.com/openedx/frontend-app-authoring/pull/2837#discussion_r2771580978 for COMPONENT_TYPE_STYLE_COLOR_MAP
This is really a nit, but instead of defining this mapping in code and creating a getIconBorderStyleColor helper method, it would be much better to give every icon two styles, like icon-with-border icon-with-border-${blockType}, where icon-with-border sets the default color and e.g. icon-with-border-text overrides it for text.
Then when you have an icon button like icon-with-border icon-with-border-openassessment, there wouldn't actually be any icon-with-border-openassessment class defined in the CSS, and it would just use the default color.
The reason that's better, besides being simpler, is it allows people to customize their themes better. e.g. if I add a customxblock to my instance, it would then get the icon-with-border-customxblock CSS style and I could give it a custom color in my theme. But if the JS code is mapping it to icon-with-border-default, then there's no way for me to override the color in my theme.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with COMPONENT_TYPE_STYLE_COLOR_MAP in src/generic/block-type-utils/constants.ts and review the linked discussion in pull request 2837. Trace the getIconBorderStyleColor helper and the existing icon-with-border classes, then confirm that block-specific class names remain available for theme overrides while default styling is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100