@busy-bee/emails
v4.1.124
Published
This library is for creating reusable, testable components and email templates using React.
Downloads
1,889
Readme
Overview
This library is for creating reusable, testable components and email templates using React.
Develop
Setup
- Open a terminal
- Clone git repository
- Go into repository dir
- Install root dependencies
npm install - Start storybook
npm run storybookornpm start
Storybook
Check this page to read more about storybook: https://storybook.js.org/
Folder structure
.circleci: CircleCI configuration..storybook: Storybook configuration.src_snapshots_: Snapshot files for test.components: Small components like header, footer, dashboard.customComponents: Email layout components.emailComponents: Rendered HTML email files.emailStrings: String files of rendered HTML emails fromemailComponentsfolder. This is the final result that will be returned.
Dependencies
Adding a new email
- Create a folder and create a new index.js and stories.js file in
EmailComponentsfolder. If there's any components already created incomponentsfolder, use them. Or create your own component. Main style guide and variables are in the/styleGuide.jsfile. - Once you created email, import it from
EmailStringsfolder. - Create an test file in the same folder.
- Add an export function to
src/index.jsfile. npm testto check if it's all good.
Test
- Functional test:
npm test
Publish
npm version major | minor | patchto update version.git push --tagsand then the CircleCI will kindly test, build, and publish the package for you.- If you didn't receive any error message, then hooray! Skull your beer! 🍺
Usage
- Install npm package via npm:
npm install @busy-bee/emails - Import an email rendering function
import { stringOfResetPasswordEmail } from @busy-bee/emails - Send appropriate data when you execute a function. Props are mandatory, Options are optional.
- If the data/props is appropriate, you'll get a string of rendered email as return. Otherwise, you're get a ruthless error as return.
Test email rendering https://testi.at
Examples
import { stringOfResetPasswordEmail } from @busy-bee/emails;
const props = {
firstName: 'Caroline',
passwordToken: 'https://resetpassword.com/'
};
stringOfResetPasswordEmail(props);