1.0.1 • Published 1 year ago

react-crud-buttons v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-action-buttons

View, Edit, Delete And Comment buttons for react apps

NPM JavaScript Style Guide

Install

npm install --save react-action-buttons

rendered

react action buttons

Usage

import ActionButtons from 'react-action-buttons';
import 'react-action-buttons/dist/index.css'

function App() {
  return (
    <div className="App">
      <ActionButtons
        data={{name: '', lastName: ''}} 
        viewPermission={true}
        commentPermission={true}
        deletePermission={true}
        updatePermission={true}
        claimPermission={true}

        styles={{
          view: {
            backgroundColor: 'blue'
          },
          delete: {
            backgroundColor: 'red'
          },
          comment: {
            backgroundColor: '#90EE90'
          }
        }}

        onClickView={(data) => console.log('clicked View', data)}
        onClickClaim={(data) => console.log('clicked Claim', data)}
        onClickUpdate={(data) => console.log('clicked Update', data)}
        onClickComment={(data) => console.log('clicked Comment', data)}
        onClickDelete={(data) => console.log('clicked delete', data)}
      />
    </div>
  );
}

export default App;

props

NametypeRequiredDefaultValue
onClickViewfunctionfalseundefined
onClickUpdatefunctionfalseundefined
onClickDeletefunctionfalseundefined
onClickCommentfunctionfalseundefined
viewClassNamestringfalse''
updateClassNamestringfalse''
deleteClassNamestringfalse''
commentClassNamestringfalse''
veiwPermissionbooleanfalseundefined
updatePermissionbooleanfalseundefined
deletePermissionbooleanfalseundefined
commentPermissionbooleanfalseundefined
dataanyfalseundefined
stylesObjectfalseundefined

data object is return to the onClick functions. And styles must be passed with keys of delete, update, view and edit each containing its styles.

License

MIT © H5SH

1.0.1

1 year ago

1.0.0

1 year ago