Package Exports
- @autosmart/email-lib
- @autosmart/email-lib/dist/index.esm.js
- @autosmart/email-lib/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 (@autosmart/email-lib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Autosmart Email Template Library
A React library for managing email templates with edit and update functionality.
Features
- Email template list with search functionality
- Inline template editing
- Responsive design
- TypeScript support
- Storybook documentation
Installation
npm install autosmart-email-lib
# or
yarn add autosmart-email-libUsage
import React, { useState } from 'react';
import { EmailTemplateList } from 'autosmart-email-lib';
import 'autosmart-email-lib/dist/styles.css';
const App = () => {
const [templates, setTemplates] = useState([
{
id: '1',
name: 'Welcome Email',
subject: 'Welcome to Our Service',
preview: 'Dear [Customer Name], Welcome to our service!',
},
]);
const handleEdit = (updatedTemplate) => {
setTemplates(templates.map(t =>
t.id === updatedTemplate.id ? updatedTemplate : t
));
};
const handleDelete = (templateId) => {
setTemplates(templates.filter(t => t.id !== templateId));
};
return (
<EmailTemplateList
templates={templates}
onEdit={handleEdit}
onDelete={handleDelete}
/>
);
};
export default App;Props
EmailTemplateList
| Prop | Type | Required | Description |
|---|---|---|---|
| templates | Array | Yes | Array of template objects |
| onEdit | Function | Yes | Callback when a template is edited |
| onDelete | Function | Yes | Callback when a template is deleted |
EmailTemplateEditor
| Prop | Type | Required | Description |
|---|---|---|---|
| template | Object | Yes | Template object to edit |
| onSave | Function | Yes | Callback when template is saved |
| onCancel | Function | Yes | Callback when editing is cancelled |
Development
# Install dependencies
npm install
# Run storybook
npm run storybook
# Build the library
npm run buildLicense
MIT