You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { useHistory } from 'react-router-dom';
|
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
|
import { ADD_NETWORK_ROUTE } from '../../../../helpers/constants/routes';
|
|
import Button from '../../../../components/ui/button';
|
|
|
|
const NetworksFormSubheader = ({ addNewNetwork }) => {
|
|
const t = useI18nContext();
|
|
const history = useHistory();
|
|
return addNewNetwork ? (
|
|
<div className="networks-tab__subheader">
|
|
<span className="networks-tab__sub-header-text">{t('networks')}</span>
|
|
<span>{' > '}</span>
|
|
<div className="networks-tab__subheader--break">{t('addANetwork')}</div>
|
|
</div>
|
|
) : (
|
|
<div className="settings-page__sub-header">
|
|
<span className="settings-page__sub-header-text">{t('networks')}</span>
|
|
<div className="networks-tab__add-network-header-button-wrapper">
|
|
<Button
|
|
type="primary"
|
|
onClick={(event) => {
|
|
event.preventDefault();
|
|
history.push(ADD_NETWORK_ROUTE);
|
|
}}
|
|
>
|
|
{t('addANetwork')}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
NetworksFormSubheader.propTypes = {
|
|
addNewNetwork: PropTypes.bool.isRequired,
|
|
};
|
|
|
|
export default NetworksFormSubheader;
|
|
|