instant-articles-builder icon indicating copy to clipboard operation
instant-articles-builder copied to clipboard

Refactor logic to render labels for required and optional fields

Open pestevez opened this issue 6 years ago • 5 comments

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.

pestevez avatar Mar 19 '18 13:03 pestevez

I am interested in working this issue. Can I put the helper function in the RuleUtils.js ?

manishbisht avatar Apr 02 '18 15:04 manishbisht

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...

pestevez avatar Apr 02 '18 16:04 pestevez

Exactly !! Component will look much better. I was thinking about the same.

manishbisht avatar Apr 02 '18 16:04 manishbisht

@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.

manishbisht avatar Apr 07 '18 17:04 manishbisht

@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.

manishbisht avatar Apr 16 '18 17:04 manishbisht