mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-19 08:16:37 +00:00
20 lines
585 B
JavaScript
20 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;
|