canonical / canonical/vanilla-framework
Tiered list: Extract tiered list item blocks
- Dominant language
- HTML
- Stars
- 983
- Forks
- 216
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 3
Description
This is a minor code quality update proposal for the tiered list pattern.
This block is duplicated (appears twice) in the macro:
```jinja
{%- if number == 1 %}
{# Skip the first HR #}
{%- else %}
{%- endif %}
```
This should be extracted into an "inner" (private) macro, to avoid duplication. See [this example](https://github.com/canonical/vanilla-framework/blob/573e6d604a006259883c1995eaf5f8f98019901d/templates/_macros/vf_pricing-block.jinja#L33) of how we declare inner macros for this kind of use case.
[This block](https://github.com/canonical/vanilla-framework/blob/3b382533f474804c699c008b2db3c248a6714287/templates/_macros/vf_tiered-list.jinja#L85-L89) is also mostly duplicated by [this block](https://github.com/canonical/vanilla-framework/blob/3b382533f474804c699c008b2db3c248a6714287/templates/_macros/vf_tiered-list.jinja#L101-L109) - the only difference is column classes. This is another good candidate for an inner macro.
First noticed [here](https://github.com/canonical/vanilla-framework/pull/5529#discussion_r2113934623)
Contributor guide
Assessment
This issue has not been assessed yet.