Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

source4societyorg/react-scepter-alert-decorator

Repository files navigation

react-scepter-alert-decorator

Decorate a container so it can hook into the react-authapp-container messaging system

scepter-logo

redux-logo

react-boilerplate

airbnb-codestyle

Build Status

codecov

Installation

npm install @source4society/react-scepter-alert-decorator

or

yarn add @source4society/react-scepter-alert-decorator

Usage

This decorator hooks a container into the react-scepter-authapp-container message state, and adds a prop function called renderMessage that will display the message using the react-alert-component. You will need to pass in a function to handle the message label translations in order to get the decorator. It looks something like this:

const Component = (props) => <div>{props.renderMessage(props.message)}</div>; // A dummy component to wrap. This component just displays the message, but it could be anything.
import alertDecorator from '@source4society/react-scepter-alert-decorator';
const labels = (message) => message; // create your labels function. This example does not perform any translation of the messages
const withAlert = alertDecorator(labels);
export default compose(withAlert)(Component);

About

Decorator to attach alert capabilities to a component for the SCEPTER framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published