-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Thorsten
authored
Feb 9, 2021
1 parent
9068f06
commit 4005b77
Showing
4 changed files
with
134 additions
and
10 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
lib/typescript/render/components/RichText/index.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@import 'assets/scss/fonts.scss'; | ||
@import 'assets/scss/colors.scss'; | ||
|
||
.container { | ||
display: flex; | ||
align-self: flex-end; | ||
width: 100%; | ||
overflow-wrap: break-word; | ||
word-break: break-word; | ||
} | ||
|
||
.avatar { | ||
width: 40px; | ||
height: 40px; | ||
margin: 6px 8px 0 0; | ||
} | ||
|
||
.userContainer { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
|
||
.user { | ||
align-self: flex-start; | ||
text-align: left; | ||
position: relative; | ||
} | ||
|
||
.userText { | ||
display: inline-flex; | ||
padding: 10px; | ||
margin-top: 5px; | ||
background: var(--color-background-blue); | ||
color: var(--color-text-contrast); | ||
border-radius: 8px; | ||
} | ||
|
||
.member { | ||
margin-top: 5px; | ||
justify-content: flex-end; | ||
width: 100%; | ||
text-align: right; | ||
} | ||
|
||
.memberText { | ||
display: inline-flex; | ||
padding: 10px; | ||
position: relative; | ||
background: var(--color-airy-blue); | ||
color: white; | ||
position: relative; | ||
text-align: left; | ||
border-radius: 8px; | ||
} | ||
|
||
.time { | ||
@include font-s; | ||
color: var(--color-text-gray); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import styles from './index.module.scss'; | ||
import {Avatar} from '../Avatar'; | ||
import {Message} from 'httpclient'; | ||
import {DefaultMessageRenderingProps} from '..'; | ||
|
||
type RichTextRenderProps = DefaultMessageRenderingProps & { | ||
message: Message; | ||
text: string; | ||
fallback: string; | ||
containsRichText: boolean; | ||
}; | ||
|
||
export const RichText = (props: RichTextRenderProps) => { | ||
const {message, text, fallback, containsRichText, fromContact, sentAt, contact} = props; | ||
|
||
return ( | ||
<div className={styles.container} id={`message-item-${message.id}`}> | ||
{!fromContact ? ( | ||
<div className={styles.member}> | ||
<div className={styles.memberText}>{containsRichText ? text : fallback}</div> | ||
{sentAt && <div className={styles.time}>{sentAt}</div>} | ||
</div> | ||
) : ( | ||
<div className={styles.userContainer}> | ||
<div className={styles.avatar}>{contact && <Avatar contact={contact} />}</div> | ||
<div className={styles.user}> | ||
<div className={styles.userText}>{containsRichText ? text : fallback}</div> | ||
{sentAt && <div className={styles.time}>{sentAt}</div>} | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters