gab-social/app/javascript/gabsocial/components/column_indicator.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-02-14 00:40:04 +00:00
import { defineMessages, injectIntl } from 'react-intl'
import Icon from './icon'
const messages = defineMessages({
loading: { id: 'loading_indicator.label', defaultMessage: 'Loading..' },
missing: { id: 'missing_indicator.sublabel', defaultMessage: 'This resource could not be found.' },
})
2020-02-24 21:56:07 +00:00
export default
@injectIntl
2020-02-14 00:40:04 +00:00
class ColumnIndicator extends PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
type: PropTypes.oneOf([
'loading',
'missing',
'error',
]),
message: PropTypes.oneOfType([
PropTypes.string,
PropTypes.object,
]),
}
render() {
const { type, message, intl } = this.props
const title = type !== 'error' ? intl.formatMessage(messages[type]) : message
return (
2020-02-19 23:57:07 +00:00
<div className={[_s.default, _s.width100PC, _s.justifyContentCenter, _s.alignItemsCenter, _s.paddingVertical15PX].join(' ')}>
2020-02-14 00:40:04 +00:00
<Icon id={type} width='52px' height='52px' />
{
type !== 'loading' &&
2020-02-19 23:57:07 +00:00
<span className={[_s.default, _s.marginTop10PX, _s.text, _s.displayFlex, _s.colorBrand, _s.fontWeightNormal, _s.fontSize14PX].join(' ')}>
2020-02-14 00:40:04 +00:00
{title}
</span>
}
</div>
)
}
}