ndla-ui
Version:
UI component library for NDLA.
47 lines (42 loc) • 1.69 kB
JavaScript
/**
* Copyright (c) 2016-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import React from 'react';
import PropTypes from 'prop-types';
import { COPYRIGHTED, BY, SA, NC, ND, PD, CC0, CC } from 'ndla-licenses';
import { By, Cc, Nc, Nd, Sa, Zero, Publicdomain, Copyright } from 'ndla-icons/license';
var LicenseIcon = function LicenseIcon(_ref) {
var licenseRight = _ref.licenseRight,
description = _ref.description,
className = _ref.className;
switch (licenseRight) {
case CC:
return React.createElement(Cc, { className: className, 'aria-label': description });
case BY:
return React.createElement(By, { className: className, 'aria-label': description });
case NC:
return React.createElement(Nc, { className: className, 'aria-label': description });
case ND:
return React.createElement(Nd, { className: className, 'aria-label': description });
case SA:
return React.createElement(Sa, { className: className, 'aria-label': description });
case CC0:
return React.createElement(Zero, { className: className, 'aria-label': description });
case PD:
return React.createElement(Publicdomain, { className: className, 'aria-label': description });
case COPYRIGHTED:
return React.createElement(Copyright, { className: className, 'aria-label': description });
default:
return undefined;
}
};
LicenseIcon.propTypes = {
licenseRight: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
className: PropTypes.string.isRequired
};
export default LicenseIcon;