gab-social/app/javascript/gabsocial/components/column_indicator.js
mgabdev 176ddc22f2 Updated the default class name
• Updated:
- the default class name
2020-08-18 15:49:11 -05:00

51 lines
1.2 KiB
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
import { defineMessages, injectIntl } from 'react-intl'
import Icon from './icon'
import Text from './text'
class ColumnIndicator extends React.PureComponent {
render() {
const { type, message, intl } = this.props
const title = type !== 'error' && !message ? intl.formatMessage(messages[type]) : message
return (
<div className={[_s.d, _s.w100PC, _s.jcCenter, _s.aiCenter, _s.py15].join(' ')}>
<Icon id={type} size='30px' />
{
type !== 'loading' &&
<Text
align='center'
size='medium'
className={_s.mt10}
>
{title}
</Text>
}
</div>
)
}
}
const messages = defineMessages({
loading: { id: 'loading_indicator.label', defaultMessage: 'Loading..' },
missing: { id: 'missing_indicator.sublabel', defaultMessage: 'This resource could not be found.' },
})
ColumnIndicator.propTypes = {
intl: PropTypes.object.isRequired,
type: PropTypes.oneOf([
'loading',
'missing',
'error',
]),
message: PropTypes.oneOfType([
PropTypes.string,
PropTypes.object,
]),
}
export default injectIntl(ColumnIndicator)