Skip to content

Commit

Permalink
GW-40 Add author field to card component
Browse files Browse the repository at this point in the history
  • Loading branch information
Warren Keith committed Jan 30, 2018
1 parent 217566b commit 37510f3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
10 changes: 9 additions & 1 deletion server/views/components/card.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

{{ card({ heading: { text: "This is a card heading" }, href: "https://www.nice.org.uk/", metadata: [ { key: "Published date", value: "March 2015", datetime: "2015-03" }, { key: "Metadata key", value: "Metadata value" } ] }) }}

<h2>Basic card with author</h2>

{{ card({ heading: { text: "This is a card heading" }, href: "https://www.nice.org.uk/", author: "Jane Viner, chief nurse at Torbay and South Devon NHS Foundation Trust and NICE fellow", metadata: [ { key: "Published date", value: "March 2015", datetime: "2015-03" }, { key: "Metadata key", value: "Metadata value" } ] }) }}

<h2>Card (separator)</h2>

{{ card({ heading: { text: "This is a card heading" }, modifier: "separator", href: "https://www.nice.org.uk/", metadata: [ { key: "Published date", value: "March 2015", datetime: "2015-03" }, { key: "Metadata key", value: "Metadata value" } ] }) }}
Expand All @@ -28,11 +32,15 @@

{{ card({ heading: { text: "NICE final draft guidance recommends gene therapy for rare ‘bubble baby syndrome’" }, href: "https://www.nice.org.uk/news/article/nice-approves-gene-therapy-for-rare-bubble-baby-syndrome", summary: "Strimvelis, a treatment for an ultra-rare inherited immune deficiency condition that has been dubbed ‘bubble baby syndrome’ has been approved by NICE in final draft guidance.", metadata: [ { key: "Published", value: "03 January 2018", datetime: "2018-01-03" } ] }) }}

<h2>With summary and author</h2>

{{ card({ heading: { text: "NICE final draft guidance recommends gene therapy for rare ‘bubble baby syndrome’" }, href: "https://www.nice.org.uk/news/article/nice-approves-gene-therapy-for-rare-bubble-baby-syndrome", author: "Jane Viner, chief nurse at Torbay and South Devon NHS Foundation Trust and NICE fellow", summary: "Strimvelis, a treatment for an ultra-rare inherited immune deficiency condition that has been dubbed ‘bubble baby syndrome’ has been approved by NICE in final draft guidance.", metadata: [ { key: "Published", value: "03 January 2018", datetime: "2018-01-03" } ] }) }}

<h2>With image</h2>

<div class="grid">
<div data-g="12 md:6">
{{ card({ heading: { text: "NICE final draft guidance recommends gene therapy for rare ‘bubble baby syndrome’" }, href: "https://www.nice.org.uk/news/article/nice-approves-gene-therapy-for-rare-bubble-baby-syndrome", image: { source: "https://www.nice.org.uk/Media/Default/_Profiles/9d48f06b/fc168ad0/DNA%20-%20200x200-1.jpg?v=636443424909234740", alt: "DNA moleclule spiral" }, summary: "Strimvelis, a treatment for an ultra-rare inherited immune deficiency condition that has been dubbed ‘bubble baby syndrome’ has been approved by NICE in final draft guidance.", metadata: [ { key: "Published", value: "03 January 2018", datetime: "2018-01-03" } ] }) }}
{{ card({ heading: { text: "NICE final draft guidance recommends gene therapy for rare ‘bubble baby syndrome’" }, author: "Jane Viner, chief nurse at Torbay and South Devon NHS Foundation Trust and NICE fellow", href: "https://www.nice.org.uk/news/article/nice-approves-gene-therapy-for-rare-bubble-baby-syndrome", image: { source: "https://www.nice.org.uk/Media/Default/_Profiles/9d48f06b/fc168ad0/DNA%20-%20200x200-1.jpg?v=636443424909234740", alt: "DNA moleclule spiral" }, summary: "Strimvelis, a treatment for an ultra-rare inherited immune deficiency condition that has been dubbed ‘bubble baby syndrome’ has been approved by NICE in final draft guidance.", metadata: [ { key: "Published", value: "03 January 2018", datetime: "2018-01-03" } ] }) }}
</div>
<div data-g="12 md:6">
{{ card({ heading: { text: "Support people to make decisions if they have capacity but find it difficult, NICE says" }, href: "https://www.nice.org.uk/news/article/nice-approves-gene-therapy-for-rare-bubble-baby-syndrome", image: { source: "https://www.nice.org.uk/Media/Default/_Profiles/9d48f06b/b8bb6725/couple%20making%20decision%20-%20200x200.jpg?v=636493615990150776" }, summary: "Health and social care professionals should support people to make decisions who find it difficult, NICE says in new draft guidance.", metadata: [ { key: "Published", value: "20 December 2017", datetime: "2017-12-20" } ] }) }}
Expand Down
2 changes: 1 addition & 1 deletion server/views/pages/topic-landing-page.njk
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
Latest blogs on this topic
</h3>

{{ card({ heading: { text: "Support people to make decisions if they have capacity but find it difficult, NICE says" }, modifier: "flush", href: "https://www.nice.org.uk/news/article/nice-approves-gene-therapy-for-rare-bubble-baby-syndrome", image: { source: "https://www.nice.org.uk/Media/Default/_Profiles/9d48f06b/b8bb6725/couple%20making%20decision%20-%20200x200.jpg?v=636493615990150776" }, summary: "Health and social care professionals should support people to make decisions who find it difficult, NICE says in new draft guidance.", metadata: [ { key: "Published", value: "20 December 2017", datetime: "2017-12-20" } ] }) }}
{{ card({ heading: { text: "Support people to make decisions if they have capacity but find it difficult, NICE says" }, modifier: "flush", author: "Jane Viner, chief nurse at Torbay and South Devon NHS Foundation Trust and NICE fellow", href: "https://www.nice.org.uk/news/article/nice-approves-gene-therapy-for-rare-bubble-baby-syndrome", image: { source: "https://www.nice.org.uk/Media/Default/_Profiles/9d48f06b/b8bb6725/couple%20making%20decision%20-%20200x200.jpg?v=636493615990150776" }, summary: "Health and social care professionals should support people to make decisions who find it difficult, NICE says in new draft guidance.", metadata: [ { key: "Published", value: "20 December 2017", datetime: "2017-12-20" } ] }) }}

</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/components/card/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
}
}

&__author {
@include font-size(-1);
color: $colour-nice-dark-grey;
margin: rem(0 0 $spacing-x-small 0);
}

&__summary {
margin: rem(0 0 $spacing-x-small 0);
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/card/card.njk
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
{{ card.summary }}
</p>
{% endif %}
{% if card.author %}
<div class="card__author">
<span class="visually-hidden">Written by: </span>
{{ card.author }}
</div>
{% endif %}
{% if card.metadata %}
<dl class="card__metadata">
{% if card.tag %}
Expand Down

0 comments on commit 37510f3

Please sign in to comment.