-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e15fad
commit 0633b6d
Showing
1 changed file
with
98 additions
and
0 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
packages/block-editor/src/components/inspector-popover-header/stories/index.story.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Dropdown, Button } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import InspectorPopoverHeader from '../'; | ||
|
||
const meta = { | ||
title: 'BlockEditor/InspectorPopoverHeader', | ||
component: InspectorPopoverHeader, | ||
parameters: { | ||
docs: { | ||
canvas: { sourceState: 'shown' }, | ||
description: { | ||
component: | ||
'Renders a header that is suitable for use in an inspector sidebar popover.', | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
title: { | ||
control: { type: 'string' }, | ||
description: 'Title to display in the header.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
actions: { | ||
control: { type: null }, | ||
table: { | ||
type: { summary: 'array' }, | ||
}, | ||
description: | ||
'Array of actions to display in the header as a row of buttons.', | ||
}, | ||
onClose: { | ||
control: { type: null }, | ||
description: | ||
'Function called when the user presses the close button.', | ||
table: { | ||
type: { | ||
summary: 'function', | ||
}, | ||
}, | ||
}, | ||
help: { | ||
control: { type: 'string' }, | ||
description: 'Help text to display at the bottom of the header..', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const Template = ( args ) => { | ||
return ( | ||
<Dropdown | ||
renderToggle={ ( { isOpen, onToggle } ) => ( | ||
<Button onClick={ onToggle } aria-expanded={ isOpen }> | ||
Select post date | ||
</Button> | ||
) } | ||
renderContent={ ( { onClose } ) => ( | ||
<> | ||
<InspectorPopoverHeader | ||
title={ args.title } | ||
actions={ args.actions } | ||
onClose={ onClose } | ||
/> | ||
Place form for editing post date here. | ||
</> | ||
) } | ||
/> | ||
); | ||
}; | ||
|
||
export const Default = { | ||
render: Template, | ||
args: { | ||
title: 'Post date', | ||
actions: [ | ||
{ | ||
label: 'Reset ', | ||
onClick: () => {}, | ||
}, | ||
], | ||
}, | ||
}; |