-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathSummaryList.tsx
More file actions
36 lines (31 loc) · 886 Bytes
/
SummaryList.tsx
File metadata and controls
36 lines (31 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import classNames from 'classnames';
import { type ComponentPropsWithoutRef, forwardRef } from 'react';
import {
SummaryListAction,
SummaryListKey,
SummaryListRow,
SummaryListValue,
} from './components/index.js';
export interface SummaryListProps extends ComponentPropsWithoutRef<'dl'> {
noBorder?: boolean;
}
const SummaryListComponent = forwardRef<HTMLDListElement, SummaryListProps>(
({ className, noBorder, ...rest }, forwardedRef) => (
<dl
className={classNames(
'nhsuk-summary-list',
{ 'nhsuk-summary-list--no-border': noBorder },
className,
)}
ref={forwardedRef}
{...rest}
/>
),
);
SummaryListComponent.displayName = 'SummaryList';
export const SummaryList = Object.assign(SummaryListComponent, {
Row: SummaryListRow,
Key: SummaryListKey,
Value: SummaryListValue,
Action: SummaryListAction,
});