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

Commit

Permalink
addressed pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bmdalex committed Sep 4, 2018
1 parent 4cdecc7 commit 83d0977
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
25 changes: 0 additions & 25 deletions docs/src/examples/components/Chat/Variations/ChatExampleAvatar.tsx

This file was deleted.

9 changes: 7 additions & 2 deletions src/components/Chat/ChatMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import * as PropTypes from 'prop-types'
import * as cx from 'classnames'

import { childrenExist, createShorthandFactory, customPropTypes, UIComponent } from '../../lib'
import { ComponentVariablesInput, IComponentPartStylesInput } from '../../../types/theme'
Expand Down Expand Up @@ -67,10 +68,14 @@ class ChatMessage extends UIComponent<Extendable<IChatMessageProps>, any> {
renderComponent({ ElementType, classes, rest, styles }) {
const { avatar, children, content, mine } = this.props

return (
return childrenExist(children) ? (
<ElementType {...rest} className={cx(classes.root, classes.chatContent)}>
{children}
</ElementType>
) : (
<ElementType {...rest} className={classes.root}>
{!mine && this.renderAvatar(avatar, styles)}
<div className={classes.chatContent}>{childrenExist(children) ? children : content}</div>
<div className={classes.chatContent}>{content}</div>
{mine && this.renderAvatar(avatar, styles)}
</ElementType>
)
Expand Down
4 changes: 2 additions & 2 deletions test/specs/components/Chat/ChatMessage-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ describe('ChatMessage', () => {

describe('avatar', () => {
it('creates an Avatar component when the avatar shorthand is provided', () => {
const name = 'AB'
const chatMsg = mountWithProvider(<ChatMessage avatar="AB" />)
const name = 'John Doe'
const chatMsg = mountWithProvider(<ChatMessage avatar={name} />)

expect(chatMsg.find('Avatar').prop('name')).toEqual(name)
})
Expand Down

0 comments on commit 83d0977

Please sign in to comment.