Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hapi-maily-widgets

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-maily-widgets

Email MJML widgets used by hapi-maily and other email services

  • 1.1.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Hapi Maily Email Widgets

A collection of email widgets for use with MJML

Basic Usage

Install Widgets

yarn add hapi-maily-widgets

Usage

import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import { Footer, renderMJML } from 'header';

const emailComponent = renderMJML(<Footer />);
const staticEmail = renderToStaticMarkup(emailComponent);

console.log(staticEmail); // Static HTML email

Available Components

Preview available widgets in react storybook, each story item needs to be served through renderMJML in order to convert mjml into valid HTML markup.

View Storybook of Components

Theming

You are able to customize the look of the mail components by passing a theme property to the renderMJML method.

The structure of the theme should be as follows

const theme = {
    colors: {
        primary: '#E91E63'
        // you can use additional colors
        // below, so long as it is
        // string: 'HEX'
    },
    headerImage: {
        src: 'url to hosted image',
        alt: 'alt text describing image'
    }
}

Then you can simply call the renderMJML method with your components.

import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import { Button, renderMJML } from 'header';

const theme = {
    colors: {
        primary: '#03A9F4',
        secondary: '#009688',
        paul: '#8BC34A'
    }
};

const buttonComponent = (
    <Button
        url="http://google.com"
        buttonType="paul"
    >
        Hi Im Paul!
    </Button>
)

const emailComponent = renderMJML(buttonComponent, theme);
const staticEmail = renderToStaticMarkup(emailComponent);

console.log(staticEmail); // Static Themed HTML email

Contributing

Available Commands

yarn start

Generates the email widgets in storybook mode. Open http://localhost:9009 to view it in the browser.

Read more about storybook

yarn lint

Runs the linting command, should be done before pull requests are made. This application follows the airbnb linting styleguide with minor changes.

Read more about the styleguide

FAQs

Package last updated on 29 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc