| 1 |
import { css } from '@patternfly/react-styles'; |
| 2 |
import styles from '@patternfly/react-styles/css/components/SimpleList/simple-list'; |
| 3 |
|
| 4 |
export interface SimpleListGroupProps extends Omit<React.HTMLProps<HTMLTableSectionElement>, 'title'> { |
| 5 |
/** Content rendered inside the SimpleList group */ |
| 6 |
children?: React.ReactNode; |
| 7 |
/** Additional classes added to the SimpleList <ul> */ |
| 8 |
className?: string; |
| 9 |
/** Additional classes added to the SimpleList group title */ |
| 10 |
titleClassName?: string; |
| 11 |
/** Title of the SimpleList group */ |
| 12 |
title?: React.ReactNode; |
| 13 |
/** ID of SimpleList group */ |
| 14 |
id?: string; |
| 15 |
} |
| 16 |
|
| 17 |
export const SimpleListGroup: React.FunctionComponent<SimpleListGroupProps> = ({ |
| 18 |
children = null, |
| 19 |
className = '', |
| 20 |
title = '', |
| 21 |
titleClassName = '', |
| 22 |
id = '', |
| 23 |
...props |
| 24 |
}: SimpleListGroupProps) => ( |
| 25 |
<section className={css(styles.simpleListSection)} {...props}> |
| 26 |
<h2 id={id} className={css(styles.simpleListTitle, titleClassName)} aria-hidden="true"> |
| 27 |
{title} |
| 28 |
</h2> |
| 29 |
<ul className={css('pf-v6-c-simple-list__list', className)} role="list" aria-labelledby={id}> |
| 30 |
{children} |
| 31 |
</ul> |
| 32 |
</section> |
| 33 |
); |
| 34 |
SimpleListGroup.displayName = 'SimpleListGroup'; |