From c9107d96b4c46081d5ca26945341817170e9aff0 Mon Sep 17 00:00:00 2001 From: Tyler Brown Cifu Shuster Date: Mon, 25 Jan 2021 15:44:09 -0800 Subject: [PATCH] chat: fixes wobble --- .../apps/chat/components/ChatMessage.tsx | 70 ++++++++++++++----- .../src/views/components/OverlaySigil.tsx | 4 ++ 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx b/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx index c57d21143..6bcc0b96f 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx @@ -4,7 +4,7 @@ import _ from "lodash"; import { Box, Row, Text, Rule } from "@tlon/indigo-react"; import OverlaySigil from '~/views/components/OverlaySigil'; -import { uxToHex, cite, writeText, useShowNickname } from '~/logic/lib/util'; +import { uxToHex, cite, writeText, useShowNickname, useHovering } from '~/logic/lib/util'; import { Group, Association, Contacts, Post } from "~/types"; import TextContent from './content/text'; import CodeContent from './content/code'; @@ -134,6 +134,7 @@ export default class ChatMessage extends Component { className={containerClass} style={style} mb={1} + position="relative" > {dayBreak && !isLastRead ? : null} {renderSigil @@ -194,6 +195,8 @@ export const MessageWithSigil = (props) => { } }; + const { hovering, bind } = useHovering(); + return ( <> { history={history} api={api} bg="white" - className="fl pr3 v-top pt1" + className="fl v-top pt1" + pr={3} + pl={2} /> - + { }} title={`~${msg.author}`} >{name} - {timestamp} - {datestamp} + {timestamp} + {datestamp} {msg.contents.map(c => @@ -257,20 +269,40 @@ const ContentBox = styled(Box)` `; -export const MessageWithoutSigil = ({ timestamp, contacts, msg, measure, group }) => ( - <> - {timestamp} - - {msg.contents.map((c, i) => ( - ))} - - -); +export const MessageWithoutSigil = ({ timestamp, contacts, msg, measure, group }) => { + const { hovering, bind } = useHovering(); + return ( + <> + {timestamp} + + {msg.contents.map((c, i) => ( + ))} + + + ) +}; export const MessageContent = ({ content, contacts, measure, fontSize, group }) => { if ('code' in content) { diff --git a/pkg/interface/src/views/components/OverlaySigil.tsx b/pkg/interface/src/views/components/OverlaySigil.tsx index b05b9ebb1..b2567596d 100644 --- a/pkg/interface/src/views/components/OverlaySigil.tsx +++ b/pkg/interface/src/views/components/OverlaySigil.tsx @@ -90,6 +90,8 @@ class OverlaySigil extends PureComponent { api, sigilClass, hideAvatars, + pr = 0, + pl = 0, ...rest } = this.props; @@ -113,6 +115,8 @@ class OverlaySigil extends PureComponent { onClick={this.profileShow} ref={this.containerRef} className={className} + pr={pr} + pl={pl} > {state.clicked && (