| 1 |
import { MenuGroup, MenuItem } from '@wordpress/components'; |
| 2 |
import { __ } from '@wordpress/i18n'; |
| 3 |
import { pencil } from '@wordpress/icons'; |
| 4 |
|
| 5 |
export const DraftMenu = ({ disabled, setInputText, setReady }) => { |
| 6 |
const handleClick = (inputText) => { |
| 7 |
setInputText(inputText); |
| 8 |
setReady(false); |
| 9 |
}; |
| 10 |
|
| 11 |
const actionsList = [ |
| 12 |
{ |
| 13 |
label: __('A paragraph …', 'extendify-local'), |
| 14 |
onClickText: __('Write a paragraph about', 'extendify-local'), |
| 15 |
}, |
| 16 |
{ |
| 17 |
label: __('Blog post …', 'extendify-local'), |
| 18 |
onClickText: __('Write a blog post about', 'extendify-local'), |
| 19 |
}, |
| 20 |
{ |
| 21 |
label: __('An informative article …', 'extendify-local'), |
| 22 |
onClickText: __('Write an informative article about', 'extendify-local'), |
| 23 |
}, |
| 24 |
{ |
| 25 |
label: __('Headline …', 'extendify-local'), |
| 26 |
onClickText: __('Write a headline for', 'extendify-local'), |
| 27 |
}, |
| 28 |
{ |
| 29 |
label: __('List …', 'extendify-local'), |
| 30 |
onClickText: __('Write a list of', 'extendify-local'), |
| 31 |
}, |
| 32 |
]; |
| 33 |
|
| 34 |
return ( |
| 35 |
<MenuGroup> |
| 36 |
{actionsList.map(({ label, onClickText }) => ( |
| 37 |
<MenuItem |
| 38 |
key={label} |
| 39 |
onClick={() => handleClick(`${onClickText} `)} |
| 40 |
disabled={disabled} |
| 41 |
icon={pencil} |
| 42 |
iconPosition="left"> |
| 43 |
{label} |
| 44 |
</MenuItem> |
| 45 |
))} |
| 46 |
</MenuGroup> |
| 47 |
); |
| 48 |
}; |
| 49 |
|