1.1.6 • Published 4 years ago

react-trello-client v1.1.6

Weekly downloads
43
License
MIT
Repository
github
Last release
4 years ago

What is React Trello Client?

This is a simple and lightweight React plugin to have a clean Trello client without using jQuery or any other additional libraries.

GitHub license npm GitHub release (latest SemVer) npm GitHub top language GitHub code size in bytes

Features 🔥

  • Easy to use without confusion
  • Most client.js options as component props
  • Default login button with a custom text and multiple Trello button styles
  • Option to disable default button
  • Having Authorize on component load
  • Authorization box behavior control (Popup or Redirect)
  • Control over access permission scopes (Read, Write, Account information)
  • Setting expiration time available
  • Callback functions as props
  • Clean and well optimized code
  • Well documented options
  • Global Trello object to use API features

Install 💻

Simply run the following commands depending on which package manager you are using.

Install via NPM:

$ npm i react-trello-client

Install via Yarn:

$ yarn add react-trello-client

CDN 🌐

You can use CDN version of the package just with a simple script tag and, also, CSS link if you want to use the default styles:

Latest version:

Latest version on NPM:

<!-- 
Latest published version of
the package JS bundle on NPM registery 
-->
<script src="https://cdn.jsdelivr.net/npm/react-trello-client/bundle/react-trello-client.bundle.min.js"></script>

<!-- 
Latest published version of
the package CSS bundle styles on NPM registery 
-->
<link rel="stylesheet" src="https://cdn.jsdelivr.net/npm/react-trello-client/bundle/react-trello-client.bundle.min.css" />

Specific version:

Using a specific version is available too:

<!-- 
Specific version of the package JS bundle 
on NPM registery 
-->
<script src="https://cdn.jsdelivr.net/npm/react-trello-client@version/bundle/react-trello-client.bundle.min.js"></script>

<!-- 
Specific version of the package CSS bundle styles 
on NPM registery 
-->
<link rel="stylesheet" src="https://cdn.jsdelivr.net/npm/react-trello-client@version/bundle/react-trello-client.bundle.min.css" />

Props ⚙

You can pass available options as props to the main component. See Usage or view on Codesandbox.

Example:

<TrelloClient authorizeType="popup">

Available options:

PropTypeRequiredDescriptionExample
apiKeyStringYesThe API key your got from trello. Get the API key from https://trello.com/app-key/apiKey="19194867c53e814486de9e5636734e11"
clientVersionNumberYesTrello API version you are usingclientVersion={1}
apiEndpointStringYesTrello API endpoint urlapiEndpoint="https://api.trello.com"
authEndpointStringYesTrello authorization endpointauthEndpoint="https://trello.com"
intentEndpointStringYesTrello intent endpointintentEndpoint="https://trello.com"
authorizeNameStringYesName of your application to show on authorization poprop or pageauthorizeName="React Trello Login"
authorizeTypeStringNoSelect how to show the authorization window. available options are popup and redirect. Default is popupauthorizeType="popup"
authorizePersistBooleanNoAllow to write token on local storage if authentication is successful. Default is trueauthorizePersist={true}
authorizeInteractiveBooleanNoSet interactive mode on or off. Default is trueauthorizeInteractive={true}
authorizeScopeReadBooleanNoGet permission to read all user boards and teams. Default is trueauthorizeScopeRead={true}
authorizeScopeWriteBooleanNoGet permission to make comment for the user, create and update cards, lists, boards and teams of the user. Default is falseauthorizeScopeWrite={false}
authorizeScopeAccountBooleanNoGet permission to read user email address. Default is falseauthorizeScopeAccount={false}
authorizeExpirationStringNoSet the permission expiry time. You can pass options such as "1hour", "15hours", "1day", "30days" or "never"authorizeExpiration="25days"
authorizeOnSuccessFunctionYesA function to call after login is succeedauthorizeOnSuccess={() => console.log('Login successful!')}
authorizeOnErrorFunctionYesA function to call after login is failedauthorizeOnError={() => console.log('Login error!')}
autoAuthorizeBooleanNoAuthorization window will show up right after component is loaded. Default is falseautoAuthorize={false}
authorizeButtonBooleanNoIf it's true default login button with Trello styles will show. Default is falseauthorizeButton={true}
buttonStyleStringNoLogin button style. Available options are metamorph and flat. Default is metamorphbuttonStyle="metamorph"
buttonColorStringNoLogin button style. Available options are green, grayish-blue and light. Default is greenbuttonColor="grayish-blue"
buttonTextStringNoThe text to show on login button. Default is Login with TrellobuttonText="Login with Trello"
ButtonCustomStylesObjectNoYou can override the button default styles with a JS style object. This adds a style attribute to the button with the given valuesbuttonCustomStyles={{ background: blue, marginLeft: '15px' }}

Usage 🍷

Usage of the plugin is so simple. Just import it then pass required props. Please pay attetion to required ones. View on Codesandbox.

Example:

import React from 'react'
import TrelloClient from 'react-trello-client'

const App = () => {
    return(
        <TrelloClient
            apiKey="19194867c53e814486de9e5636734e11" // Get the API key from https://trello.com/app-key/
            clientVersion={1} // number: {1}, {2}, {3}
            apiEndpoint="https://api.trello.com" // string: "https://api.trello.com"
            authEndpoint="https://trello.com" // string: "https://trello.com"
            intentEndpoint="https://trello.com" // string: "https://trello.com"
            authorizeName="React Trello Client" // string: "React Trello Client"
            authorizeType="popup" // string: popup | redirect
            authorizePersist={true}
            authorizeInteractive={true}
            authorizeScopeRead={false} // boolean: {true} | {false}
            authorizeScopeWrite={true} // boolean: {true} | {false}
            authorizeScopeAccount={true} // boolean: {true} | {false}
            authorizeExpiration="never" // string: "1hour", "1day", "30days" | "never"
            authorizeOnSuccess={() => console.log('Login successful!')} // function: {() => console.log('Login successful!')}
            authorizeOnError={() => console.log('Login error!')} // function: {() => console.log('Login error!')}
            autoAuthorize={false} // boolean: {true} | {false}
            authorizeButton={true} // boolean: {true} | {false}
            buttonStyle="metamorph" // string: "metamorph" | "flat"
            buttonColor="green" // string: "green" | "grayish-blue" | "light"
            buttonText="Login with Trello" // string: "Login with Trello"
        />
    )
}

export default App

Note:

If you disable the login button, its not necessary to declare button props. Even if you don't use authorizeButton={false} the default option false will be used.

Example:

import React from 'react'
import TrelloClient from 'react-trello-client'

const App = () => {
    return(
        <TrelloClient
            apiKey="19194867c53e814486de9e5636734e11"
            clientVersion={1} // number: {1}, {2}, {3}
            apiEndpoint="https://api.trello.com" // string: "https://api.trello.com"
            authEndpoint="https://trello.com" // string: "https://trello.com"
            intentEndpoint="https://trello.com" // string: "https://trello.com"
            authorizeName="Trellog" // string: "React Trello Client"
            authorizeType="popup" // string: popup | redirect
            authorizePersist={true}
            authorizeInteractive={true}
            authorizeScopeRead={false} // boolean: {true} | {false}
            authorizeScopeWrite={true} // boolean: {true} | {false}
            authorizeScopeAccount={true} // boolean: {true} | {false}
            authorizeExpiration="never" // string: "1hour", "1day", "30days" | "never"
            authorizeOnSuccess={() => console.log('Login successful!')} // function: {() => console.log('Login successful!')}
            authorizeOnError={() => console.log('Login error!')} // function: {() => console.log('Login error!')}
            autoAuthorize={false} // boolean: {true} | {false}
        />
    )
}

export default App

Using The API:

To use all Trello API features simply import Trello object as a const, then chain the desired method. For more examples on API options please read Trello client.js API Reference.

import React from 'react'
import TrelloClient, { Trello } from 'react-trello-client'

Trello.addCard({
    url:'http://example.com'
})

License 🔐

React Trello Client is MIT licensed.

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago