All Projects → Saifadin → postonents

Saifadin / postonents

Licence: other
React meets Emails | ⚛️ x 📧= 🔥

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to postonents

React Uploady
Modern file uploading - components & hooks for React
Stars: ✭ 372 (+313.33%)
Mutual labels:  components, ssr
Razzle Material Ui Styled Example
Razzle Material-UI example with Styled Components using Express with compression
Stars: ✭ 117 (+30%)
Mutual labels:  react-dom, ssr
React Async Bootstrapper
Execute a bootstrap method on your React/Preact components. Useful for data prefetching and other activities.
Stars: ✭ 113 (+25.56%)
Mutual labels:  react-dom, ssr
Aleph.js
The Full-stack Framework in Deno.
Stars: ✭ 3,448 (+3731.11%)
Mutual labels:  components, ssr
ng-sq-ui
Flexible and easily customizable UI-kit for Angular 11+
Stars: ✭ 99 (+10%)
Mutual labels:  components
questdb.io
The official QuestDB website, database documentation and blog.
Stars: ✭ 75 (-16.67%)
Mutual labels:  ssr
gbkel-portfolio
💎 My personal website that's mainly powered by Next.js, my own style guide and a lot of other technologies.
Stars: ✭ 12 (-86.67%)
Mutual labels:  ssr
vue-if-bot
Hide stuff from bots (especially cookie consents)
Stars: ✭ 62 (-31.11%)
Mutual labels:  ssr
taiga-ui
Angular UI Kit and components library for awesome people
Stars: ✭ 2,251 (+2401.11%)
Mutual labels:  components
get subscribe
✈️ 免费机场 / 免费VPN -> 自动获取免 clash/v2ray/trojan/sr/ssr 订阅链接,间隔12小时持续更新 | 科学上网 | 翻墙
Stars: ✭ 1,512 (+1580%)
Mutual labels:  ssr
blog-frontend
Frontend of blog created using: GraphQL (Apollo) + Vue + Nuxt.js + TypeScript + Vuetify...
Stars: ✭ 43 (-52.22%)
Mutual labels:  ssr
TD-Fancy-Frustum
TouchDesigner components
Stars: ✭ 26 (-71.11%)
Mutual labels:  components
react16-seed-with-apollo-graphql-scss-router4-ssr-tests-eslint-prettier-docker-webpack3-hot
Seed to create your own project using React with Apollo GraphQL client
Stars: ✭ 19 (-78.89%)
Mutual labels:  ssr
DaProfiler
DaProfiler allows you to create a profile on your target based in France only. The particularity of this program is its ability to find the e-mail addresses your target.
Stars: ✭ 58 (-35.56%)
Mutual labels:  emails
react-tailwind
This is a complementary React code for the tailwindcss project.
Stars: ✭ 29 (-67.78%)
Mutual labels:  components
React-SSR-Congfigration
react-SSR && HMR configration
Stars: ✭ 44 (-51.11%)
Mutual labels:  ssr
sleek
A toolbelt for building your next user interface
Stars: ✭ 14 (-84.44%)
Mutual labels:  components
giog
It's based on githud issues and built with Vue 2.x, vue-router & vuex with server-side rendering by koa
Stars: ✭ 14 (-84.44%)
Mutual labels:  ssr
used-styles
📝All the critical styles you've used to render a page.
Stars: ✭ 100 (+11.11%)
Mutual labels:  ssr
awrora-starter
Landing page template built with one of most popular javascript library Vue.JS, Vuetify (Material Design) and Nuxt.JS with SSR.
Stars: ✭ 38 (-57.78%)
Mutual labels:  ssr

Postonent

A simple UI library for light-weight, highly customizable Email components. Remove the pain of writing emails, by writing the templates in React, then SSR them and pass the generated HTML to the Backend to send it out.

npm version contributions welcome blazing

Installation

To start with postonents install:

yarn add postonents
// or
npm install --save postonents

Simple nodeJS setup

To add postonents to a nodeJS application also add install react and react-dom.

yarn add react react-dom
// or
npm install --save react react-dom

This will allow you to write something like this to generate an html string that can be provided to services like sendinblue or mandrill.

import React from 'react';
import { renderHtml, Email, PostonentsProvider, Header } from 'postonents';

const Email = ({ email }) => (
  <PostonentsProvider>
    <Email title={`Verification email for ${email}`}>
      <Header logo="https://assets.airbnb.com/press/logos/NBC%20Logo.gif" logoHeight={50} style={{ marginBottom: 24 }} />
    </Email>
  </PostonentsProvider>
);

const getHtml = async () => {
  const html = await renderHtml(Email, { email: '[email protected]' });

  return html;
};

// Now you can send the email with any email client library/service

Components included

Included in this package are the following components:

  • Template: The Wrapper component, that generates the <html>, <head> and <body> tags with many customization possibilities like adding scripts and global styles.
  • Container: Component to generally wrap Rows. By default a max of 600px wide. (for the reason why see here)
  • Row: Each row has 12 possible Columns, that wrap, if they are too big.
  • Column: A Column for content separation, can be customized for small (<600px) and large (>=600px).
  • Text: Component to display and style text content.
  • Link: Component to display and style links (a tag). Can have the look of a link, a primary button and a hollow button.
  • Image: Component for images. Needs a src and either height or width definition.
  • Header, Footer: Two Layout Components for Layouting
  • FullWidth: Basically a Container and a Row. For layouting on the top level, if different backgroundColors are wanted.
  • PostonentsProvider, PostonentsConsumer and PostonentContext: Multiple possible ways to access or change the internal Context for styling components.
  • renderHtml: A function that server-side renders your template and returns it as a string.

Component API

All components generally have a children, a className and a style prop and this will be applied to the element that has the styling for easy overrides and customization

Template

Prop type required description
lang string yes Will be added to the html tag
title string yes The title of the email
headAdditions array<{ type, children?, props? }> no Needs to be an array, with a type (eg. link), props and maybe children, internally we do React.createElement
headStyles string no Styles in the head tag, will automatically be wrapped in <styles type="text/css>
bodyStyle object no will be added to the styles of the body tag

Container

Prop type required description
alignment string no Pass center here to make sure the Container is centered and not left-aligned
maxWidth number | string no (defaults to 600) Will set the max-width of the whole container

Column

Prop type required description
small number no (defaults to 12) The column count from 1 to 12 for screens under 600px
large number no (defaults to small) The column count from 1 to 12 for screens above 600px
noPadding boolean no Will remove the padding of the column

Link

Prop type required description
href string yes Target of the link
type enum no (defaults to 'link') Can be 'link', 'primary' or 'hollow'
fullWidth boolean no Makes the Link expand to the fullest

Image

Prop type required description
src string yes The source of the image
height number no The height of the image
width number no The width of the image

Header

Prop type required description
logo string no src of log, if passed will render a logo horizontally centered at the top of the email
title string no if passed, will render the title, right under the logo.
children Node no For custom styling you can pass whatever you want

renderHtml(Template, emailData, headStyles)

Argument type required description
Template Node yes The Template Component
emailData object no emailData will be spread as props to the uppermost component in your tree
headStyles string no For global styling you can pass styles that go into the head here

Theming

If you do not have special and custom styling purposes, the default theme will be more than enough. But if you would like some more control, this is the theme that can be overriden, by passing it as a theme prop to PostonentsProvider, that need to be the first element:

<PostonentsProvider theme={{ ... }}>
  <Template>
    ...
  </Template>
</PostonentsProvider>

This is the current theme, it may be extended in the future.

const DefaultTheme = {
  colors: {
    text: '#4c5b5c', // Txxt Color
    bodyBg: '#fafafa', // Background Color of `body`
    footerBg: '#4c5b5c', // Background Color of footer
    footerText: 'white', // Text Color of Footer
    primaryBg: '#6699cc', // Background Color of primary button
    primary: 'white', // text color of primary button
    hollow: '#4c5b5c', // text color and border color of hollow button
  },
  typo: {
    fontFamily: 'Helvetica, sans-serif', // Font family
    fontSize: '14px', // Font Size
    lineHeight: '24px', // line height
    light: 300, // definition for light font weight
    normal: 400, // definition for normal font weight
    bold: 600, // definition for bold font weight
  },
};

Examples

Examples will be added regularly and will be visible on Github Pages

FAQs

My columns are not showing up after sending them out

This happens a lot with Mandrill Users. Please refer to this article in the HelpCenter and make sure automatic CSS inlining is deactivated.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].