Package Exports
- @mpsinc/task-component
- @mpsinc/task-component/dist/index.esm.js
- @mpsinc/task-component/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mpsinc/task-component) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React Task Component
A flexible and responsive React component for displaying task cards with time tracking and status management capabilities.
Installation
npm install @mpsinc/task-componentFeatures
- 📊 Task status visualization
- ⏱️ Time tracking and formatting
- 🎨 Customizable color schemes
- 📱 Responsive design
- ✨ Markdown support for task descriptions
- 🔄 Action buttons for task management
Usage
Basic Implementation
import { TaskComponent } from 'react-task-component';
const taskColors = {
backlog: {
background: '#f5f5f5',
font: '#333333'
},
planned: {
background: '#e3f2fd',
font: '#1976d2'
},
closed: {
background: '#e8f5e9',
font: '#2e7d32'
}
};
const task = {
id: 1,
title: "Complete Project Documentation",
description: "Write comprehensive documentation for the project including:\n" +
"- Setup instructions\n" +
"- API endpoints\n" +
"- Usage examples",
estimated_time: 120, // in minutes
anticipated_start_time: "14:00",
anticipated_end_time: "16:00",
remaining_time: 45, // in minutes
status: "planned"
};
function App() {
return (
<TaskComponent
task={task}
taskColors={taskColors}
backgroundColor="#ffffff"
/>
);
}Props
| Prop | Type | Required | Description |
|---|---|---|---|
| task | Object | Yes | Task data object |
| taskColors | Object | Yes | Color schemes for different task statuses |
| backgroundColor | String | Yes | Background color for the component |
| className | String | No | Additional CSS classes |
Task Object Structure
{
id: number; // Unique identifier for the task
title: string; // Task title
description: string; // Markdown-supported description
estimated_time: number; // Duration in minutes
anticipated_start_time?: string; // Format: "HH:mm"
anticipated_end_time?: string; // Format: "HH:mm"
remaining_time: number; // Minutes remaining
status: "backlog" | "planned" | "closed";
}Color Scheme Structure
{
backlog: {
background: string; // CSS color value
font: string; // CSS color value
},
planned: {
background: string; // CSS color value
font: string; // CSS color value
},
closed: {
background: string; // CSS color value
font: string; // CSS color value
}
}Styling
The component comes with default styling, but you can override it by targeting the following CSS classes:
.task-card- Main container.task-main- Title and controls section.task-controls- Action buttons container.task-metadata- Task information section.task-description- Markdown content area.start-button- Start action button.complete-button- Complete action button
Time Formatting
- Remaining time is automatically formatted:
- Less than 1 hour: "45 min"
- More than 1 hour: "2h 15m"
- Negative time: "-45 min" or "-2h 15m"
Markdown Support
The description field supports Markdown syntax through react-markdown. Example:
# Heading
- List item 1
- List item 2
**Bold text** and *italic text*
## Subheading
1. Numbered list
2. Another item
> This is a blockquote
[Link example](https://example.com)Dependencies
- React 16.8.0 or higher
- react-markdown
- prop-types
Development
- Clone the repository
git clone https://github.com/yourusername/react-task-component.git - Install dependencies
npm install- Run the development server
npm start- Build the component
npm run buildContributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT License - see the LICENSE.md file for details
Support
For support, email support@example.com or open an issue in the GitHub repository.
Publishing to NPM
- Update version in
package.json
npm version patch # for bug fixes
npm version minor # for new features
npm version major # for breaking changes- Build the component
npm run build- Login to npm (if not already logged in)
npm login- Publish the package
npm publish --access publicNote: For scoped packages (@mpsinc/task-component), make sure you have the correct permissions and use --access public for the first publication.
Key points to remember:
- Always test your build locally before publishing
- Use semantic versioning (major.minor.patch)
- Make sure your dist folder is included in the package but src is not
- Include all necessary peer dependencies in your package.json
- Test the published package in a new project before announcing the release
- After publishing, you can test your package by creating a new React project and installing it:
npx create-react-app test-app
cd test-app
npm install @mpsinc/task-component