Files
cinny/src/app/molecules/room-intro/RoomIntro.jsx
T

44 lines
1.2 KiB
React
Raw Normal View History

2021-07-28 18:45:52 +05:30
import React from 'react';
import PropTypes from 'prop-types';
2021-08-31 18:43:31 +05:30
import './RoomIntro.scss';
2021-07-28 18:45:52 +05:30
2021-11-23 11:56:02 +05:30
import { twemojify } from '../../../util/twemojify';
2021-07-28 18:45:52 +05:30
import colorMXID from '../../../util/colorMXID';
import Text from '../../atoms/text/Text';
import Avatar from '../../atoms/avatar/Avatar';
2021-08-31 18:43:31 +05:30
function RoomIntro({
2021-08-17 17:04:21 +05:30
roomId, avatarSrc, name, heading, desc, time,
2021-07-28 18:45:52 +05:30
}) {
return (
2021-08-31 18:43:31 +05:30
<div className="room-intro">
<Avatar imageSrc={avatarSrc} text={name} bgColor={colorMXID(roomId)} size="large" />
2021-08-31 18:43:31 +05:30
<div className="room-intro__content">
2021-11-23 11:56:02 +05:30
<Text className="room-intro__name" variant="h1">{twemojify(heading)}</Text>
<Text className="room-intro__desc" variant="b1">{twemojify(desc, undefined, true)}</Text>
2021-08-31 18:43:31 +05:30
{ time !== null && <Text className="room-intro__time" variant="b3">{time}</Text>}
2021-07-28 18:45:52 +05:30
</div>
</div>
);
}
2021-08-31 18:43:31 +05:30
RoomIntro.defaultProps = {
2021-10-18 17:25:52 +02:00
avatarSrc: null,
2021-07-28 18:45:52 +05:30
time: null,
};
2021-08-31 18:43:31 +05:30
RoomIntro.propTypes = {
2021-08-17 17:04:21 +05:30
roomId: PropTypes.string.isRequired,
2021-07-28 18:45:52 +05:30
avatarSrc: PropTypes.oneOfType([
PropTypes.string,
PropTypes.bool,
]),
name: PropTypes.string.isRequired,
heading: PropTypes.string.isRequired,
desc: PropTypes.string.isRequired,
time: PropTypes.string,
};
2021-08-31 18:43:31 +05:30
export default RoomIntro;