-
Notifications
You must be signed in to change notification settings - Fork 55
chore(Chat): move to functional component #2366
Conversation
Perf comparison
Potential regressions comparing to master
Perf tests with no regressions
Generated by 🚫 dangerJS |
} | ||
|
||
menuRef = React.createRef<HTMLElement>() | ||
export type ChatMessageStylesProps = Pick< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good that we have these typings now on the component level, but let's make sure that we move the others too :)
handleFocus = (e: React.SyntheticEvent) => { | ||
this.updateActionsMenuPosition() | ||
const handleFocus = (e: React.SyntheticEvent) => { | ||
if (updateActionsMenuPosition.current) updateActionsMenuPosition.current() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_.invoke(updateActionsMenuPosition, 'current')
?
} | ||
|
||
handleMessageRef = (node: HTMLElement) => this.setState({ messageNode: node }) | ||
const handleMouseEnter = (e: React.SyntheticEvent) => { | ||
if (updateActionsMenuPosition.current) updateActionsMenuPosition.current() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
|
||
/** Shorthand array of the items inside the chat. */ | ||
items?: ShorthandCollection<ChatItemProps> | ||
} | ||
|
||
class Chat extends UIComponent<WithAsProp<ChatProps>, any> { | ||
static displayName = 'Chat' | ||
export type ChatStylesProps = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeeey!
? children | ||
: _.map(items, item => | ||
ChatItem.create(item, { | ||
defaultProps: () => ({ className: Chat.slotClassNames.item }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we by convention send here resolvedStyles.item
? I hope not, but still, thought I'd ask
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline: let's avoid changes there and keep previous behavior.
Co-Authored-By: Marija Najdova <mnajdova@gmail.com>
…om/stardust-ui/react into chore/chat-to-hooks
Co-Authored-By: Marija Najdova <mnajdova@gmail.com>
…react into chore/chat-to-hooks
const ElementType = getElementType(props) | ||
const unhandledProps = getUnhandledProps(ChatMessage.handledProps, props) | ||
|
||
const badgeElement = Label.create(badge, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another example that we were missing getA11Props
:(
BREAKING CHANGES
As in other components that are moved functional we limited sets of props that are passed to styles functions.
Chat
ChatItem
attached
contentPosition
ChatMessage
attached
badgePosition
mine
focused
hasBadge
(replacement forbadge
)hasReactionGroup
(replacement forreactionGroup
)