mail3protocol / mail3-me-button

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mail3-me-button

mail3-me-button provides a simple way to interact with Mail3 App.

Usage

mail3-me-button is a Web Component, Just like an HTML element, mail3-me-button has some built-in attributes:

  • to(string): an email address as the mail receiver; when provided, the widget displays the number of unread messages between this address and the currently logged-in mailbox in Mail3 app, otherwise it displays the number of all unread messages.
  • lite(boolean): in lite mode, mail3-me-button will be displayed as a circular Icon without text.
  • variant(string): Some default style set for mail3-me-button, optionally one of solid, outline, ghost, default is solid
  • icon_type(string): Icon type for Mail3 Icon, optionally one of black, white, light, solid, default is solid
  • icon_style(string): CSS style for Mail3 Icon

In addition to the above built-in attributes, mail3-me-button also supports passing in all the attributes of the anchor element, such as style, target, etc.

HTML

Live demo

After adding the mail3-me-button script, you can use it like an HTML element.

<!DOCTYPE html>
<html>
  <head>
    <title>Mail3 Me Button Demo</title>
    <meta charset="UTF-8" />
  </head>

  <body>
    <!-- 3KiB gziped with public cdn, it is recommended that self-hosted this script -->
    <script src="https://unpkg.com/@mail3/mail3-me"></script>
    <mail3-me to="oxyful.eth@mail3.me" />
  </body>
</html>

React

Live demo

Install mail3-me-button:

$ npm i @mail3/mail3-me
# or yarn
$ yarn add @mail3/mail3-me

Import the dependency in the entry file of your application:

// app.js
// only 3KiB gziped
import '@mail3/mail3-me'

Use mail3-me-button like an HTML Element:

<App>
  <Navbar />
  <mail3-me to="mail3.eth@mail3.me" />
</App>

Caveats

The style attribute is replaced by the css attribute, and all custom style attribute should pass in a string type instead of Object.

<App>
  <Navbar />
  <mail3-me css="width: 200px;" icon_style="width: 20px;" />
</App>

About


Languages

Language:Svelte 56.2%Language:HTML 28.0%Language:JavaScript 14.7%Language:TypeScript 1.1%