diff --git a/src/servers/ServersDropdown.js b/src/servers/ServersDropdown.js
index 6c036a69..d997c403 100644
--- a/src/servers/ServersDropdown.js
+++ b/src/servers/ServersDropdown.js
@@ -4,46 +4,50 @@ import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from
import PropTypes from 'prop-types';
import { serverType } from './prop-types';
-const ServersDropdown = (serversExporter) => class ServersDropdown extends React.Component {
- static propTypes = {
- servers: PropTypes.object,
- selectedServer: serverType,
- history: PropTypes.shape({
- push: PropTypes.func,
- }),
- };
+const propTypes = {
+ servers: PropTypes.object,
+ selectedServer: serverType,
+ history: PropTypes.shape({
+ push: PropTypes.func,
+ }),
+};
- renderServers = () => {
- const { servers, selectedServer } = this.props;
+const ServersDropdown = (serversExporter) => {
+ const ServersDropdownComp = ({ servers, selectedServer, history }) => {
const serversList = values(servers);
- const { push } = this.props.history;
- const loadServer = (id) => push(`/server/${id}/list-short-urls/1`);
+ const loadServer = (id) => history.push(`/server/${id}/list-short-urls/1`);
- if (isEmpty(serversList)) {
- return Add a server first...;
- }
+ const renderServers = () => {
+ if (isEmpty(serversList)) {
+ return Add a server first...;
+ }
+
+ return (
+
+ {serversList.map(({ name, id }) => (
+ loadServer(id)}>
+ {name}
+
+ ))}
+
+ serversExporter.exportServers()}>
+ Export servers
+
+
+ );
+ };
return (
-
- {serversList.map(({ name, id }) => (
- loadServer(id)}>
- {name}
-
- ))}
-
- serversExporter.exportServers()}>
- Export servers
-
-
+
+ Servers
+ {renderServers()}
+
);
};
- render = () => (
-
- Servers
- {this.renderServers()}
-
- );
+ ServersDropdownComp.propTypes = propTypes;
+
+ return ServersDropdownComp;
};
export default ServersDropdown;