Add frameless option to image component#2002
Conversation
| released: '10.6.0' | ||
| }, | ||
| background: { | ||
| type: 'boolean', |
There was a problem hiding this comment.
Since the default is the card background colour, this should be a string
But like other components, overriding this with background: false would remove it
There was a problem hiding this comment.
Ah ok, will this mean we can add other colours in future, eg. page-background or NHS blue?
There was a problem hiding this comment.
Yeah if necessary, but also because we do this in the code component already 😊
| type: 'boolean', | ||
| required: false, | ||
| description: | ||
| 'If set to `false`, sets the background colour to transparent for the image container.', |
There was a problem hiding this comment.
Maybe something like this?
| 'If set to `false`, sets the background colour to transparent for the image container.', | |
| 'Background colour for the image component – `"card"` or `false`. Defaults to `"card"`. To remove the background colour, set `background` to `false`.', |
|
|
||
| {%- if params.frameless %} | ||
| {% set classNames = classNames ~ " nhsuk-image--frameless" %} | ||
| {%- if params.border === false %} |
There was a problem hiding this comment.
We support both classes and border: true
So we'll need to check for both here, i.e. to skip the class if already set
| {%- if params.border === false %} | |
| {%- if params.border === false and (not params.classes or not "nhsuk-image--no-border" in params.classes) %} |
| {% set classNames = classNames ~ " nhsuk-image--no-border" %} | ||
| {% endif -%} | ||
|
|
||
| {%- if params.background === false %} |
There was a problem hiding this comment.
| {%- if params.background === false %} | |
| {%- if params.background === false and (not params.classes or not "nhsuk-image--no-background" in params.classes) %} |
|
Thanks for the review @colinrotherham I've had a go at amending based on your comments. |
Description
Our image component adds a visible border-bottom and a background colour by default. This option removes those so that images can be added more flexibly and to dark backgrounds, for example, in our hero component.
Current:

Frameless:

Checklist