ConversationContext: conversationType => type
And a group conversation example to messages.md
This commit is contained in:
parent
d8d803d36d
commit
7bd747a796
3 changed files with 29 additions and 4 deletions
|
@ -34,6 +34,31 @@ const View = Whisper.MessageView;
|
||||||
</util.ConversationContext>
|
</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
|
### With an attachment
|
||||||
|
|
||||||
#### Image with caption
|
#### Image with caption
|
||||||
|
|
|
@ -88,7 +88,7 @@ const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
const View = Whisper.MessageView;
|
const View = Whisper.MessageView;
|
||||||
<util.ConversationContext theme={util.theme} conversationType="group">
|
<util.ConversationContext theme={util.theme} type="group">
|
||||||
<util.BackboneWrapper
|
<util.BackboneWrapper
|
||||||
View={View}
|
View={View}
|
||||||
options={{ model: incoming }}
|
options={{ model: incoming }}
|
||||||
|
|
|
@ -7,7 +7,7 @@ interface Props {
|
||||||
* Corresponds to the theme setting in the app, and the class added to the root element.
|
* Corresponds to the theme setting in the app, and the class added to the root element.
|
||||||
*/
|
*/
|
||||||
theme: 'ios' | 'android' | 'android-dark';
|
theme: 'ios' | 'android' | 'android-dark';
|
||||||
conversationType: 'private' | 'group';
|
type: 'private' | 'group';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,11 +16,11 @@ interface Props {
|
||||||
*/
|
*/
|
||||||
export class ConversationContext extends React.Component<Props, {}> {
|
export class ConversationContext extends React.Component<Props, {}> {
|
||||||
public render() {
|
public render() {
|
||||||
const { theme, conversationType } = this.props;
|
const { theme, type } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={theme || 'android'}>
|
<div className={theme || 'android'}>
|
||||||
<div className={classnames('conversation', conversationType || 'private')}>
|
<div className={classnames('conversation', type || 'private')}>
|
||||||
<div className="discussion-container" style={{padding: '0.5em'}}>
|
<div className="discussion-container" style={{padding: '0.5em'}}>
|
||||||
<ul className="message-list">
|
<ul className="message-list">
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue