Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update parameter subject from text to object type in Message list component #3291

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions src/components/message-list/_macro-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Subject>` | 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 |
4 changes: 2 additions & 2 deletions src/components/message-list/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% for message in params.messages %}
<li class="ons-message-item" aria-labelledby="{{ message.id }}">
<h3 class="ons-message-item__subject" id="{{ message.id }}">
<a href="{{ message.url }}" class="ons-u-fs-r--b">{{ message.subject }}</a>
<a href="{{ message.subject.url }}" class="ons-u-fs-r--b">{{ message.subject.text }}</a>
{% if message.unread %}<span class="ons-message-item__unread ons-u-fs-s">({{ params.unreadText }})</span>{% endif %}
</h3>
<dl class="ons-message-item__metadata" aria-label="{{ params.ariaLabelMetaData | default("Message metadata") }}">
Expand All @@ -20,7 +20,7 @@
{{ message.body | safe }}
</div>
<div class="ons-message-item__link ons-u-vh">
<a href="{{ message.url }}">{{ params.hiddenReadLabel }}: {{ message.subject }}</a>
<a href="{{ message.subject.url }}">{{ params.hiddenReadLabel }}: {{ message.subject.text }}</a>
</div>
</li>
{% endfor %}
Expand Down
12 changes: 8 additions & 4 deletions src/components/message-list/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
12 changes: 8 additions & 4 deletions src/patterns/send-and-reply-to-messages/example-message-list.njk
Original file line number Diff line number Diff line change
Expand Up @@ -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…"
Expand Down
Loading