Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

[RFC] Chat.Item grouped prop for describing groups of chat items #588

@bmdalex

Description

@bmdalex

[RFC] Chat.Item grouped prop for describing groups of chat items

Legend:

  • batch: group of consecutive messages from the same participant

Problem description

What?

We need a way to describe either:

  • batches of chat messages;
  • or chat messages that are not the first in a batch.

Why?

There are scenarios where there needs to be a clear visual indication that differentiates messages within a batch:

  • redundant subcomponents;
  • different styling (fitted consecutive messages).

Current:

screenshot 2018-12-10 at 17 12 00

Expected:

screenshot 2018-12-10 at 17 14 37

Proposed solutions

1. Introduce grouped prop on Chat.Item component to suggest they are part of a batch:

API:
<Chat>
  <Chat.Item
    grouped
    gutter={...}
    content={(
      <Chat.Message
        content="Hi"
        author="Jane Doe"
        timestamp="Yesterday, 10:15 PM"
      />
    )}
  />
  <Chat.Item
    gutter={...}
    content={<Chat.Message content="How are you todau?" author="Jane Doe" timestamp="Yesterday, 10:15 PM" />}
  />
  <Chat.Item
    gutter={...}
    content={<Chat.Message content="*today" author="Jane Doe" timestamp="Yesterday, 10:15 PM" />}
  />
</Chat>

2. Introduce the notion of Chat.Message.Group for a group of consecutive messages from one participant:

API:
<Chat>
  <Chat.Item
    gutter={...}
    content={(
      // Their group
      <Chat.Message.Group>
        <Chat.Message content="Hi" author="Jane Doe" timestamp="Yesterday, 10:15 PM" />
        <Chat.Message content="How are you today?" author="Jane Doe" timestamp="Yesterday, 10:15 PM" />
        <Chat.Message content="Good, and you?" mine author="Jane Doe" timestamp="Yesterday, 10:15 PM" />
      </Chat.Message.Group>
    )}
  />
  <Chat.Item
    gutter={...}
    content={(
      // My group
      <Chat.Message.Group>
        <Chat.Message content="Good, and you?" mine author="Jane Doe" timestamp="Yesterday, 10:15 PM" />
      </Chat.Message.Group>
    )}
  />
</Chat>

3. Try to achieve the visual differences with current capabilities (might not cover all scenarios):

  • we will just not add gutter, author and timestamp subcomponents
  • we will remove extra margins between messages and replace them with invisible Divider components that we'd add manually between batches

Metadata

Metadata

Assignees

Labels

RFCvstsPaired with ticket in vsts

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions