diff --git a/README.md b/README.md index 1da1ac024..619ba8471 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ export default App; |**profileAvatar**|PropTypes.string|NO| |The profile image that will be set on the responses| |**showCloseButton**|PropTypes.bool|NO|false|Show or hide the close button in full screen mode| |**fullScreenMode**|PropTypes.bool|NO|false|Allow the use of full screen in full desktop mode| +|**badge**|PropTypes.number|NO|0|Display a notification badge on the launcher if the value is greater than 0| #### Styles diff --git a/src/components/Widget/components/Launcher/components/Badge/index.js b/src/components/Widget/components/Launcher/components/Badge/index.js new file mode 100644 index 000000000..14e9108c4 --- /dev/null +++ b/src/components/Widget/components/Launcher/components/Badge/index.js @@ -0,0 +1,14 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import './style.scss'; + +const Badge = ({ badge }) => + badge > 0 && +{badge}; + +Badge.propTypes = { + badge: PropTypes.number +}; + +export default Badge; diff --git a/src/components/Widget/components/Launcher/components/Badge/style.scss b/src/components/Widget/components/Launcher/components/Badge/style.scss new file mode 100644 index 000000000..74390d49a --- /dev/null +++ b/src/components/Widget/components/Launcher/components/Badge/style.scss @@ -0,0 +1,16 @@ +@import "variables.scss"; + +.launcher { + .badge{ + position: fixed; + top: -10px; + right: -5px; + background-color: $red; + color: white; + width: 25px; + height: 25px; + text-align: center; + line-height: 25px; + border-radius: 50%; + } +} diff --git a/src/components/Widget/components/Launcher/index.js b/src/components/Widget/components/Launcher/index.js index 4ee408c6f..67ad8b81d 100644 --- a/src/components/Widget/components/Launcher/index.js +++ b/src/components/Widget/components/Launcher/index.js @@ -1,13 +1,15 @@ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; +import Badge from './components/Badge'; import openLauncher from 'assets/launcher_button.svg'; import close from 'assets/clear-button.svg'; import './style.scss'; -const Launcher = ({ toggle, chatOpened }) => +const Launcher = ({ toggle, chatOpened, badge }) =>