Creating a Notifier Component
mkdir components mkdir Notifier
cd Notifier
touch index.js Notifier.css # on Windows, run the following instead
# copy NUL index.js
# copy NUL Notifier.css yarn add classnames # or npm install classnames // src/components/Notifier/index.js
import React, { Component } from "react";
import "./Notifier.css";
import classnames from 'classnames';
class Notifier extends Component {
render() {
const notifyclass = classnames('notify', {
danger: this.props.offline
});
const message = this.props.offline ?
`CloudyCam is offline! Your images will be saved now and then uploaded to your Cloudinary Media Library once your Internet connection is back up.`
:
`Take a picture and it will be uploaded to your Cloudinary Media Library.`;
return (
<div className={notifyclass}>
<p>
<em>{message}</em>
</p>
</div>
);
}
}
export default Notifier;Last updated
Was this helpful?