hmrc / component-library-template

Template files for HMRC's component library
1 stars 16 forks source link

Multiple markup examples #33

Open rpowis opened 7 years ago

rpowis commented 7 years ago

As raised in https://github.com/hmrc/assets-frontend/pull/691 it would be nice to have multiple options for markup examples...

Markup:
<button class="button {{modifier_class}}">Button text</button>
or
<a class="button {{modifier_class}}" role="button">Button text</a>

would be output as... image

The markup data in the template would need parsing and split on the or in order to handle this.

Open to other ideas.

feedmypixel commented 7 years ago

It looks like we would want one Markup "component" visible and 2+ markup "examples". The only issue with splitting the Markup in the template is we will also get actual markup shown as well as the examples. Unless we remove it, but that becomes awkward with multiple markup examples...

A different approach would be to add a custom property in the same way as Discussion, Example Data and Background and then show those alongside the original Markup.

rpowis commented 7 years ago

Coming around to the idea of rendering both components actually.

image

That would allow us to split on a word still, just loop through all the Markup examples to display them.

Maybe displaying the second should be optional? Probably best left for another discussion though.