Skip to content

Commit decc736

Browse files
Align warning callout with NHS.UK frontend
1 parent 25d96d0 commit decc736

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/components/content-presentation/warning-callout/WarningCallout.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import React, { FC, HTMLProps } from 'react';
22
import classNames from 'classnames';
33
import HeadingLevel, { HeadingLevelType } from '@components/utils/HeadingLevel';
44

5-
interface WarningCalloutLabelProps extends HTMLProps<HTMLHeadingElement> {
5+
interface WarningCalloutHeadingProps extends HTMLProps<HTMLHeadingElement> {
66
headingLevel?: HeadingLevelType;
77
visuallyHiddenText?: string | false;
88
}
99

10-
const WarningCalloutLabel: FC<WarningCalloutLabelProps> = ({
10+
const WarningCalloutHeading: FC<WarningCalloutHeadingProps> = ({
1111
className,
1212
visuallyHiddenText = 'Important: ',
1313
children,
@@ -23,13 +23,13 @@ const WarningCalloutLabel: FC<WarningCalloutLabelProps> = ({
2323
);
2424

2525
interface IWarningCallout extends FC<HTMLProps<HTMLDivElement>> {
26-
Label: typeof WarningCalloutLabel;
26+
Heading: typeof WarningCalloutHeading;
2727
}
2828

2929
const WarningCalloutComponent: IWarningCallout = ({ className, ...rest }) => (
3030
<div className={classNames('nhsuk-warning-callout', className)} {...rest} />
3131
);
3232

33-
WarningCalloutComponent.Label = WarningCalloutLabel;
33+
WarningCalloutComponent.Heading = WarningCalloutHeading;
3434

3535
export default WarningCalloutComponent;

src/components/content-presentation/warning-callout/__tests__/WarningCallout.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('WarningCallout', () => {
66
it('matches snapshot', () => {
77
const { container } = render(
88
<WarningCallout>
9-
<WarningCallout.Label>School, nursery or work</WarningCallout.Label>
9+
<WarningCallout.Heading>School, nursery or work</WarningCallout.Heading>
1010
<p>
1111
Stay away from school, nursery or work until all the spots have crusted over. This is
1212
usually 5 days after the spots first appeared.
@@ -20,7 +20,7 @@ describe('WarningCallout', () => {
2020
it('adds default visually hidden text', () => {
2121
const { container } = render(
2222
<WarningCallout>
23-
<WarningCallout.Label>School, nursery or work</WarningCallout.Label>
23+
<WarningCallout.Heading>School, nursery or work</WarningCallout.Heading>
2424
<p>
2525
Stay away from school, nursery or work until all the spots have crusted over. This is
2626
usually 5 days after the spots first appeared.
@@ -36,9 +36,9 @@ describe('WarningCallout', () => {
3636
it('adds custom visually hidden text', () => {
3737
const { container } = render(
3838
<WarningCallout>
39-
<WarningCallout.Label visuallyHiddenText="Not Very Important: ">
39+
<WarningCallout.Heading visuallyHiddenText="Not Very Important: ">
4040
School, nursery or work
41-
</WarningCallout.Label>
41+
</WarningCallout.Heading>
4242
<p>
4343
Stay away from school, nursery or work until all the spots have crusted over. This is
4444
usually 5 days after the spots first appeared.
@@ -54,9 +54,9 @@ describe('WarningCallout', () => {
5454
it('can disable visually hidden text', () => {
5555
const { container } = render(
5656
<WarningCallout>
57-
<WarningCallout.Label visuallyHiddenText={false}>
57+
<WarningCallout.Heading visuallyHiddenText={false}>
5858
School, nursery or work
59-
</WarningCallout.Label>
59+
</WarningCallout.Heading>
6060
<p>
6161
Stay away from school, nursery or work until all the spots have crusted over. This is
6262
usually 5 days after the spots first appeared.

stories/Content Presentation/WarningCallout.stories.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ const meta: Meta<typeof WarningCallout> = {
99
export default meta;
1010
type Story = StoryObj<typeof WarningCallout>;
1111

12-
WarningCallout.Label.displayName = 'WarningCallout.Label';
12+
WarningCallout.Heading.displayName = 'WarningCallout.Heading';
1313

1414
export const StandardWarningCallout: Story = {
1515
render: (args) => (
1616
<WarningCallout>
17-
<WarningCallout.Label>School, nursery or work</WarningCallout.Label>
17+
<WarningCallout.Heading>School, nursery or work</WarningCallout.Heading>
1818
<p>
1919
Stay away from school, nursery or work until all the spots have crusted over. This is
2020
usually 5 days after the spots first appeared.
@@ -28,9 +28,9 @@ export const StandardWarningCallout: Story = {
2828
export const WarningCalloutWithCustomVisuallyHiddenText: Story = {
2929
render: (args) => (
3030
<WarningCallout>
31-
<WarningCallout.Label visuallyHiddenText="Not Important: ">
31+
<WarningCallout.Heading visuallyHiddenText="Not Important: ">
3232
School, nursery or work
33-
</WarningCallout.Label>
33+
</WarningCallout.Heading>
3434
<p>
3535
Stay away from school, nursery or work until all the spots have crusted over. This is
3636
usually 5 days after the spots first appeared.
@@ -42,9 +42,9 @@ export const WarningCalloutWithCustomVisuallyHiddenText: Story = {
4242
export const WarningCalloutWithDisabledVisuallyHiddenText: Story = {
4343
render: (args) => (
4444
<WarningCallout>
45-
<WarningCallout.Label visuallyHiddenText={false}>
45+
<WarningCallout.Heading visuallyHiddenText={false}>
4646
School, nursery or work
47-
</WarningCallout.Label>
47+
</WarningCallout.Heading>
4848
<p>
4949
Stay away from school, nursery or work until all the spots have crusted over. This is
5050
usually 5 days after the spots first appeared.

0 commit comments

Comments
 (0)