-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathcomponent.tsx
40 lines (36 loc) · 922 Bytes
/
component.tsx
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
37
38
39
40
/**
* Internal dependencies
*/
import { contextConnect, WordPressComponentProps } from '../../ui/context';
import { Flex } from '../../flex';
import { useCardHeader } from './hook';
import type { HeaderProps } from '../types';
/**
* External dependencies
*/
import type { ForwardedRef } from 'react';
function CardHeader(
props: WordPressComponentProps< HeaderProps, 'div' >,
forwardedRef: ForwardedRef< HTMLDivElement >
) {
const headerProps = useCardHeader( props );
return <Flex { ...headerProps } ref={ forwardedRef } />;
}
/**
* `CardHeader` renders an optional header within a `Card`.
*
* @example
* ```jsx
* import { Card, CardBody, CardHeader } from `@wordpress/components`;
*
* <Card>
* <CardHeader>...</CardHeader>
* <CardBody>...</CardBody>
* </Card>
* ```
*/
const ConnectedCardHeader = contextConnect< HeaderProps >(
CardHeader,
'CardHeader'
);
export default ConnectedCardHeader;