mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-17 04:30:29 +03:00
Renamed channels to rooms (#30)
This commit is contained in:
parent
b5dfc337ec
commit
705910d9e0
42 changed files with 291 additions and 291 deletions
47
src/app/molecules/room-intro/RoomIntro.jsx
Normal file
47
src/app/molecules/room-intro/RoomIntro.jsx
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
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 <Linkify options={{ target: { url: '_blank' } }}>{content}</Linkify>;
|
||||
}
|
||||
|
||||
function RoomIntro({
|
||||
roomId, avatarSrc, name, heading, desc, time,
|
||||
}) {
|
||||
return (
|
||||
<div className="room-intro">
|
||||
<Avatar imageSrc={avatarSrc} text={name.slice(0, 1)} bgColor={colorMXID(roomId)} size="large" />
|
||||
<div className="room-intro__content">
|
||||
<Text className="room-intro__name" variant="h1">{heading}</Text>
|
||||
<Text className="room-intro__desc" variant="b1">{linkifyContent(desc)}</Text>
|
||||
{ time !== null && <Text className="room-intro__time" variant="b3">{time}</Text>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
31
src/app/molecules/room-intro/RoomIntro.scss
Normal file
31
src/app/molecules/room-intro/RoomIntro.scss
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
.room-intro {
|
||||
margin-top: calc(2 * var(--sp-extra-loose));
|
||||
margin-bottom: var(--sp-extra-loose);
|
||||
padding-left: calc(var(--sp-normal) + var(--av-small) + var(--sp-tight));
|
||||
padding-right: var(--sp-extra-tight);
|
||||
|
||||
[dir=rtl] & {
|
||||
padding: {
|
||||
left: var(--sp-extra-tight);
|
||||
right: calc(var(--sp-normal) + var(--av-small) + var(--sp-tight));
|
||||
}
|
||||
}
|
||||
|
||||
.room-intro__content {
|
||||
margin-top: var(--sp-extra-loose);
|
||||
max-width: 640px;
|
||||
}
|
||||
&__name {
|
||||
color: var(--tc-surface-high);
|
||||
}
|
||||
&__desc {
|
||||
color: var(--tc-surface-normal);
|
||||
margin: var(--sp-tight) 0 var(--sp-extra-tight);
|
||||
& a {
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
&__time {
|
||||
color: var(--tc-surface-low);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue