-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathcomponent.tsx
53 lines (48 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
/**
* External dependencies
*/
import * as Ariakit from '@ariakit/react';
import type { ForwardedRef } from 'react';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../context';
import { contextConnect, useContextSystem } from '../context';
import { DividerView } from './styles';
import type { DividerProps } from './types';
function UnconnectedDivider(
props: WordPressComponentProps< DividerProps, 'hr', false >,
forwardedRef: ForwardedRef< any >
) {
const contextProps = useContextSystem( props, 'Divider' );
return (
<Ariakit.Separator
render={ <DividerView /> }
{ ...contextProps }
ref={ forwardedRef }
/>
);
}
/**
* `Divider` is a layout component that separates groups of related content.
*
* ```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;