-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathcomponent.tsx
42 lines (37 loc) · 1018 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
41
42
/**
* External dependencies
*/
import type { ForwardedRef } from 'react';
/**
* Internal dependencies
*/
import { contextConnect, WordPressComponentProps } from '../../ui/context';
import { Divider, DividerProps } from '../../divider';
import { useCardDivider } from './hook';
function CardDivider(
props: WordPressComponentProps< DividerProps, 'hr', false >,
forwardedRef: ForwardedRef< HTMLHRElement >
) {
const dividerProps = useCardDivider( props );
return <Divider { ...dividerProps } ref={ forwardedRef } />;
}
/**
* `CardDivider` renders an optional divider within a `Card`.
* It is typically used to divide multiple `CardBody` components from each other.
*
* @example
* ```jsx
* import { Card, CardBody, CardDivider } from `@wordpress/components`;
*
* <Card>
* <CardBody>...</CardBody>
* <CardDivider />
* <CardBody>...</CardBody>
* </Card>
* ```
*/
const ConnectedCardDivider = contextConnect< DividerProps >(
CardDivider,
'CardDivider'
);
export default ConnectedCardDivider;