Skip to content

Commit

Permalink
fix/User avatar not visible after pinning a message. #466
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayan4444 committed Mar 1, 2024
1 parent d35fed0 commit 0af4085
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions packages/react/src/components/Attachments/PinnedAttachment.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
import React from 'react';
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import { Box } from '../Box';
import { Avatar } from '../Avatar';
import RCContext from '../../context/RCInstance';

const PinnedAttachment = ({ attachment }) => {
const { RCInstance } = useContext(RCContext);
const getUserAvatarUrl = (authorIcon) => {
const host = RCInstance.getHost();
const URL = `${host}${authorIcon}`;
return URL;
};
return (
<Box
style={{
borderInlineStart: '1px solid currentColor',
paddingLeft: '0.8rem'
}}
>
<Box style={{
display: 'flex',
gap: '0.3rem',
}}>
<Avatar
url={getUserAvatarUrl(attachment?.author_icon)}
alt="avatar"
size={'1.2em'}
/>
<Box>{attachment?.author_name}</Box>
</Box>
<Box style={{
marginTop: '0.7rem',
}}>{attachment?.text}</Box>
</Box>)
}

const PinnedAttachment = ({ attachment }) => (
<Box
style={{
borderInlineStart: '1px solid currentColor',
paddingLeft: '0.8rem',
}}
>
<Box>{attachment?.author_name}</Box>
<Box>{attachment?.text}</Box>
</Box>
);

export default PinnedAttachment;

Expand Down

0 comments on commit 0af4085

Please sign in to comment.