chat: conditionally marginalize mention

Fixes urbit/landscape#468
This commit is contained in:
James Acklin 2021-02-20 10:51:43 -05:00
parent e9a9863b22
commit ec7d8462f6
2 changed files with 4 additions and 2 deletions

View File

@ -445,8 +445,10 @@ export const Message = ({
</Box>
);
case 'mention':
const first = (i) => (i === 0);
return (
<Mention
marginLeft={first(i) ? "-4px" : "0"}
group={group}
scrollWindow={scrollWindow}
ship={content.mention}

View File

@ -39,7 +39,7 @@ export function Mention(props: {
scrollWindow?: HTMLElement;
ship: string;
}) {
const { contacts, ship, scrollWindow } = props;
const { contacts, ship, scrollWindow, ...rest } = props;
let { contact } = props;
contact = contact?.color ? contact : contacts?.[ship];
const history = useHistory();
@ -53,7 +53,7 @@ export function Mention(props: {
}, [showOverlay]);
return (
<Box position='relative' display='inline-block' cursor='pointer'>
<Box position='relative' display='inline-block' cursor='pointer' {...rest}>
<Text
onClick={() => toggleOverlay()}
mx={1}