diff --git a/.gitignore b/.gitignore index e7ba4d641..3ea4a624b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,9 @@ node_modules !.yarn/sdks !.yarn/versions + .babelrc .vscode + diff --git a/packages/react/src/components/Message/MessageDivider.js b/packages/react/src/components/Message/MessageDivider.js index 2e326fdc7..73698ef5d 100644 --- a/packages/react/src/components/Message/MessageDivider.js +++ b/packages/react/src/components/Message/MessageDivider.js @@ -1,5 +1,6 @@ import { css } from '@emotion/react'; import React from 'react'; +import PropTypes from 'prop-types'; import { appendClassNames } from '../../lib/appendClassNames'; import useComponentOverrides from '../../theme/useComponentOverrides'; @@ -73,3 +74,10 @@ export const MessageDivider = ({ ); }; + +MessageDivider.propTypes = { + children: PropTypes.node, + unreadLabel: PropTypes.string, +}; + +export default MessageDivider; diff --git a/packages/react/src/components/Message/MessageReactions.js b/packages/react/src/components/Message/MessageReactions.js index 216ef91c7..036bde341 100644 --- a/packages/react/src/components/Message/MessageReactions.js +++ b/packages/react/src/components/Message/MessageReactions.js @@ -1,5 +1,6 @@ import React from 'react'; import { css } from '@emotion/react'; +import PropTypes from 'prop-types'; import useComponentOverrides from '../../theme/useComponentOverrides'; import { Box } from '../Box'; import { appendClassNames } from '../../lib/appendClassNames'; @@ -83,3 +84,11 @@ export const MessageReactions = ({ ); }; + +MessageReactions.propTypes = { + message: PropTypes.object, + authenticatedUserUsername: PropTypes.string, + handleEmojiClick: PropTypes.func, +}; + +export default MessageReactions; diff --git a/packages/react/src/components/Message/index.js b/packages/react/src/components/Message/index.js index b0e7e95e8..1760a86d4 100644 --- a/packages/react/src/components/Message/index.js +++ b/packages/react/src/components/Message/index.js @@ -1 +1,3 @@ export { default as Message } from './Message'; +export { default as MessageReactions } from './MessageReactions'; +export { default as MessageDivider } from './MessageDivider'; diff --git a/packages/react/src/components/SearchMessage/SearchMessage.js b/packages/react/src/components/SearchMessage/SearchMessage.js index 756487b13..b692ebc58 100644 --- a/packages/react/src/components/SearchMessage/SearchMessage.js +++ b/packages/react/src/components/SearchMessage/SearchMessage.js @@ -1,19 +1,14 @@ import React, { useState, useContext } from 'react'; import { isSameDay, format } from 'date-fns'; -import { - Message, - MessageReactions, - MessageDivider, -} from '@rocket.chat/fuselage'; import RCContext from '../../context/RCInstance'; import classes from './SearchMessage.module.css'; import { Markdown } from '../Markdown/index'; import { useUserStore, useSearchMessageStore } from '../../store'; -import { isSameUser, serializeReactions } from '../../lib/reaction'; import { Button } from '../Button'; import { Box } from '../Box'; import { Icon } from '../Icon'; import { ActionButton } from '../ActionButton'; +import { Message, MessageReactions, MessageDivider } from '../Message'; const Search = () => { const { RCInstance } = useContext(RCContext); @@ -77,38 +72,23 @@ const Search = () => { const prev = arr[index + 1]; const newDay = isMessageNewDay(msg, prev); return ( - - - {newDay && ( - - {format(new Date(msg.ts), 'MMMM d, yyyy')} - - )} - - {msg.u.username} - - {format(new Date(msg.ts), 'h:mm a')} - - {msg.editedAt && ( - - )} - - - - - - {msg.reactions && - serializeReactions(msg.reactions).map((reaction) => ( - - -

{reaction.count}

-
- ))} -
-
+ + {newDay && ( + + {format(new Date(msg.ts), 'MMMM d, yyyy')} + + )} + + ); })}