2018-05-23 16:03:26 +00:00
|
|
|
/* @flow */
|
|
|
|
|
|
|
|
import React from 'react'
|
2019-04-17 16:56:09 +00:00
|
|
|
import emoji from 'react-easy-emoji'
|
2018-05-23 16:03:26 +00:00
|
|
|
import { connect } from 'react-redux'
|
2019-05-20 15:01:47 +00:00
|
|
|
import { firstStepCompletedSelector } from 'Selectors/analyseSelectors'
|
2019-04-18 15:42:56 +00:00
|
|
|
import Animate from 'Ui/animate'
|
2018-05-23 16:03:26 +00:00
|
|
|
import './Banner.css'
|
2018-07-12 08:09:41 +00:00
|
|
|
import type { Node } from 'react'
|
|
|
|
import type { State } from 'Types/State'
|
2018-05-23 16:03:26 +00:00
|
|
|
type PropTypes = {
|
|
|
|
hidden: boolean,
|
2019-04-17 16:56:09 +00:00
|
|
|
children: Node,
|
2019-05-09 15:13:59 +00:00
|
|
|
icon?: string
|
2018-05-23 16:03:26 +00:00
|
|
|
}
|
|
|
|
|
2019-04-17 16:56:09 +00:00
|
|
|
let Banner = ({ hidden = false, children, icon }: PropTypes) =>
|
2018-05-23 16:03:26 +00:00
|
|
|
!hidden ? (
|
2019-04-18 15:42:56 +00:00
|
|
|
<Animate.fadeIn>
|
|
|
|
<div className="ui__ banner">
|
|
|
|
{icon && emoji(icon)}
|
|
|
|
<p>{children}</p>
|
|
|
|
</div>
|
|
|
|
</Animate.fadeIn>
|
2018-05-23 16:03:26 +00:00
|
|
|
) : null
|
|
|
|
|
2019-02-01 12:31:57 +00:00
|
|
|
export default (connect(
|
2019-01-21 18:19:49 +00:00
|
|
|
(state: State, { hidden }: PropTypes) => ({
|
2019-05-20 15:01:47 +00:00
|
|
|
hidden: hidden || firstStepCompletedSelector(state)
|
2019-01-21 18:19:49 +00:00
|
|
|
}),
|
|
|
|
{}
|
2019-02-01 12:31:57 +00:00
|
|
|
)(Banner): React$ComponentType<PropTypes>)
|