Skip to content

Commit

Permalink
feat(VirtualizedMessageList): allow to merge custom virtuoso componen…
Browse files Browse the repository at this point in the history
…ts with the SDK defaults (#2140)

Allow integrators to add only some custom virtuoso components via `VirtualizedMessageListProps['additionalVirtuosoProps']['components']`
and the rest to be filled with the defaults provided by the SDK.
  • Loading branch information
MartinCupela authored Oct 25, 2023
1 parent cb6ef2a commit 6ea9ff0
Show file tree
Hide file tree
Showing 24 changed files with 997 additions and 266 deletions.
2 changes: 1 addition & 1 deletion src/components/DateSeparator/DateSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const UnMemoizedDateSeparator = (props: DateSeparatorProps) => {
});

return (
<div className='str-chat__date-separator'>
<div className='str-chat__date-separator' data-testid='date-separator'>
{(position === 'right' || position === 'center') && (
<hr className='str-chat__date-separator-line' />
)}
Expand Down
4 changes: 4 additions & 0 deletions src/components/DateSeparator/__tests__/DateSeparator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('DateSeparator', () => {
expect(tree).toMatchInlineSnapshot(`
<div
className="str-chat__date-separator"
data-testid="date-separator"
>
<hr
className="str-chat__date-separator-line"
Expand Down Expand Up @@ -80,6 +81,7 @@ describe('DateSeparator', () => {
expect(tree).toMatchInlineSnapshot(`
<div
className="str-chat__date-separator"
data-testid="date-separator"
>
<hr
className="str-chat__date-separator-line"
Expand All @@ -99,6 +101,7 @@ describe('DateSeparator', () => {
expect(tree).toMatchInlineSnapshot(`
<div
className="str-chat__date-separator"
data-testid="date-separator"
>
<div
className="str-chat__date-separator-date"
Expand All @@ -117,6 +120,7 @@ describe('DateSeparator', () => {
expect(tree).toMatchInlineSnapshot(`
<div
className="str-chat__date-separator"
data-testid="date-separator"
>
<hr
className="str-chat__date-separator-line"
Expand Down
2 changes: 1 addition & 1 deletion src/components/EventComponent/EventComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const UnMemoizedEventComponent = <

if (type === 'system')
return (
<div className='str-chat__message--system'>
<div className='str-chat__message--system' data-testid='message-system'>
<div className='str-chat__message--system__text'>
<div className='str-chat__message--system__line' />
<p>{text}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('EventComponent', () => {
expect(tree).toMatchInlineSnapshot(`
<div
className="str-chat__message--system"
data-testid="message-system"
>
<div
className="str-chat__message--system__text"
Expand Down
8 changes: 5 additions & 3 deletions src/components/MessageList/MessageList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';

import { useEnrichedMessages } from './hooks/useEnrichedMessages';
import { useMessageListElements } from './hooks/useMessageListElements';
import { useScrollLocationLogic } from './hooks/useScrollLocationLogic';
import {
useEnrichedMessages,
useMessageListElements,
useScrollLocationLogic,
} from './hooks/MessageList';

import { MessageNotification as DefaultMessageNotification } from './MessageNotification';
import { MessageListNotifications as DefaultMessageListNotifications } from './MessageListNotifications';
Expand Down
Loading

0 comments on commit 6ea9ff0

Please sign in to comment.