import * as React from "react"; import * as System from "~/components/system"; import Group from "~/components/system/Group"; import * as Constants from "~/common/constants"; import SystemPage from "~/components/system/SystemPage"; import ViewSourceLink from "~/components/system/ViewSourceLink"; export default class SystemPageNotifications extends React.Component { state = { exampleOne: true, exampleTwo: true, exampleThree: true, }; _handleChange = (name) => { this.setState({ [name]: false }); }; render() { return ( Notifications

The Notification component is used to alert a user of new information.


Imports

Import React and the Notification Component.

{`import * as React from 'react'; import { Notification } from 'slate-react-system';`}

Notification with status






Declare the Notification component with a status.
{`class ExampleOne extends React.Component { render() { return(


) } }`}



Notification with content

doge You can style the description how you like and even add photos or other components. } />

Declare the Notification component with components in the description
{`let imgLink= "https://upload.wikimedia.org/wikipedia/en/5/5f/Original_Doge_meme.jpg" class ExampleTwo extends React.Component { render() { return( doge You can style the description how you like and even add photos or other components. } /> ) } }`}


Notification with onClose function and timer

{this.state.exampleOne ? ( this._handleChange("exampleOne")} /> ) : ( This notification disappeared after 1 minute. Refresh the page to see it. )}

Declare the Notification component with an onClose function which is triggered when the x is clicked.
You can include an interval in milliseconds, after which onClose is automatically called. If the user mouses over the notification, the timer restarts.
{`class exampleOne extends React.Component { state = { exampleOne: true } render() { return( {this.state.exampleOne ? ( this._handleChange("exampleOne")} /> ) : (
This notification disappeared after 5 minutes
)} ) } }`}



Accepted React Properties

function, c: "null", d: "Function called when the 'x' is clicked or the interval (if specified) runs out", }, { id: 2, a: "status", b: string, c: "INFO", d: "Status which determines the styling and color of the notification. Use INFO, SUCCESS, WARNING, or ERROR", }, { id: 3, a: "interval", b: int, c: "null", d: "Number of milliseconds before onClose is automatically called. Interval resets if user mouses over the notification", }, { id: 4, a: "label", b: string, c: "null", d: "Label text", }, { id: 5, a: "description", b: (
string Component
), c: "null", d: "Description text", }, { id: 6, a: "tooltip", b: string, c: "null", d: "Tooltip text", }, ], }} />
); } }