mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-24 01:48:18 +03:00
19 lines
585 B
JavaScript
19 lines
585 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { isEmpty } from 'ramda';
|
|
import { compareVersions } from './utils';
|
|
|
|
const propTypes = {
|
|
minVersion: PropTypes.string.isRequired,
|
|
currentServerVersion: PropTypes.string.isRequired,
|
|
children: PropTypes.node.isRequired,
|
|
};
|
|
|
|
const ForVersion = ({ minVersion, currentServerVersion, children }) =>
|
|
isEmpty(currentServerVersion) || compareVersions(currentServerVersion, '<', minVersion)
|
|
? null
|
|
: <React.Fragment>{children}</React.Fragment>;
|
|
|
|
ForVersion.propTypes = propTypes;
|
|
|
|
export default ForVersion;
|