-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
component.tsx
58 lines (53 loc) · 1.18 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import { Separator } from 'reakit';
import type { ForwardedRef } from 'react';
/**
* Internal dependencies
*/
import {
contextConnect,
useContextSystem,
WordPressComponentProps,
} from '../ui/context';
import { DividerView } from './styles';
import type { Props } from './types';
function UnconnectedDivider(
props: WordPressComponentProps< Props, 'hr', false >,
forwardedRef: ForwardedRef< any >
) {
const contextProps = useContextSystem( props, 'Divider' );
return (
<Separator
as={ DividerView }
{ ...contextProps }
ref={ forwardedRef }
/>
);
}
/**
* `Divider` is a layout component that separates groups of related content.
*
* @example
* ```js
* import {
* __experimentalDivider as Divider,
* __experimentalText as Text,
* __experimentalVStack as VStack,
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <VStack spacing={4}>
* <Text>Some text here</Text>
* <Divider />
* <Text>Some more text here</Text>
* </VStack>
* );
* }
* ```
*/
export const Divider = contextConnect( UnconnectedDivider, 'Divider' );
export default Divider;