GithubHelp home page GithubHelp logo

react-link-to-inbox's Introduction

react-link-to-inbox react-link-to-inbox travis build status react-link-to-inbox appveyor build status react-link-to-inbox codecov status OSS Lifecycle

A thin react wrapper around link-to-inbox

Installation

It's just an npm package

npm i -S react-link-to-inbox

Using yarn

yarn add react-link-to-inbox

Usage

Subject and Sender

If you provide the subject line and the sending email address of the confirmation email, then the link will contain url parameters that limit the inbox search to emails that match that sender and subject. This can prevent your users from becoming distracted by other emails in your inbox, and not clicking your confirmation link or returning to the page.

Tags

To make it easier to make link-to-inbox to style, it supports three html tag types: a, input and button, provided to the tag prop. Each one is a link that navigates to the sent email. This allows you to create semantic markup that properly reflects the importance of the link-to-inbox call to action.

Text Templating

The template prop takes a string that is a lodash template. The following keys are provided:

  • name: the name of the email service (Gmail, Outlook) or the domain, if unknown
  • protocol: the protocol of the generated link (e.g. https)
  • domain: the domain of the email address (e.g. gmail.com)
  • path: the rest of the link at href (e.g. href = protocol + '://' + domain + path)
  • href: the link that is generated to the sent email
  • subject, email and sender: the values provided to the props of the same name

This allows you to customize the anchor link text or button text, depending on what tag is provided.

Full example

import LinkToInbox, {styled} from 'react-link-to-inbox';

export default (email) => {
  return styled(<LinkToInbox
      email={email}
      subject='Confirm your account'
      sender='[email protected]'
      tag='a'
      template='Open email to <%- email %> from <%- sender %> in <%- domain %>'
    />);
}

Documentation

See the examples in our storybook.

Code of Conduct

This project is governed by the Contributor Covenant v 1.4.1

License

This project uses the Apache 2.0 license.

react-link-to-inbox's People

Contributors

dependabot[bot] avatar doug-wade avatar duaneobrien avatar hnarasaki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.