ConversationContext: conversationType => type

And a group conversation example to messages.md
This commit is contained in:
Scott Nonnenberg 2018-04-13 18:01:02 -07:00
parent d8d803d36d
commit 7bd747a796
No known key found for this signature in database
GPG key ID: 5F82280C35134661
3 changed files with 29 additions and 4 deletions

View file

@ -34,6 +34,31 @@ const View = Whisper.MessageView;
</util.ConversationContext>
```
### In a group conversation
```jsx
const outgoing = new Whisper.Message({
type: 'outgoing',
body: 'How are you doing this fine day?',
sent_at: Date.now() - 18000,
});
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
source: '+12025550003',
type: 'incoming',
}));
const View = Whisper.MessageView;
<util.ConversationContext theme={util.theme} type="group" >
<util.BackboneWrapper
View={View}
options={{ model: incoming }}
/>
<util.BackboneWrapper
View={View}
options={{ model: outgoing }}
/>
</util.ConversationContext>
```
### With an attachment
#### Image with caption

View file

@ -88,7 +88,7 @@ const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
}),
}));
const View = Whisper.MessageView;
<util.ConversationContext theme={util.theme} conversationType="group">
<util.ConversationContext theme={util.theme} type="group">
<util.BackboneWrapper
View={View}
options={{ model: incoming }}

View file

@ -7,7 +7,7 @@ interface Props {
* Corresponds to the theme setting in the app, and the class added to the root element.
*/
theme: 'ios' | 'android' | 'android-dark';
conversationType: 'private' | 'group';
type: 'private' | 'group';
}
/**
@ -16,11 +16,11 @@ interface Props {
*/
export class ConversationContext extends React.Component<Props, {}> {
public render() {
const { theme, conversationType } = this.props;
const { theme, type } = this.props;
return (
<div className={theme || 'android'}>
<div className={classnames('conversation', conversationType || 'private')}>
<div className={classnames('conversation', type || 'private')}>
<div className="discussion-container" style={{padding: '0.5em'}}>
<ul className="message-list">
{this.props.children}