bigbuffet-rw/app/soapbox/features/ui/components/bundle_column_error.tsx

40 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-04-25 15:54:17 -07:00
import React from 'react';
import { defineMessages, useIntl } from 'react-intl';
2022-04-25 16:04:00 -07:00
import { Column, Stack, Text, IconButton } from 'soapbox/components/ui';
2022-04-25 15:54:17 -07:00
const messages = defineMessages({
title: { id: 'bundle_column_error.title', defaultMessage: 'Network error' },
2022-04-25 16:04:00 -07:00
body: { id: 'bundle_column_error.body', defaultMessage: 'Something went wrong while loading this page.' },
2022-04-25 15:54:17 -07:00
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 (
2022-04-25 16:04:00 -07:00
<Column label={intl.formatMessage(messages.title)}>
<Stack space={4} alignItems='center' justifyContent='center' className='bg-primary-50 dark:bg-slate-700 p-10 min-h-[160px] rounded-lg'>
<IconButton
iconClassName='w-20 h-20'
title={intl.formatMessage(messages.retry)}
src={require('@tabler/icons/refresh.svg')}
2022-04-25 16:04:00 -07:00
onClick={handleRetry}
/>
<Text align='center'>{intl.formatMessage(messages.body)}</Text>
</Stack>
2022-04-25 15:54:17 -07:00
</Column>
);
};
export default BundleColumnError;