instant-articles-builder
instant-articles-builder copied to clipboard
Refactor logic to render labels for required and optional fields
Requested by @mburak in #83
We have duplicated code to generate the icons for the labels of required and optional fields. Let's refactor the code by adding constants for the characters used to display the checkmark and bullet point, and also create a helper function to generate the labels based on the value of their respective prop.
I am interested in working this issue. Can I put the helper function in the RuleUtils.js
?
Thanks for your interest to work on this, @manishbisht. RuleUtils.js
looks like a good place for a helper function; so I'd be happy to a review a pull request.
Also, you could also create a separate React component that uses the helper function. Just a thought, though...
Exactly !! Component will look much better. I was thinking about the same.
@pestevez I have added the RuleLabel
Component and can you review the PR.
Once it is approved my next task will be to create a helped function in RuleUtils.js
and then use the helper function to get the level so that the repeated code can be removed.
@pestevez I have added the component. I don't think we need the helper function now. Can you review the PR and let me know if it is still needed.