badguardhome/client/src/components/ui/UpdateTopline.js

43 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-05-16 14:24:30 +00:00
import React, { Fragment } from 'react';
2019-02-20 13:54:14 +00:00
import PropTypes from 'prop-types';
import { Trans, withNamespaces } from 'react-i18next';
import Topline from './Topline';
const UpdateTopline = props => (
<Topline type="info">
2019-05-16 14:24:30 +00:00
<Fragment>
<Trans
values={{ version: props.version }}
components={[
<a href={props.url} target="_blank" rel="noopener noreferrer" key="0">
Click here
</a>,
]}
>
update_announcement
</Trans>
{props.canAutoUpdate &&
<button
type="button"
className="btn btn-sm btn-primary ml-3"
onClick={props.getUpdate}
disabled={props.processingUpdate}
>
<Trans>update_now</Trans>
</button>
}
</Fragment>
2019-02-20 13:54:14 +00:00
</Topline>
);
UpdateTopline.propTypes = {
2019-05-16 14:24:30 +00:00
version: PropTypes.string,
2019-02-20 13:54:14 +00:00
url: PropTypes.string.isRequired,
2019-05-16 14:24:30 +00:00
canAutoUpdate: PropTypes.bool,
getUpdate: PropTypes.func,
processingUpdate: PropTypes.bool,
2019-02-20 13:54:14 +00:00
};
export default withNamespaces()(UpdateTopline);