chat: hover treatment for rows

fixes urbit/landscape#460
This commit is contained in:
James Acklin 2021-03-12 21:29:39 -05:00
parent d39ab24c8f
commit 5e8aa1cf0b
2 changed files with 40 additions and 7 deletions

View File

@ -170,7 +170,7 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
className='cf' className='cf'
zIndex={0} zIndex={0}
> >
<Row p='12px 8px 12px 12px' alignItems='center'> <Row p='12px 4px 12px 12px' alignItems='center'>
{avatar} {avatar}
</Row> </Row>
<ChatEditor <ChatEditor

View File

@ -101,6 +101,37 @@ export const UnreadMarker = React.forwardRef(
} }
); );
const MessageActions = (props) => {
return (
<Box
borderRadius={1}
width={6}
height={4}
background='white'
border='1px solid'
borderColor='lightGray'
position='absolute'
top='-12px'
right={2}
/>
);
};
const MessageWrapper = (props) => {
const { hovering, bind } = useHovering();
return (
<Box
py='1'
backgroundColor={hovering ? 'washedGray' : 'transparent'}
position='relative'
{...bind}
>
{props.children}
{/* {hovering ? <MessageActions /> : null} */}
</Box>
);
};
interface ChatMessageProps { interface ChatMessageProps {
msg: Post; msg: Post;
previousMsg?: Post; previousMsg?: Post;
@ -195,7 +226,7 @@ class ChatMessage extends Component<ChatMessageProps> {
<Box <Box
ref={this.props.innerRef} ref={this.props.innerRef}
pt={renderSigil ? 2 : 0} pt={renderSigil ? 2 : 0}
pb={isLastMessage ? 4 : 2} pb={isLastMessage ? '20px' : 0}
className={containerClass} className={containerClass}
backgroundColor={highlighted ? 'blue' : 'white'} backgroundColor={highlighted ? 'blue' : 'white'}
style={style} style={style}
@ -204,12 +235,14 @@ class ChatMessage extends Component<ChatMessageProps> {
<DayBreak when={msg['time-sent']} shimTop={renderSigil} /> <DayBreak when={msg['time-sent']} shimTop={renderSigil} />
) : null} ) : null}
{renderSigil ? ( {renderSigil ? (
<> <MessageWrapper>
<MessageAuthor pb={1} {...messageProps} /> <MessageAuthor pb={1} {...messageProps} />
<Message pl={'44px'} pr={4} {...messageProps} /> <Message pl={'44px'} pr={4} {...messageProps} />
</> </MessageWrapper>
) : ( ) : (
<Message pl={'44px'} pr={4} timestampHover {...messageProps} /> <MessageWrapper>
<Message pl={'44px'} pr={4} timestampHover {...messageProps} />
</MessageWrapper>
)} )}
<Box style={unreadContainerStyle}> <Box style={unreadContainerStyle}>
{isLastRead ? ( {isLastRead ? (
@ -406,8 +439,8 @@ export const Message = ({
<Text <Text
display={hovering ? 'block' : 'none'} display={hovering ? 'block' : 'none'}
position='absolute' position='absolute'
width='40px' width='36px'
textAlign='center' textAlign='right'
left='0' left='0'
top='3px' top='3px'
fontSize={0} fontSize={0}