moj-frontend
moj-frontend copied to clipboard
fix(banner): fix issue with classes not working if banner type provided
trafficstars
Identify the bug
Link to the issue describing the bug that you're fixing.
Description of the change
- Existing implementation appears to have an
elseandendIfblock in a place that disablesclassesiftypeis set:
// Existing implementation (spacing added for readability)
<div class=
"moj-banner
{% if params.type == 'success' %} moj-banner--success
{% elif params.type == 'warning' %} moj-banner--warning
{% else %} // This else and endIf below cause the bug
{{- ' ' + params.classes if params.classes}}
{% endif %}"
...
>
- Updated and refactored file to address this bug, and increase readability following pattern of declaring classes logic above component as per recent
button-menucommit to main
Alternative designs
- I have a commit on this branch (hash
5742f092b7cc670d6ab453459f03c1252964d07e) that does not do the refactor, but addresses the bug
Possible drawbacks
If this is an intended business logic, then this change is not needed.
Verification process
Manual testing:
- [x] check can set
typeand component reflects this - [x] check can set
classesand component reflects this - [x] check can set
typeandclassesand component reflects this - [x] check if
typeandclassescontradict,typetakes precedence
Release notes
Fixed #886 where if a banner type is present, banner classes could not be set