1- import React from 'react' ;
21import { Action } from '@siren-js/core' ;
2+ import React from 'react' ;
3+ import withFn , { withPreventDefault } from '../../../with' ;
4+ import { Panel } from '../../util' ;
35import ActionFormModal from './ActionFormModal' ;
46
57export default class ActionsPanel extends React . Component <
@@ -26,20 +28,19 @@ export default class ActionsPanel extends React.Component<
2628
2729 render ( ) {
2830 return (
29- < article className = "panel is-info" >
30- < p className = "panel-heading" > Actions</ p >
31+ < Panel title = "Actions" >
3132 { this . props . actions . map ( ( action , index ) => (
3233 < React . Fragment key = { index } >
3334 < ActionPanelBlock action = { action } onClick = { this . activate } />
3435 < ActionFormModal
3536 active = { this . state . activeModal === action . name }
3637 action = { action }
3738 onClose = { this . deactivate }
38- onSubmit = { this . props . onSubmit }
39+ onSubmit = { withFn ( this . props . onSubmit , this . deactivate ) }
3940 />
4041 </ React . Fragment >
4142 ) ) }
42- </ article >
43+ </ Panel >
4344 ) ;
4445 }
4546}
@@ -57,10 +58,7 @@ const ActionPanelBlock = ({ action, onClick }: ActionPanelBlockProps) => (
5758 < a
5859 href = "/#"
5960 className = "panel-block"
60- onClick = { ( e ) => {
61- e . preventDefault ( ) ;
62- onClick ( action . name ) ;
63- } }
61+ onClick = { withPreventDefault ( ( ) => onClick ( action . name ) ) }
6462 >
6563 < span className = "panel-icon" >
6664 < i className = "fas fa-file-alt" aria-hidden = "true" > </ i >
0 commit comments