Skip to content

Commit 0f19042

Browse files
TASK AS Refactor WarningCallout, add refs for nhsuk components
1 parent b6f280b commit 0f19042

File tree

9 files changed

+14
-3
lines changed

9 files changed

+14
-3
lines changed

src/app/_components/nhs-app/CardLinkWithDescription.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ interface CardLinkProps {
66
link: string;
77
}
88

9+
// Ref: https://design-system.nhsapp.service.nhs.uk/components/card-links/
910
const CardLinkWithDescription = ({ title, description, link }: CardLinkProps) => {
1011
return (
1112
<li className="nhsapp-card">

src/app/_components/nhs-frontend/BackLink.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const handleClick = (router: AppRouterInstance) => {
99
router.back();
1010
};
1111

12+
// Ref: https://service-manual.nhs.uk/design-system/components/back-link
1213
const BackLink = () => {
1314
const router = useRouter();
1415
const { hasContextLoaded, isOpenInMobileApp } = useBrowserContext();

src/app/_components/nhs-frontend/NonUrgentCareCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface NonUrgentCareCardProps {
1313
content: JSX.Element;
1414
}
1515

16+
// Ref: https://service-manual.nhs.uk/design-system/patterns/help-users-decide-when-and-where-to-get-care
1617
const NonUrgentCareCard = ({ heading, headingLevel, content }: NonUrgentCareCardProps) => {
1718
return (
1819
<Card cardType="non-urgent" data-testid="non-urgent-care-card">

src/app/_components/nhs-frontend/SkipLink.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import React from "react";
44

5+
// Ref: https://service-manual.nhs.uk/design-system/components/skip-link
56
const SkipLink = () => {
67
return (
78
<a

src/app/_components/nhs-frontend/UrgentCareCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface NonUrgentCareCardProps {
1313
content: JSX.Element;
1414
}
1515

16+
// Ref: https://service-manual.nhs.uk/design-system/patterns/help-users-decide-when-and-where-to-get-care
1617
const UrgentCareCard = ({ heading, headingLevel, content }: NonUrgentCareCardProps) => {
1718
return (
1819
<Card cardType="urgent" data-testid="urgent-care-card">

src/app/_components/content/WarningCallout.test.tsx renamed to src/app/_components/nhs-frontend/WarningCallout.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Callout from "@src/app/_components/content/WarningCallout";
1+
import Callout from "@src/app/_components/nhs-frontend/WarningCallout";
22
import { VaccineType } from "@src/models/vaccine";
33
import { mockStyledContent } from "@test-data/content-api/data";
44
import { render, screen } from "@testing-library/react";

src/app/_components/content/WarningCallout.tsx renamed to src/app/_components/nhs-frontend/WarningCallout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { VaccineInfo, VaccineType } from "@src/models/vaccine";
22
import { StyledVaccineContent } from "@src/services/content-api/types";
33
import { JSX } from "react";
44

5+
import styles from "./styles.module.css";
6+
57
const WarningCallout = (props: {
68
styledVaccineContent: StyledVaccineContent;
79
vaccineType: VaccineType;
810
}): JSX.Element => {
911
const element =
1012
props.styledVaccineContent.callout && !VaccineInfo[props.vaccineType].supressWarningCallout ? (
11-
<div data-testid="callout" className="nhsuk-warning-callout">
13+
<div data-testid="callout" className={`nhsuk-warning-callout ${styles.warningCalloutZeroMarginBottom}`}>
1214
<h3 className="nhsuk-warning-callout__label">
1315
<span role="text">
1416
<span className="nhsuk-u-visually-hidden">Important: </span>

src/app/_components/nhs-frontend/styles.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
.careCardZeroMarginBottom ul:last-child {
66
margin-bottom: 0;
77
}
8+
9+
.warningCalloutZeroMarginBottom p:last-child {
10+
margin-bottom: 0;
11+
}

src/app/_components/vaccine/Vaccine.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { HowToGetVaccineFallback } from "@src/app/_components/content/HowToGetVa
66
import { MoreInformation } from "@src/app/_components/content/MoreInformation";
77
import { Overview } from "@src/app/_components/content/Overview";
88
import Recommendation from "@src/app/_components/content/Recommendation";
9-
import WarningCallout from "@src/app/_components/content/WarningCallout";
109
import { EligibilityVaccinePageContent } from "@src/app/_components/eligibility/EligibilityVaccinePageContent";
10+
import WarningCallout from "@src/app/_components/nhs-frontend/WarningCallout";
1111
import { RSVPregnancyInfo } from "@src/app/_components/vaccine-custom/RSVPregnancyInfo";
1212
import { NhsNumber, VaccineDetails, VaccineInfo, VaccineType } from "@src/models/vaccine";
1313
import { getContentForVaccine } from "@src/services/content-api/content-service";

0 commit comments

Comments
 (0)