,
+ T extends ElementType,
+> = FormElementProps & {
+ children: (props: FormElementRenderProps
) => ReactNode;
+ inputType?: 'input' | 'radios' | 'select' | 'checkboxes' | 'dateinput' | 'textarea';
};
-export type FormGroupProps = FormElementProps & {
- children: (props: FormElementRenderProps) => ReactNode;
- inputType: 'input' | 'radios' | 'select' | 'checkboxes' | 'dateinput' | 'textarea';
-};
-
-export const FormGroup = (
- props: FormGroupProps,
-): JSX.Element => {
- const {
- children,
- hint,
- label,
- id,
- legend,
- legendProps,
- fieldsetProps,
- labelProps,
- error,
- hintProps,
- errorProps,
- formGroupProps,
- inputType,
- name,
- 'aria-describedby': ariaDescribedBy,
- ...rest
- } = props;
+export const FormGroup = , T extends ElementType>({
+ children,
+ inputType = 'input',
+ hint,
+ label,
+ legend,
+ legendProps,
+ fieldsetProps,
+ labelProps,
+ error,
+ hintProps,
+ errorProps,
+ formGroupProps,
+ inputWrapperProps,
+ id,
+ name,
+ ...rest
+}: FormGroupProps
): JSX.Element => {
const [generatedID] = useState(generateRandomID(inputType));
const { registerComponent, passError } = useContext(FormGroupContext);
const { disableErrorFromComponents } = useFormContext();
@@ -85,6 +61,7 @@ export const FormGroup = (
const hasError = !disableErrorFromComponents && !!error;
// Build list of IDs for aria-describedby
+ let { 'aria-describedby': ariaDescribedBy } = rest;
const ariaDescribedByIds = ariaDescribedBy ? [ariaDescribedBy] : [];
// Add optional hint ID
@@ -97,12 +74,18 @@ export const FormGroup = (
ariaDescribedByIds.push(errorID);
}
+ // Update aria-describedby with new IDs
+ ariaDescribedBy = ariaDescribedByIds.join(' ') || undefined;
+
+ const { beforeInput, afterInput, ...formGroupRest } = formGroupProps ?? {};
+
const childProps = {
- error,
- name: name ?? elementID,
- id: elementID,
...rest,
- } as FormElementRenderProps;
+ error,
+ 'id': elementID,
+ 'name': name ?? elementID,
+ 'aria-describedby': !hasFieldset ? ariaDescribedBy : undefined,
+ } as FormElementRenderProps;
useEffect(() => {
passError(elementID, disableErrorFromComponents ? false : Boolean(error));
@@ -114,17 +97,25 @@ export const FormGroup = (
return () => registerComponent(elementID, true);
}, [elementID, registerComponent]);
+ const input = (
+ <>
+ {beforeInput?.(childProps)}
+ {children(childProps)}
+ {afterInput?.(childProps)}
+ >
+ );
+
return (
{hasFieldset ? (
-
+
{legend}
{hint}
@@ -132,7 +123,7 @@ export const FormGroup = (
{error}
- {children(childProps)}
+ {input}
) : (
<>
@@ -145,10 +136,14 @@ export const FormGroup = (
{error}
- {children({
- ...childProps,
- 'aria-describedby': ariaDescribedByIds.join(' ') || undefined,
- })}
+ {(inputType === 'input' || inputType === 'select') &&
+ !!(beforeInput || afterInput || inputWrapperProps) ? (
+
+ {input}
+
+ ) : (
+ input
+ )}
>
)}
diff --git a/src/components/utils/__tests__/FormGroup.test.tsx b/src/components/utils/__tests__/FormGroup.test.tsx
index d62e938b..5fb41ad2 100644
--- a/src/components/utils/__tests__/FormGroup.test.tsx
+++ b/src/components/utils/__tests__/FormGroup.test.tsx
@@ -1,14 +1,15 @@
import { axe, toHaveNoViolations } from 'jest-axe';
-import { FormGroup, type FormElementRenderProps } from '..';
+import { FormGroup } from '..';
import { type TextInputProps } from '#components/form-elements';
import { renderClient, renderServer } from '#util/components';
+import type { FormElementRenderProps } from '#util/types/FormTypes';
expect.extend(toHaveNoViolations);
describe('FormGroup', () => {
- let renderProps: FormElementRenderProps | undefined;
+ let renderProps: FormElementRenderProps | undefined;
beforeEach(() => {
renderProps = undefined;
@@ -16,9 +17,7 @@ describe('FormGroup', () => {
it('matches snapshot', async () => {
const { container } = await renderClient(
- inputType="input" id="testId">
- {(props) => }
- ,
+ id="testId">{(props) => } ,
{ className: 'nhsuk-form-group' },
);
@@ -27,9 +26,7 @@ describe('FormGroup', () => {
it('matches snapshot (via server)', async () => {
const { container, element } = await renderServer(
- inputType="input" id="testId">
- {(props) => }
- ,
+ id="testId">{(props) => } ,
{ className: 'nhsuk-form-group' },
);
@@ -46,7 +43,7 @@ describe('FormGroup', () => {
it('generates a random ID for the input', async () => {
await renderClient(
- inputType="input">
+ >
{(props) => {
renderProps = props;
return ;
@@ -61,7 +58,7 @@ describe('FormGroup', () => {
it('allows passing of custom IDs', async () => {
await renderClient(
- inputType="input" id="TestID2ElectricBoogaloo">
+ id="TestID2ElectricBoogaloo">
{(props) => {
renderProps = props;
return ;
@@ -75,7 +72,7 @@ describe('FormGroup', () => {
it('passes correct props for hint (generated id)', async () => {
const { container } = await renderClient(
- inputType="input" hint="This is a test hint">
+ hint="This is a test hint">
{(props) => {
renderProps = props;
return ;
@@ -96,7 +93,7 @@ describe('FormGroup', () => {
it('passes correct props for hint (custom id)', async () => {
const { container } = await renderClient(
- inputType="input" hint="This is a test hint" id="testID">
+ hint="This is a test hint" id="testID">
{(props) => {
renderProps = props;
return ;
@@ -116,7 +113,7 @@ describe('FormGroup', () => {
it('passes correct props for label (generated id)', async () => {
const { container } = await renderClient(
- inputType="input" label="This is a test label">
+ label="This is a test label">
{(props) => {
renderProps = props;
return ;
@@ -136,8 +133,7 @@ describe('FormGroup', () => {
it('passes correct props for label (custom id)', async () => {
const { container } = await renderClient(
-
- inputType="input"
+
label="This is a test label"
labelProps={{ title: 'TestTitle' }}
id="testID"
@@ -160,8 +156,7 @@ describe('FormGroup', () => {
it('passes correct props for error (generated id)', async () => {
const { container } = await renderClient(
-
- inputType="input"
+
error="This is a test error"
errorProps={{ title: 'TestTitle' }}
>
@@ -190,8 +185,7 @@ describe('FormGroup', () => {
it('passes correct props for error (custom id)', async () => {
const { container } = await renderClient(
-
- inputType="input"
+
error="This is a test error"
errorProps={{ title: 'TestTitle' }}
id="testID"
@@ -221,7 +215,7 @@ describe('FormGroup', () => {
describe('applies the correct classes when errored', () => {
it('string component', async () => {
const { container } = await renderClient(
- inputType="input" error="Oh no there's an error!">
+ error="Oh no there's an error!">
{({ error, ...rest }) => }
,
{ className: 'nhsuk-form-group' },
@@ -240,8 +234,7 @@ describe('FormGroup', () => {
it('should produce an accessible component', async () => {
const { container } = await renderClient(
-
- inputType="input"
+
error="This is an error"
hint="This is a hint"
label="Form Label"
@@ -258,8 +251,7 @@ describe('FormGroup', () => {
it('should add hint ID and error ID to the aria-describedby of the input', async () => {
const { container } = await renderClient(
-
- inputType="input"
+
id="error-and-hint"
error="This is an error"
hint="This is a hint"
@@ -277,9 +269,7 @@ describe('FormGroup', () => {
it('should have no aria-describedby when there is no hint or label', async () => {
const { container } = await renderClient(
- inputType="input">
- {({ error, ...rest }) => }
- ,
+ >{({ error, ...rest }) => } ,
{ className: 'nhsuk-form-group' },
);
diff --git a/src/util/types/FormTypes.ts b/src/util/types/FormTypes.ts
index 4bd74b32..33aa7f98 100644
--- a/src/util/types/FormTypes.ts
+++ b/src/util/types/FormTypes.ts
@@ -1,4 +1,9 @@
-import { type ReactElement } from 'react';
+import {
+ type ComponentPropsWithoutRef,
+ type ElementType,
+ type ReactElement,
+ type ReactNode,
+} from 'react';
import { type ErrorMessageProps } from '#components/form-elements/error-message/index.js';
import { type FieldsetProps } from '#components/form-elements/fieldset/index.js';
@@ -7,7 +12,7 @@ import { type LabelProps } from '#components/form-elements/label/index.js';
import { type LegendProps } from '#components/form-elements/legend/index.js';
import { type ComponentPropsWithDataAttributes } from '#util/types/NHSUKTypes.js';
-export interface FormElementProps {
+export interface FormElementProps, T extends ElementType> {
'fieldsetProps'?: FieldsetProps;
'legend'?: string | ReactElement;
'legendProps'?: LegendProps;
@@ -17,8 +22,22 @@ export interface FormElementProps {
'errorProps'?: ErrorMessageProps;
'hint'?: string | ReactElement;
'hintProps'?: HintTextProps;
- 'formGroupProps'?: ComponentPropsWithDataAttributes<'div'>;
+ 'formGroupProps'?: ComponentPropsWithDataAttributes<'div'> & {
+ beforeInput?: (props: FormElementRenderProps
) => ReactNode | undefined;
+ afterInput?: (props: FormElementRenderProps
) => ReactNode | undefined;
+ };
+ 'inputWrapperProps'?: ComponentPropsWithDataAttributes<'div'>;
'id'?: string;
'name'?: string;
'aria-describedby'?: string;
}
+
+export type FormElementRenderProps<
+ P extends ComponentPropsWithoutRef,
+ T extends ElementType,
+> = P & {
+ 'id': string;
+ 'name': string;
+ 'error': string | ReactElement | undefined;
+ 'aria-describedby': string | undefined;
+};
diff --git a/src/util/types/NHSUKTypes.ts b/src/util/types/NHSUKTypes.ts
index 77259880..c5ee9113 100644
--- a/src/util/types/NHSUKTypes.ts
+++ b/src/util/types/NHSUKTypes.ts
@@ -6,7 +6,7 @@ export type InputWidth = '2' | '3' | '4' | '5' | '10' | '20' | '30' | 2 | 3 | 4
export type CareCardType = 'non-urgent' | 'urgent' | 'emergency';
-export type CardType = 'feature' | 'primary' | 'secondary' | CareCardType;
+export type CardType = 'clickable' | 'feature' | 'primary' | 'secondary' | CareCardType;
export type ColWidth =
| 'full'
diff --git a/stories/Content Presentation/Tabs.stories.tsx b/stories/Content Presentation/Tabs.stories.tsx
index 6dbc2b50..6696911b 100644
--- a/stories/Content Presentation/Tabs.stories.tsx
+++ b/stories/Content Presentation/Tabs.stories.tsx
@@ -29,15 +29,15 @@ export const Standard: Story = {
- Past day contents go here
+ Past day contents go here
- Past week contents go here
+ Past week contents go here
- Past month contents go here
+ Past month contents go here
),
@@ -59,15 +59,15 @@ export const DifferentAccessibleHeading: Story = {
- Past day contents go here
+ Past day contents go here
- Past week contents go here
+ Past week contents go here
- Past month contents go here
+ Past month contents go here
),
diff --git a/stories/Form Elements/Button.stories.tsx b/stories/Form Elements/Button.stories.tsx
index 8c90fd79..e8c83082 100644
--- a/stories/Form Elements/Button.stories.tsx
+++ b/stories/Form Elements/Button.stories.tsx
@@ -49,12 +49,77 @@ export default meta;
type Story = StoryObj;
export const Primary: Story = {
- args: { children: 'Primary' },
- render: (args) => ,
+ args: {
+ children: 'Save and continue',
+ },
+};
+
+export const SmallPrimary: Story = {
+ args: {
+ small: true,
+ children: 'Save and continue',
+ },
+};
+
+export const Secondary: Story = {
+ args: {
+ secondary: true,
+ children: 'Find my location',
+ },
+};
+
+export const SmallSecondary: Story = {
+ args: {
+ secondary: true,
+ small: true,
+ children: 'Find my location',
+ },
+};
+
+export const Warning: Story = {
+ args: {
+ warning: true,
+ children: 'Yes, delete this vaccine',
+ },
+};
+
+export const SmallWarning: Story = {
+ args: {
+ warning: true,
+ small: true,
+ children: 'Yes, delete this vaccine',
+ },
+};
+
+export const Login: Story = {
+ args: {
+ login: true,
+ children: 'Continue to NHS login',
+ },
+};
+
+export const SmallLogin: Story = {
+ args: {
+ login: true,
+ small: true,
+ children: 'Continue to NHS login',
+ },
+};
+
+export const Reverse: Story = {
+ args: {
+ reverse: true,
+ children: 'Log out',
+ },
+};
+
+export const SmallReverse: Story = {
+ args: {
+ reverse: true,
+ small: true,
+ children: 'Log out',
+ },
};
-export const Secondary: Story = { args: { secondary: true, children: 'Secondary' } };
-export const Reverse: Story = { args: { reverse: true, children: 'Reverse' } };
-export const Warning: Story = { args: { warning: true, children: 'Warning' } };
/**
*
@@ -76,8 +141,8 @@ export const PreventDoubleClickButton: Story = {
onClick: () => console.log(new Date()),
children: 'Debounced Button',
},
- render: (args) => ,
};
+
export const PreventDoubleClickLinkButton: Story = {
args: {
preventDoubleClick: true,
@@ -85,5 +150,4 @@ export const PreventDoubleClickLinkButton: Story = {
onClick: () => console.log(new Date()),
children: 'Debounced Button as Link',
},
- render: (args) => ,
};
diff --git a/stories/Form Elements/PasswordInput.stories.tsx b/stories/Form Elements/PasswordInput.stories.tsx
new file mode 100644
index 00000000..555fd817
--- /dev/null
+++ b/stories/Form Elements/PasswordInput.stories.tsx
@@ -0,0 +1,40 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+
+import { PasswordInput } from '#components/form-elements/password-input/index.js';
+
+const meta: Meta = {
+ title: 'Form Elements/PasswordInput',
+ component: PasswordInput,
+ args: {
+ id: 'input-example',
+ name: 'example',
+ label: 'Password',
+ labelProps: { isPageHeading: true, size: 'l' },
+ },
+ argTypes: {
+ ref: { table: { disable: true } },
+ },
+};
+
+export default meta;
+type Story = StoryObj;
+
+export const Standard: Story = {};
+export const WithHintText: Story = {
+ args: {
+ hint: 'It probably has some letters, numbers and maybe even some symbols in it',
+ },
+};
+
+export const WithError: Story = {
+ args: {
+ error: 'Enter a password',
+ },
+};
+
+export const WithErrorAndHintText: Story = {
+ args: {
+ error: 'Enter a password',
+ hint: 'It probably has some letters, numbers and maybe even some symbols in it',
+ },
+};
diff --git a/stories/Form Elements/Select.stories.tsx b/stories/Form Elements/Select.stories.tsx
index ddc0e998..a0eb75f2 100644
--- a/stories/Form Elements/Select.stories.tsx
+++ b/stories/Form Elements/Select.stories.tsx
@@ -1,83 +1,96 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
-import { useState } from 'react';
+import { Button } from '#components/form-elements/button/Button.js';
import { Select } from '#components/form-elements/select/index.js';
-import { TextInput } from '#components/form-elements/text-input/index.js';
const meta: Meta = {
title: 'Form Elements/Select',
component: Select,
args: {
- label: 'Label text goes here',
- labelProps: { isPageHeading: true, size: 'l' },
+ label: 'Sort by',
+ labelProps: { isPageHeading: true },
},
+ render: (args) => (
+
+ Choose location
+ East Midlands
+ East of England
+ London
+ North East
+ North West
+ South East
+ South West
+ West Midlands
+ Yorkshire and the Humber
+
+ ),
};
export default meta;
type Story = StoryObj;
export const Standard: Story = {
- args: {
- defaultValue: '2',
- },
render: (args) => (
- NHS.UK frontend option 1
- NHS.UK frontend option 2
-
- NHS.UK frontend option 3
-
+ Recently published
+ Recently updated
+ Most view
+ Most comments
),
};
export const SelectWithHintText: Story = {
args: {
- hint: 'Hint text goes here',
+ hint: 'This can be different to where you went before',
},
- render: (args) => (
-
- NHS.UK frontend option 1
- NHS.UK frontend option 2
- NHS.UK frontend option 3
-
- ),
};
export const SelectWithError: Story = {
- render: function SelectWithErrorRender(args) {
- const [error, setError] = useState('Error message goes here');
- return (
- <>
-
- NHS.UK frontend option 1
- NHS.UK frontend option 2
- NHS.UK frontend option 3
-
- setError(e.currentTarget.value)} value={error} />
- >
- );
+ args: {
+ error: 'Select a location',
},
-
- name: 'Select With Error (String)',
};
export const SelectWithErrorAndHintText: Story = {
args: {
- hint: 'Hint text goes here',
+ hint: 'This can be different to where you went before',
+ error: 'Select a location',
},
- render: function SelectWithErrorAndHintTextRender(args) {
- const [error, setError] = useState('Error message goes here');
- return (
- <>
-
- NHS.UK frontend option 1
- NHS.UK frontend option 2
- NHS.UK frontend option 3
-
- setError(e.currentTarget.value)} value={error} />
- >
- );
+};
+
+export const SelectWithDivider: Story = {
+ render: (args) => (
+
+ First name (A to Z)
+ First name (Z to A)
+
+ Last name (A to Z)
+ Last name (Z to A)
+
+ ),
+};
+
+export const SelectWithButton: Story = {
+ args: {
+ formGroupProps: {
+ afterInput: () => (
+
+ Search
+
+ ),
+ },
},
+};
- name: 'Select With Error and Hint (String)',
+export const SelectWithButtonAndError: Story = {
+ args: {
+ error: 'Select a location',
+ formGroupProps: {
+ afterInput: () => (
+
+ Search
+
+ ),
+ },
+ },
};
diff --git a/stories/Form Elements/TextInput.stories.tsx b/stories/Form Elements/TextInput.stories.tsx
index bfb6efff..4e66f1d0 100644
--- a/stories/Form Elements/TextInput.stories.tsx
+++ b/stories/Form Elements/TextInput.stories.tsx
@@ -1,5 +1,6 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { Button } from '#components/form-elements/button/Button.js';
import { TextInput } from '#components/form-elements/text-input/index.js';
const meta: Meta = {
@@ -7,8 +8,8 @@ const meta: Meta = {
component: TextInput,
args: {
id: 'input-example',
- name: 'test-name',
- label: 'National Insurance number',
+ name: 'example',
+ label: 'What is your full name?',
labelProps: { isPageHeading: true, size: 'l' },
},
argTypes: {
@@ -22,30 +23,127 @@ type Story = StoryObj;
export const Standard: Story = {};
export const WithHintText: Story = {
args: {
- hint: 'It’s on your National Insurance card, benefit letter, payslip or P60. For example, ‘QQ 12 34 56 C’.',
+ label: 'What is your NHS number?',
+ code: true,
+ inputMode: 'numeric',
+ spellCheck: false,
+ hint: (
+ <>
+ This is a 10 digit number (like 999 123 4567 ) that
+ you can find on an NHS letter, prescription or in the NHS App
+ >
+ ),
},
};
export const WithError: Story = {
args: {
- error: 'Error message goes here',
- hint: 'It’s on your National Insurance card, benefit letter, payslip or P60. For example, ‘QQ 12 34 56 C’.',
+ label: 'What is your NHS number?',
+ error: 'Enter NHS number',
+ code: true,
+ inputMode: 'numeric',
+ spellCheck: false,
+ },
+};
+
+export const WithErrorAndHintText: Story = {
+ args: {
+ label: 'What is your NHS number?',
+ error: 'Enter NHS number',
+ code: true,
+ inputMode: 'numeric',
+ spellCheck: false,
+ hint: (
+ <>
+ This is a 10 digit number (like 999 123 4567 ) that
+ you can find on an NHS letter, prescription or in the NHS App
+ >
+ ),
},
- name: 'With Error (String)',
};
export const WithWidthModifier: Story = {
args: {
+ label: 'What is your NHS number?',
width: 10,
- hint: 'It’s on your National Insurance card, benefit letter, payslip or P60. For example, ‘QQ 12 34 56 C’.',
+ code: true,
+ inputMode: 'numeric',
+ spellCheck: false,
+ hint: (
+ <>
+ This is a 10 digit number (like 999 123 4567 ) that
+ you can find on an NHS letter, prescription or in the NHS App
+ >
+ ),
+ },
+};
+
+export const WithPrefix: Story = {
+ args: {
+ label: 'Cost in pounds',
+ prefix: '£',
+ width: 5,
+ },
+};
+
+export const WithSuffix: Story = {
+ args: {
+ label: 'Weight in kilograms',
+ suffix: 'kg',
+ width: 5,
},
};
export const WithPrefixAndSuffix: Story = {
args: {
+ label: 'Cost per item, in pounds',
+ prefix: '£',
+ suffix: 'per item',
width: 5,
+ },
+};
+
+export const WithPrefixAndSuffixAndError: Story = {
+ args: {
label: 'Cost per item, in pounds',
+ error: 'Enter a cost per item, in pounds',
prefix: '£',
suffix: 'per item',
+ width: 5,
+ },
+};
+
+export const WithButton: Story = {
+ args: {
+ label: 'What is your NHS number?',
+ width: 10,
+ code: true,
+ inputMode: 'numeric',
+ spellCheck: false,
+ formGroupProps: {
+ afterInput: () => (
+
+ Search
+
+ ),
+ },
+ },
+};
+
+export const WithButtonAndError: Story = {
+ args: {
+ label: 'What is your NHS number?',
+ error: 'Enter NHS number',
+ width: 10,
+ code: true,
+ inputMode: 'numeric',
+ spellCheck: false,
+ formGroupProps: {
+ afterInput: () => (
+
+ Search
+
+ ),
+ },
},
};
diff --git a/stories/Navigation/Card.stories.tsx b/stories/Navigation/Card.stories.tsx
index da9d84e1..8313e237 100644
--- a/stories/Navigation/Card.stories.tsx
+++ b/stories/Navigation/Card.stories.tsx
@@ -2,7 +2,9 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { ChevronRightCircleIcon } from '#components/content-presentation/icons/individual/index.js';
+import { SummaryList } from '#components/content-presentation/summary-list/index.js';
import { Card } from '#components/navigation/card/index.js';
+import { BodyText } from '#components/typography/BodyText.js';
const meta: Meta = {
title: 'Navigation/Card',
@@ -16,7 +18,9 @@ export const Standard: Story = {
render: (args) => (
- If you need help now but it's not an emergency
+
+ If you need help now but it's not an emergency
+
Go to 111.nhs.uk or call 111
@@ -25,10 +29,7 @@ export const Standard: Story = {
),
};
-export const ClickableCard: Story = {
- args: {
- clickable: true,
- },
+export const BasicWithHeadingLink: Story = {
render: (args) => (
@@ -43,6 +44,66 @@ export const ClickableCard: Story = {
),
};
+export const BasicWithCustomHTML: Story = {
+ render: (args) => (
+
+
+ Help from NHS 111
+
+ If you're worried about a symptom and not sure what help you need, NHS 111 can tell
+ you what to do next.
+
+
+ Go to 111.nhs.uk or call 111 .
+
+ For a life-threatening emergency call 999.
+
+
+ ),
+};
+
+export const BasicWithSummaryList: Story = {
+ render: (args) => (
+
+
+ Help from NHS 111
+
+
+ Name
+ Karen Francis
+
+
+ Date of birth
+ 15 March 1984
+
+
+
+
+ ),
+};
+
+export const BasicWithSummaryListAndHeadingLink: Story = {
+ render: (args) => (
+
+
+
+ Help from NHS 111
+
+
+
+ Name
+ Karen Francis
+
+
+ Date of birth
+ 15 March 1984
+
+
+
+
+ ),
+};
+
export const CardWithImage: Story = {
args: {
clickable: true,
@@ -72,7 +133,7 @@ export const FeatureCard: Story = {
render: (args) => (
- Feature card heading
+ Feature card heading
Feature card description
@@ -86,7 +147,7 @@ export const FeatureCardWithList: Story = {
render: (args) => (
- Feature card heading
+ Feature card heading
AAA
@@ -111,16 +172,53 @@ export const PrimaryCardWithChevron: Story = {
render: (args) => (
-
- Primary card heading
+
+ Breast screening
- Primary card description
),
};
+export const PrimaryCardWithChevronAndDescription: Story = {
+ args: {
+ cardType: 'primary',
+ clickable: true,
+ },
+ render: (args) => (
+
+
+
+ Introduction to care and support
+
+
+ A quick guide for people who have care and support needs and their carers
+
+
+
+
+ ),
+};
+
+export const ClickableCard: Story = {
+ args: {
+ clickable: true,
+ },
+ render: (args) => (
+
+
+
+ Introduction to care and support
+
+
+ A quick guide for people who have care and support needs and their carers
+
+
+
+ ),
+};
+
export const SecondaryCard: Story = {
args: {
cardType: 'secondary',
@@ -129,10 +227,34 @@ export const SecondaryCard: Story = {
render: (args) => (
-
- Secondary card heading
+
+ Urgent and emergency care services
- Secondary card description
+
+ Services the NHS provides if you need urgent or emergency medical help
+
+
+
+ ),
+};
+
+export const SecondaryNonClickableWithCustomHTML: Story = {
+ args: {
+ cardType: 'secondary',
+ },
+ render: (args) => (
+
+
+
+ Why we are reinvesting in the NHS Prototype kit
+
+
+ Services the NHS provides if you need urgent or emergency medical help
+
+
+ Frankie and Mike explain why we revived the NHS prototype kit, the benefits of prototyping
+ in code and how digital teams in the NHS can get started using it.
+
),
@@ -206,7 +328,7 @@ export const NonUrgentCareCard: Story = {
},
render: (args) => (
- Speak to a GP if:
+ Speak to a GP if:
you're not sure it's chickenpox
@@ -231,7 +353,7 @@ export const UrgentCareCard: Story = {
},
render: (args) => (
- Ask for an urgent GP appointment if:
+ Ask for an urgent GP appointment if:
you're an adult and have chickenpox
@@ -259,7 +381,7 @@ export const EmergencyCareCard: Story = {
},
render: (args) => (
- Call 999 or go to A&E now if:
+ Call 999 or go to A&E now if:
you or someone you know needs immediate help
diff --git a/yarn.lock b/yarn.lock
index e789271d..34c403a2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -9008,10 +9008,10 @@ __metadata:
languageName: node
linkType: hard
-"nhsuk-frontend@npm:^10.1.0":
- version: 10.1.0
- resolution: "nhsuk-frontend@npm:10.1.0"
- checksum: 10c0/adf8ccc240c3514b865ae361b4e29f7ad11051f5c4585970cbd2580f61dbe5f1818d53f3b8eef3825aaf72f9ea3df647f4b0cc57d60092a3edc7583665374f91
+"nhsuk-frontend@npm:^10.2.2":
+ version: 10.2.2
+ resolution: "nhsuk-frontend@npm:10.2.2"
+ checksum: 10c0/19811214e56188204924a828780771a994ed9ed496c21fa90d49b46a58c1c500903a3b346229ab3df4ba8c67262f17b8fa05ec2c4c25582a4e5e84ec678ba059
languageName: node
linkType: hard
@@ -9058,7 +9058,7 @@ __metadata:
jest-axe: "npm:^10.0.0"
jest-environment-jsdom: "npm:^30.2.0"
lodash: "npm:^4.17.21"
- nhsuk-frontend: "npm:^10.1.0"
+ nhsuk-frontend: "npm:^10.2.2"
outdent: "npm:^0.8.0"
prettier: "npm:^3.7.4"
react: "npm:^19.2.3"
@@ -9074,7 +9074,7 @@ __metadata:
vite-tsconfig-paths: "npm:^6.0.1"
peerDependencies:
classnames: ">=2.5.0"
- nhsuk-frontend: ">=10.1.0 <11.0.0"
+ nhsuk-frontend: ">=10.2.0 <11.0.0"
react: ">=18.2.0"
react-dom: ">=18.2.0"
tslib: ">=2.8.0"