UNPKG

ndla-ui

Version:

UI component library for NDLA.

61 lines (54 loc) 1.65 kB
/* * 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. * FRI OG BEGRENSET */ import React from 'react'; import PropTypes from 'prop-types'; import BEMHelper from 'react-bem-helper'; import LicenseIconList from './LicenseIconList'; import LicenseIconDescriptionList from './LicenseIconDescriptionList'; var classes = new BEMHelper({ name: 'license-byline', prefix: 'c-' }); var LicenseByline = function LicenseByline(_ref) { var children = _ref.children, withDescription = _ref.withDescription, licenseRights = _ref.licenseRights, className = _ref.className, messages = _ref.messages; return React.createElement( 'div', classes(), !withDescription ? React.createElement(LicenseIconList, { className: className, licenseRights: licenseRights }) : React.createElement( 'div', null, React.createElement(LicenseIconDescriptionList, { className: className, licenseRights: licenseRights }), messages && messages.modelPremission && React.createElement( 'div', { className: 'c-license-icons__modelpermission' }, messages.modelPremission ) ), children ); }; LicenseByline.propTypes = { children: PropTypes.node, licenseRights: PropTypes.arrayOf(PropTypes.string).isRequired, withDescription: PropTypes.bool, messages: PropTypes.shape({ modelPremission: PropTypes.string }), className: PropTypes.string }; LicenseByline.defaultProps = { withDescription: false }; export default LicenseByline;