-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
index.js
51 lines (49 loc) · 1.5 KB
/
index.js
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
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { PanelRow, Dropdown, Button } from '@wordpress/components';
import { withInstanceId } from '@wordpress/compose';
import { PostSchedule as PostScheduleForm, PostScheduleLabel, PostScheduleCheck } from '@wordpress/editor';
import { Fragment } from '@wordpress/element';
export function PostSchedule( { instanceId } ) {
return (
<PostScheduleCheck>
<PanelRow className="edit-post-post-schedule">
<label
htmlFor={ `edit-post-post-schedule__toggle-${ instanceId }` }
id={ `edit-post-post-schedule__heading-${ instanceId }` }
>
{ __( 'Publish' ) }
</label>
<Dropdown
position="bottom left"
contentClassName="edit-post-post-schedule__dialog"
renderToggle={ ( { onToggle, isOpen } ) => (
<Fragment>
<label
className="edit-post-post-schedule__label"
htmlFor={ `edit-post-post-schedule__toggle-${ instanceId }` }
>
<PostScheduleLabel /> { __( 'Click to change' ) }
</label>
<Button
id={ `edit-post-post-schedule__toggle-${ instanceId }` }
type="button"
className="edit-post-post-schedule__toggle"
onClick={ onToggle }
aria-expanded={ isOpen }
aria-live="polite"
isLink
>
<PostScheduleLabel />
</Button>
</Fragment>
) }
renderContent={ () => <PostScheduleForm /> }
/>
</PanelRow>
</PostScheduleCheck>
);
}
export default withInstanceId( PostSchedule );