UNPKG

ndla-ui

Version:

UI component library for NDLA.

71 lines (64 loc) 1.74 kB
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** * Copyright (c) 2018-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 BEMHelper from 'react-bem-helper'; import { Portrait, SafeLink } from 'ndla-ui'; var classes = new BEMHelper({ name: 'author-info', prefix: 'c-' }); var AuthorInfo = function AuthorInfo(_ref) { var authorName = _ref.authorName, authorRole = _ref.authorRole, email = _ref.email, image = _ref.image, phone = _ref.phone; return React.createElement( 'section', classes(''), image && React.createElement(Portrait, _extends({ src: image, alt: authorName, modifier: 'large' }, classes('portrait-image'))), React.createElement( 'div', null, React.createElement( 'h1', classes('heading'), authorName ), React.createElement( 'p', null, authorRole ), phone && React.createElement( 'p', null, phone ), email && React.createElement( SafeLink, { to: 'mailto:' + email }, email ) ) ); }; AuthorInfo.propTypes = { authorName: PropTypes.string.isRequired, authorRole: PropTypes.string.isRequired, phone: PropTypes.string, email: PropTypes.string, image: PropTypes.string }; export default AuthorInfo;