BundleColumnError: convert to TSX

revert-5af0e40a
Alex Gleason 2022-04-25 17:54:17 -05:00
rodzic 4d4070da9a
commit 672216d4de
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 37 dodań i 43 usunięć

Wyświetl plik

@ -1,43 +0,0 @@
import PropTypes from 'prop-types';
import React from 'react';
import { defineMessages, injectIntl } from 'react-intl';
import IconButton from '../../../components/icon_button';
import Column from './column';
import ColumnHeader from './column_header';
const messages = defineMessages({
title: { id: 'bundle_column_error.title', defaultMessage: 'Network error' },
body: { id: 'bundle_column_error.body', defaultMessage: 'Something went wrong while loading this component.' },
retry: { id: 'bundle_column_error.retry', defaultMessage: 'Try again' },
});
class BundleColumnError extends React.PureComponent {
static propTypes = {
onRetry: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
handleRetry = () => {
this.props.onRetry();
}
render() {
const { intl: { formatMessage } } = this.props;
return (
<Column>
<ColumnHeader icon='exclamation-circle' type={formatMessage(messages.title)} />
<div className='error-column'>
<IconButton title={formatMessage(messages.retry)} src={require('@tabler/icons/icons/refresh.svg')} onClick={this.handleRetry} />
{formatMessage(messages.body)}
</div>
</Column>
);
}
}
export default injectIntl(BundleColumnError);

Wyświetl plik

@ -0,0 +1,37 @@
import React from 'react';
import { defineMessages, useIntl } from 'react-intl';
import IconButton from '../../../components/icon_button';
import Column from './column';
import ColumnHeader from './column_header';
const messages = defineMessages({
title: { id: 'bundle_column_error.title', defaultMessage: 'Network error' },
body: { id: 'bundle_column_error.body', defaultMessage: 'Something went wrong while loading this component.' },
retry: { id: 'bundle_column_error.retry', defaultMessage: 'Try again' },
});
interface IBundleColumnError {
onRetry: () => void,
}
const BundleColumnError: React.FC<IBundleColumnError> = ({ onRetry }) => {
const intl = useIntl();
const handleRetry = () => {
onRetry();
};
return (
<Column>
<ColumnHeader icon='exclamation-circle' type={intl.formatMessage(messages.title)} />
<div className='error-column'>
<IconButton title={intl.formatMessage(messages.retry)} src={require('@tabler/icons/icons/refresh.svg')} onClick={handleRetry} />
{intl.formatMessage(messages.body)}
</div>
</Column>
);
};
export default BundleColumnError;