Files
astuto/app/javascript/components/common/SiteSettingsInfoBox.tsx

43 lines
986 B
TypeScript
Raw Normal View History

2022-05-01 18:00:38 +02:00
import * as React from 'react';
import I18n from 'i18n-js';
2022-05-01 18:00:38 +02:00
import Spinner from './Spinner';
import Box from './Box';
2022-05-01 18:00:38 +02:00
interface Props {
areUpdating: boolean;
error: string;
2022-07-18 10:47:54 +02:00
areDirty?: boolean;
isSticky?: boolean;
saveButton?: React.ReactNode;
2022-05-01 18:00:38 +02:00
}
const SiteSettingsInfoBox = ({
areUpdating,
error,
areDirty = false,
isSticky = false,
saveButton = null,
}: Props) => (
<Box customClass={`siteSettingsInfo${isSticky ? ' siteSettingsInfoSticky' : ''}`}>
2022-05-01 18:00:38 +02:00
{
areUpdating ?
<Spinner />
:
error ?
<span className="error">
2022-07-18 10:47:54 +02:00
{ I18n.t('site_settings.info_box.error', { message: JSON.stringify(error) }) }
</span>
2022-05-01 18:00:38 +02:00
:
2022-07-18 10:47:54 +02:00
areDirty ?
<>
<span className="warning">{ I18n.t('site_settings.info_box.dirty') }</span>
{saveButton && saveButton}
</>
2022-07-18 10:47:54 +02:00
:
<span>{ I18n.t('site_settings.info_box.up_to_date') }</span>
2022-05-01 18:00:38 +02:00
}
</Box>
2022-05-01 18:00:38 +02:00
);
export default SiteSettingsInfoBox;