1.0.1 • Published 4 months ago
aime-workflow-feedback2 v1.0.1
Workflow Feedback NPM Package
This NPM package provides a WorkflowContainer
component for managing feedback in your projects.
Installation
To install the package, run the following command:
# npm
npm install workflow-container-package
# or yarn
yarn add workflow-container-package
Usage
Import the WorkflowContainer
component and use it in your React project. Here is an example of how to use the
WorkflowContainer component in your project.
//App.tsx
import React from 'react';
import {WorkflowContainer} from 'workflow-container-package';
const App: React.FC = () => {
// Define callback functions
const handleSave = (data: any) => {
console.log('Save action');
};
const handleCancel = () => {
console.log('Cancel action');
};
const handleDelete = () => {
console.log('Delete action');
};
const handleUpdate = (data: any) => {
console.log('Update action');
};
return (
<WorkflowContainer
projectID={123}
projectName={"Test Project"}
onSave={handleSave}
onCancel={handleCancel}
onDelete={handleDelete}
onUpdate={handleUpdate}
/>
);
};
export default App;
Props
Prop | Type | Description |
---|---|---|
projectID | number | The ID of the project. |
projectName | string | The name of the project. |
onSave | function | Callback function for the save action. |
onCancel | function | Callback function for the cancel action. |
onDelete | function | Callback function for the delete action. |
onUpdate | function | Callback function for the update action. |
dataToPreview? | any | Existing data that can be previewed |
Updating content
In order to preview and update existing content, you can pass in the existing data to the dataToPreview
prop. This
will allow the user to preview the existing data and update it if needed. The WorkflowContainer component will
automatically detect if the dataToPreview
prop is passed in and will display the filled form fields and canvas content
if any.
...
/* Existing data from db */
const data = fetch("endpoint")
return (
<WorkflowContainer
projectID={123}
projectName={"Test Project"}
onSave={handleSave}
onCancel={handleCancel}
onDelete={handleDelete}
onUpdate={handleUpdate}
dataToPreview={data}
/>
)