Skip to content

Commit 9e6dc33

Browse files
Merge branch 'master' of https://github.com/Detaysoft/react-chat-elements into chat-item-status
2 parents e870fec + 207f98c commit 9e6dc33

5 files changed

Lines changed: 76 additions & 11 deletions

File tree

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,27 @@ import { Dropdown } from 'react-chat-elements'
412412
text: 'Dropdown',
413413
}}
414414
items={[
415-
'merhaba',
416-
'lorem',
417-
'ipsum',
418-
'dolor',
419-
'sit',
420-
'amet',
415+
{
416+
icon: {
417+
component: icon,
418+
float: 'left',
419+
color: 'red',
420+
size: 22,
421+
},
422+
text: 'lorem'
423+
},
424+
{
425+
icon: {
426+
component: icon,
427+
float: 'left',
428+
color: 'purple',
429+
size: 22,
430+
},
431+
text: 'ipsum'
432+
},
433+
{
434+
text: 'dolor'
435+
},
421436
]}/>
422437
```
423438

example/App.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import FaSearch from 'react-icons/lib/fa/search';
1818
import FaComments from 'react-icons/lib/fa/comments';
1919
import FaClose from 'react-icons/lib/fa/close';
2020
import FaMenu from 'react-icons/lib/md/more-vert';
21+
import FaSquare from 'react-icons/lib/md/crop-square';
22+
2123
import {
2224
format,
2325
} from 'timeago.js';
@@ -133,6 +135,7 @@ export class App extends Component {
133135
dropdownMenu: (
134136
<Dropdown
135137
animationPosition="norteast"
138+
title='Dropdown Title'
136139
buttonProps={{
137140
type: "transparent",
138141
color: "#cecece",
@@ -142,9 +145,33 @@ export class App extends Component {
142145
}
143146
}}
144147
items={[
145-
'Menu Item1',
146-
'Menu Item2',
147-
'Menu Item3',
148+
{
149+
icon: {
150+
component: <FaSquare />,
151+
float: 'left',
152+
color: 'red',
153+
size: 22,
154+
},
155+
text: 'Menu Item'
156+
},
157+
{
158+
icon: {
159+
component: <FaSquare/>,
160+
float: 'left',
161+
color: 'purple',
162+
size: 22,
163+
},
164+
text: 'Menu Item'
165+
},
166+
{
167+
icon: {
168+
component: <FaSquare/>,
169+
float: 'left',
170+
color: 'yellow',
171+
size: 22,
172+
},
173+
text: 'Menu Item'
174+
},
148175
]} />
149176
),
150177
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-chat-elements",
3-
"version": "10.7.1",
3+
"version": "10.7.2",
44
"description": "Reactjs chat components",
55
"author": "Avare Kodcu <abdurrahmaneker58@gmail.com>",
66
"main": "dist/main.js",

src/Dropdown/Dropdown.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
z-index: 99999;
1919
}
2020

21+
.rce-dropdown-title {
22+
font-size: 14px;
23+
color: '#000';
24+
font-weight: 500;
25+
}
26+
2127
.rce-dropdown.dropdown-show{
2228
animation: dropdown-scaling 0.2s ease forwards;
2329
display: flex;

src/Dropdown/Dropdown.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,27 @@ export class Dropdown extends Component {
3636
{ 'dropdown-show': this.state.show === true })}>
3737

3838
<ul>
39+
{
40+
this.props.title &&
41+
<span className='rce-dropdown-title'>{this.props.title}</span>
42+
}
3943
{
4044
this.props.items.map((x, i) => (
4145
<li key={i} onMouseDown={(e) => this.props.onSelect(i)}>
42-
<a>{x}</a>
46+
{
47+
x instanceof Object ?
48+
x.icon ?
49+
<span className='rce-button-icon--container'>
50+
{(x.icon.float === 'right' || !x.icon.float) && <a>{x.text}</a>}
51+
52+
<span style={{ float: x.icon.float, color: x.icon.color, fontSize: x.icon.size || 12 }} className={classNames('rce-button-icon', x.icon.className)}>{x.icon.component}</span>
53+
54+
{x.icon.float === 'left' && <a>{x.text}</a>}
55+
</span>
56+
: <a>{x.text}</a>
57+
:
58+
<a>{x}</a>
59+
}
4360
</li>
4461
))
4562
}

0 commit comments

Comments
 (0)