-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathcomponent.tsx
41 lines (36 loc) · 923 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
/**
* External dependencies
*/
import type { ForwardedRef } from 'react';
/**
* Internal dependencies
*/
import { contextConnect, WordPressComponentProps } from '../../ui/context';
import { Flex } from '../../flex';
import { useCardFooter } from './hook';
import type { FooterProps } from '../types';
function CardFooter(
props: WordPressComponentProps< FooterProps, 'div' >,
forwardedRef: ForwardedRef< HTMLDivElement >
) {
const footerProps = useCardFooter( props );
return <Flex { ...footerProps } ref={ forwardedRef } />;
}
/**
* `CardFooter` renders an optional footer within a `Card`.
*
* @example
* ```jsx
* import { Card, CardBody, CardFooter } from `@wordpress/components`;
*
* <Card>
* <CardBody>...</CardBody>
* <CardFooter>...</CardFooter>
* </Card>
* ```
*/
const ConnectedCardFooter = contextConnect< FooterProps >(
CardFooter,
'CardFooter'
);
export default ConnectedCardFooter;