import React from 'react';
import PropTypes from 'prop-types';
import './RoomIntro.scss';
import Linkify from 'linkifyjs/react';
import colorMXID from '../../../util/colorMXID';
import Text from '../../atoms/text/Text';
import Avatar from '../../atoms/avatar/Avatar';
function linkifyContent(content) {
return {content};
}
function RoomIntro({
roomId, avatarSrc, name, heading, desc, time,
}) {
return (
{heading}
{linkifyContent(desc)}
{ time !== null && {time}}
);
}
RoomIntro.defaultProps = {
avatarSrc: false,
time: null,
};
RoomIntro.propTypes = {
roomId: PropTypes.string.isRequired,
avatarSrc: PropTypes.oneOfType([
PropTypes.string,
PropTypes.bool,
]),
name: PropTypes.string.isRequired,
heading: PropTypes.string.isRequired,
desc: PropTypes.string.isRequired,
time: PropTypes.string,
};
export default RoomIntro;