crosslead-notification-email
v0.0.15
Published
crosslead-notification-email
Downloads
17
Readme
crosslead-notification-email
This package is used by the CrossLead Platform to render notifications into html emails.
An (incomplete) set of stateless React components is exported,
each of which has its own props objects.
A renderMail function is exported that embeds a resulting
React.Element
into a complete HTML document.
Example usage:
const props = {...};
renderMail(UserAdded(props));
Each component also has a corresponding 'core' component, eg.,
UserAddedCore
These components only provide the core of the body, and not the header and footer. They are used when the desired output is an aggregation of components, the single current example of which is the ``NotificationDigest``` component, the props object of which accepts arrays of already-rendered 'core' components.
This package also provides a command line interface via a 'main' script.
Example usages:
Generate an email for the given component:
$ npm run main -- --generate --<component> --out=<component>.html;
Generate an email for the given component and send it out via email:
$ npm run main -- --generate --<component> --user=<SMTP User>
--pass=<Base64 encoded SMTP password> --email=<Destination Email Address>;
As a development aid, main is also able to extract styles that have
been scraped from a 'Sketch Site'.
If you look at index.html in such a site, you'll find a gob of data
being passed to an SMApp function.
Pull that data out into a json file.
Each artboard in the site has its own section in the data.
A given artboard is a collection of layers; each layer gets its own
styling information.
The following command will extract the styles of artboard 0 into a javascript module
containing typestyle-style styles of named STYLE${n}
, where n is the
layer id.
This module can then be incorporated into tsx code that needs those
styles.
Obviously, it is recommended to rename those symbols to something more semantic.
$ npm run main -- --extractStyles --datafile= --artboard=0 --out=foo.styles.ts