Skip to content

Commit

Permalink
add card footer
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhunter08 committed Sep 12, 2024
1 parent fe5326d commit d8f3f6b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/examples/cards/card-footer.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: layouts/example.njk
title: Card with footer
figmaLink: "https://www.figma.com/file/6f2CbcZ7cnpNrtKEcfQp8X/NHS-App-Design-System?type=design&node-id=128%3A7303&mode=design&t=DLiyCHcTTAYkEDa0-1"
vueLink: "https://nhsappvuecomponentlibraryv1.nonlive.nhsapp.service.nhs.uk/?path=/docs/components-nhscardbase--docs"
---

{% from "nhsapp/components/card/macro.njk" import nhsappCard %}

{{ nhsappCard({
title: 'Card title',
href: '#',
html: "
<p class='nhsuk-u-margin-top-2'>Card content</p>
",
footer: { html: "<p>Card footer content</p>" }
}) }}
19 changes: 19 additions & 0 deletions src/components/card/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ $card-border-hover-color: $color_nhsuk-grey-3;

&__content {
flex-grow: 1;

:last-child {
margin-bottom: 0;
}
}

&__link {
Expand Down Expand Up @@ -83,6 +87,21 @@ $card-border-hover-color: $color_nhsuk-grey-3;
margin-bottom: 0;
}
}

&__footer {
border-top: $card-border-width solid $card-border-color;
margin: 0 nhsuk-spacing(3);
padding: 20px 0;

@include mq($from: tablet) {
margin: 0 nhsuk-spacing(4);
padding: nhsuk-spacing(4) 0;
}

:last-child {
margin-bottom: 0;
}
}
}

// card group
Expand Down
1 change: 1 addition & 0 deletions src/components/card/card-group.njk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
badgeLarge: cardItem.badgeLarge,
prefixIcon: cardItem.prefixIcon,
readOnly: cardItem.readOnly,
footer: cardItem.footer,
isListItem: true
}) }}
{% endfor %}
Expand Down
5 changes: 5 additions & 0 deletions src/components/card/card.njk
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
{{ nhsappIcon('chevronRight') }}
{%- endif -%}
</div>
{%- if params.footer.html -%}
<div class="nhsapp-card__footer">
{{ params.footer.html | safe }}
</div>
{%- endif -%}
{%- if params.isListItem -%}
</li>
{%- else -%}
Expand Down

0 comments on commit d8f3f6b

Please sign in to comment.