-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
EdwardScull
committed
May 29, 2024
1 parent
07c9c3d
commit eb2a9d8
Showing
11 changed files
with
147 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
layout: layouts/example.njk | ||
title: Badge Large | ||
figmaLink: "https://www.figma.com/design/6f2CbcZ7cnpNrtKEcfQp8X/NHS-App-Design-System?node-id=128-7303&t=UdzCaY5YPtBypveQ-0" | ||
vueLink: "https://nhsappvuecomponentlibraryv1.nonlive.nhsapp.service.nhs.uk/?path=/docs/components-nhsbadge-large--docs" | ||
--- | ||
|
||
{% from "badge/large/macro.njk" import badgeLarge %} | ||
|
||
{{ badgeLarge({ | ||
count: 3, | ||
label: 'Something' | ||
}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
layout: layouts/example.njk | ||
title: Badge Small | ||
figmaLink: "https://www.figma.com/design/6f2CbcZ7cnpNrtKEcfQp8X/NHS-App-Design-System?node-id=128-7303&t=UdzCaY5YPtBypveQ-0" | ||
vueLink: "https://nhsappvuecomponentlibraryv1.nonlive.nhsapp.service.nhs.uk/?path=/docs/components-nhsbadge-small--docs" | ||
--- | ||
|
||
{% from "badge/small/macro.njk" import badgeSmall %} | ||
|
||
<p> | ||
{{ badgeSmall({ | ||
label: 'Documents', | ||
color: 'red' | ||
}) }} | ||
Document attached | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
layout: layouts/example.njk | ||
title: Badge Small | ||
figmaLink: "https://www.figma.com/design/6f2CbcZ7cnpNrtKEcfQp8X/NHS-App-Design-System?node-id=128-7303&t=UdzCaY5YPtBypveQ-0" | ||
vueLink: "https://nhsappvuecomponentlibraryv1.nonlive.nhsapp.service.nhs.uk/?path=/docs/components-nhsbadge-small--docs" | ||
--- | ||
|
||
{% from "badge/small/macro.njk" import badgeSmall %} | ||
|
||
<p> | ||
{{ badgeSmall({ | ||
label: 'Something' | ||
}) }} | ||
Document attached | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
@import "node_modules/nhsuk-frontend/packages/core/tools/all.scss"; | ||
@import "node_modules/nhsuk-frontend/packages/core/settings/all.scss"; | ||
|
||
@import "./components/card/card.scss"; | ||
@import "./components/card/card"; | ||
@import "./components/badge/badge"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// ========================================================================== | ||
// COMPONENTS / #BADGE | ||
// ========================================================================== | ||
|
||
@use "sass:math"; | ||
|
||
.nhsapp-badge { | ||
@include nhsuk-typography-responsive(19); | ||
|
||
display: inline-block; | ||
|
||
background-color: $nhsuk-error-color; | ||
border-radius: nhsuk-spacing(1); | ||
color: $color_nhsuk-white; | ||
font-weight: bold; | ||
padding: 0 nhsuk-spacing(2); | ||
|
||
@include mq($from: tablet) { | ||
padding: 0 12px; | ||
} | ||
} | ||
|
||
.nhsapp-badge-small { | ||
position: relative; | ||
|
||
display: inline-flex; | ||
align-items: baseline; | ||
} | ||
|
||
/** | ||
* Mixin to position the small badge | ||
* @param {number} $size - The size of the badge | ||
*/ | ||
@mixin small-badge-position($size: 8px) { | ||
position: relative; | ||
width: $size; | ||
height: $size; | ||
margin-right: $size; | ||
border-radius: math.div($size, 2); | ||
|
||
$font-height: 0.7em; // The height of a capital letter in the specific font we use (Frutiger) | ||
bottom: calc(0.5 * ($font-height - $size)); | ||
} | ||
|
||
$nhsapp-badge-size-mobile: 8px; | ||
$nhsapp-badge-size-tablet: 12px; | ||
|
||
.nhsapp-badge-small__indicator { | ||
@include small-badge-position($nhsapp-badge-size-mobile); | ||
|
||
@include mq($from: tablet) { | ||
@include small-badge-position($nhsapp-badge-size-tablet); | ||
} | ||
|
||
background-color: $color_nhsuk-blue; | ||
} | ||
|
||
.nhsapp-badge-small--red { | ||
.nhsapp-badge-small__indicator { | ||
background-color: $nhsuk-error-color; | ||
} | ||
} | ||
|
||
.nhsapp-badge-small--absolute { | ||
.nhsapp-badge-small__indicator { | ||
position: absolute; | ||
|
||
left: -2 * $nhsapp-badge-size-mobile; | ||
@include mq($from: tablet) { | ||
left: -2 * $nhsapp-badge-size-tablet; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{%- if params.count -%} | ||
<span class="nhsapp-badge"> | ||
<span class="nhsuk-u-visually-hidden">You have</span> | ||
{% if params.count > 9 %} | ||
+9 | ||
{% else %} | ||
{{ params.count }} | ||
{% endif %} | ||
<span class="nhsuk-u-visually-hidden">{{ params.label }}</span> | ||
</span> | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% macro badgeLarge(params) %} | ||
{%- include "./badge-large.njk" -%} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<span class=" | ||
nhsapp-badge-small | ||
{{ 'nhsapp-badge-small--red' if params.color === 'red' }} | ||
{{ 'nhsapp-badge-small--absolute' if params.positionAbsolute }}"> | ||
<span class="nhsapp-badge-small__indicator" aria-hidden="true"></span> | ||
<span class="nhsuk-u-visually-hidden">{{ params.label }}</span> | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% macro badgeSmall(params) %} | ||
{%- include "./badge-small.njk" -%} | ||
{% endmacro %} |