11import React , { PropTypes , Component } from 'react' ;
22import classnames from 'classnames' ;
33
4+ import dynamicsFont from '../../assets/DynamicsFont/DynamicsFont.scss' ;
5+
46import styles from './styles.scss' ;
57import i18n from './i18n' ;
68
@@ -27,6 +29,17 @@ function MatchedNameList(props) {
2729 const matchedNames = props . matchedNames ;
2830 return (
2931 < div className = { props . className } >
32+ {
33+ this . props . isSelected ?
34+ < RecipientName
35+ name = { i18n . getString ( 'selectMatchedName' , this . props . currentLocale ) }
36+ className = { styles . noClick }
37+ onClick = {
38+ ( ) => null
39+ }
40+ /> :
41+ null
42+ }
3043 {
3144 matchedNames . map ( matchedName => (
3245 < RecipientName
@@ -43,6 +56,8 @@ function MatchedNameList(props) {
4356}
4457
4558MatchedNameList . propTypes = {
59+ currentLocale : PropTypes . string . isRequired ,
60+ isSelected : PropTypes . bool . isRequired ,
4661 className : PropTypes . string . isRequired ,
4762 matchedNames : PropTypes . arrayOf ( PropTypes . string ) . isRequired ,
4863} ;
@@ -95,12 +110,14 @@ class RecipientHeader extends Component {
95110 }
96111 const phoneNumber = recipient . phoneNumber || recipient . extensionNumber ;
97112 let matchedNames = this . context . getMatcherContactList ( phoneNumber ) ;
98- let defaultRecipient = i18n . getString ( 'selectMatchedName' , this . props . currentLocale ) ;
113+ let defaultRecipient = matchedNames . join ( '&' ) ;
99114 // if it have old data
115+ let isSelected = false ;
100116 if ( recipient . matchedNames && recipient . matchedNames [ 0 ] ) {
101117 const firstMatchedName = recipient . matchedNames [ 0 ] ;
102118 const isFind = matchedNames . find ( name => name === firstMatchedName ) ;
103119 if ( isFind ) {
120+ isSelected = true ;
104121 defaultRecipient = firstMatchedName ;
105122 }
106123 const oldMatchedNames = recipient . matchedNames . slice ( ) . sort ( ) ;
@@ -115,11 +132,16 @@ class RecipientHeader extends Component {
115132 onClick = { this . toggleDropdown }
116133 className = { styles . dropdownButton }
117134 />
118- { this . props . dropdownIcon }
135+ < i
136+ className = { classnames ( dynamicsFont . arrow , styles . dropdownIcon ) }
137+ onClick = { this . toggleDropdown }
138+ />
119139 < MatchedNameList
120140 matchedNames = { matchedNames }
121141 className = { dropdownClass }
122142 setDefaultMatchedName = { this . setDefaultMatchedName }
143+ isSelected = { isSelected }
144+ currentLocale = { this . props . currentLocale }
123145 />
124146 </ div >
125147 ) ;
@@ -134,7 +156,6 @@ RecipientHeader.propTypes = {
134156 matchedNames : PropTypes . array ,
135157 } ) . isRequired ,
136158 currentLocale : PropTypes . string . isRequired ,
137- dropdownIcon : PropTypes . node . isRequired ,
138159 dropdownClassName : PropTypes . string . isRequired ,
139160} ;
140161
0 commit comments