diff --git a/src/components/message-list/_macro-options.md b/src/components/message-list/_macro-options.md index 0c0742367d..a8792be3cd 100644 --- a/src/components/message-list/_macro-options.md +++ b/src/components/message-list/_macro-options.md @@ -11,12 +11,18 @@ ## Message -| Name | Type | Required | Description | -| -------- | ------- | -------- | -------------------------------------------------------------------------------- | -| id | string | true | The HTML `id` for the message item | -| url | string | true | The URL for the HTML `href` attribute to link to the message conversation thread | -| subject | string | true | Text displayed for the message subject | -| fromText | string | true | Value of the “From” sender name in the message metadata information | -| dateText | string | true | Value of the “Sent” date stamp in the message metadata information | -| body | string | true | Text displayed for the message body snippet | -| unread | boolean | false | Set to “true” to display the unread message suffix after the `subject` | +| Name | Type | Required | Description | +| -------- | ----------------- | -------- | ---------------------------------------------------------------------- | +| id | string | true | The HTML `id` for the message item | +| subject | `Object` | true | Settings for the [Subject](#subject) | +| fromText | string | true | Value of the “From” sender name in the message metadata information | +| dateText | string | true | Value of the “Sent” date stamp in the message metadata information | +| body | string | true | Text displayed for the message body snippet | +| unread | boolean | false | Set to “true” to display the unread message suffix after the `subject` | + +## Subject + +| Name | Type | Required | Description | +| ---- | ------ | -------- | -------------------------------------------------------------------------------- | +| text | string | true | Text displayed for the message subject | +| url | string | true | The URL for the HTML `href` attribute to link to the message conversation thread | diff --git a/src/components/message-list/_macro.njk b/src/components/message-list/_macro.njk index 35010b197c..17d363e8e9 100644 --- a/src/components/message-list/_macro.njk +++ b/src/components/message-list/_macro.njk @@ -3,7 +3,7 @@ {% for message in params.messages %}
  • - {{ message.subject }} + {{ message.subject.text }} {% if message.unread %}({{ params.unreadText }}){% endif %}

  • {% endfor %} diff --git a/src/components/message-list/_macro.spec.js b/src/components/message-list/_macro.spec.js index 8d7333066f..0ef6f93be4 100644 --- a/src/components/message-list/_macro.spec.js +++ b/src/components/message-list/_macro.spec.js @@ -14,16 +14,20 @@ const EXAMPLE_MESSAGE_LIST_MINIMAL = { { id: 'message1', unread: true, - url: 'https://example.com/message/1', - subject: 'Example message subject', + subject: { + url: 'https://example.com/message/1', + text: 'Example message subject', + }, fromText: 'Example Sender 1', dateText: 'Tue 4 Jul 2020 at 7:47', body: 'An example message.', }, { id: 'message2', - url: 'https://example.com/message/2', - subject: 'Another example message subject', + subject: { + url: 'https://example.com/message/2', + text: 'Another example message subject', + }, fromText: 'Example Sender 2', dateText: 'Mon 1 Oct 2019 at 9:52', body: 'Another example message.', diff --git a/src/patterns/send-and-reply-to-messages/example-message-list.njk b/src/patterns/send-and-reply-to-messages/example-message-list.njk index 3e42673524..13fc66e3ae 100644 --- a/src/patterns/send-and-reply-to-messages/example-message-list.njk +++ b/src/patterns/send-and-reply-to-messages/example-message-list.njk @@ -12,17 +12,21 @@ "messages": [ { "id": "message-list-example-1", + "subject": { + "url": "#0", + "text": "BRES 2016 survey response query" + }, "unread": true, - "url": "#0", - "subject": "BRES 2016 survey response query", "fromText": "ONS Business Surveys Team", "dateText": "Tue 4 Jul 2020 at 7:47", "body": "Hi Jacky. Thanks for that information. Your figures have allowed us to create more accurate…" }, { "id": "message-list-example-2", - "url": "#0", - "subject": "BRES 2015 Enquiry on data", + "subject":{ + "url": "#0", + "text": "BRES 2015 Enquiry on data" + }, "fromText": "Jacky Turner", "dateText": "Mon 1 Oct 2019 at 9:52", "body": "Hi Jacky, Thank you for returning the Business Register and Employment Survey (BRES) 2016…"