-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Abhinav Kumar <[email protected]>
- Loading branch information
1 parent
6009fe8
commit b3c9ae8
Showing
7 changed files
with
168 additions
and
141 deletions.
There are no files selected for viewing
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
37 changes: 37 additions & 0 deletions
37
packages/react/src/components/Message/MessageAvatarContainer.js
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,37 @@ | ||
import React, { useContext } from 'react'; | ||
import { css } from '@emotion/react'; | ||
import { Avatar } from '../Avatar'; | ||
import { Box } from '../Box'; | ||
import { Icon } from '../Icon'; | ||
import RCContext from '../../context/RCInstance'; | ||
|
||
const MessageAvatarContainer = ({ message, sequential, isStarred }) => { | ||
const { RCInstance } = useContext(RCContext); | ||
const getUserAvatarUrl = (username) => { | ||
const host = RCInstance.getHost(); | ||
const URL = `${host}/avatar/${username}`; | ||
return URL; | ||
}; | ||
const MessageAvatarContainerCss = css` | ||
margin: 3px; | ||
width: 2.25em; | ||
max-height: 2.25em; | ||
display: flex; | ||
justify-content: flex-end; | ||
`; | ||
return ( | ||
<Box css={MessageAvatarContainerCss}> | ||
{!sequential ? ( | ||
<Avatar | ||
url={getUserAvatarUrl(message.u.username)} | ||
alt="avatar" | ||
size={message.t ? '1.2em' : '2.25em'} | ||
/> | ||
) : isStarred ? ( | ||
<Icon style={{ opacity: 0.5 }} name="star-filled" size="1.2em" /> | ||
) : null} | ||
</Box> | ||
); | ||
}; | ||
|
||
export default MessageAvatarContainer; |
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 |
---|---|---|
|
@@ -37,7 +37,7 @@ export const MessageBody = ({ | |
style={styleOverrides} | ||
{...props} | ||
> | ||
<p>{children}</p> | ||
{children} | ||
</Box> | ||
); | ||
}; |
27 changes: 27 additions & 0 deletions
27
packages/react/src/components/Message/MessageBodyContainer.js
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,27 @@ | ||
import React from 'react'; | ||
import { css } from '@emotion/react'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
import { Box } from '../Box'; | ||
import { appendClassNames } from '../../lib/appendClassNames'; | ||
|
||
const MessageBodyContainer = ({ children }) => { | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'MessageBodyContainer' | ||
); | ||
const classNameMBC = css` | ||
margin-left: 5px; | ||
position: relative; | ||
width: 100%; | ||
`; | ||
return ( | ||
<Box | ||
css={classNameMBC} | ||
className={appendClassNames('ec-message-body-container', classNames)} | ||
style={styleOverrides} | ||
> | ||
{children} | ||
</Box> | ||
); | ||
}; | ||
|
||
export default MessageBodyContainer; |
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
Oops, something went wrong.