|
@@ -1,4 +1,3 @@
|
1
|
|
-import AKButton from '@atlaskit/button';
|
2
|
1
|
import AKDropdownMenu from '@atlaskit/dropdown-menu';
|
3
|
2
|
import ExpandIcon from '@atlaskit/icon/glyph/expand';
|
4
|
3
|
import React, { Component } from 'react';
|
|
@@ -97,37 +96,29 @@ class DeviceSelector extends Component {
|
97
|
96
|
defaultSelected,
|
98
|
97
|
isDisabled: this.props.isDisabled,
|
99
|
98
|
items,
|
100
|
|
- placeholder: 'deviceSelection.selectADevice'
|
|
99
|
+ placeholder: this.props.t('deviceSelection.selectADevice')
|
101
|
100
|
});
|
102
|
101
|
}
|
103
|
102
|
|
104
|
103
|
/**
|
105
|
|
- * Creates an AtlasKit Button.
|
|
104
|
+ * Creates a React Element for displaying the passed in text surrounded by
|
|
105
|
+ * two icons. The left icon is the icon class passed in through props and
|
|
106
|
+ * the right icon is AtlasKit ExpandIcon.
|
106
|
107
|
*
|
107
|
|
- * @param {string} buttonText - The text to display within the button.
|
|
108
|
+ * @param {string} triggerText - The text to display within the element.
|
108
|
109
|
* @private
|
109
|
110
|
* @returns {ReactElement}
|
110
|
111
|
*/
|
111
|
|
- _createDropdownTrigger(buttonText) {
|
|
112
|
+ _createDropdownTrigger(triggerText) {
|
112
|
113
|
return (
|
113
|
|
- <AKButton
|
114
|
|
- className = 'device-selector-trigger'
|
115
|
|
- iconAfter = { EXPAND_ICON }
|
116
|
|
- iconBefore = { this._createDropdownIcon() }>
|
117
|
|
- { buttonText }
|
118
|
|
- </AKButton>
|
119
|
|
- );
|
120
|
|
- }
|
121
|
|
-
|
122
|
|
- /**
|
123
|
|
- * Creates a ReactComponent for displaying an icon.
|
124
|
|
- *
|
125
|
|
- * @private
|
126
|
|
- * @returns {ReactElement}
|
127
|
|
- */
|
128
|
|
- _createDropdownIcon() {
|
129
|
|
- return (
|
130
|
|
- <span className = { `device-selector-icon ${this.props.icon}` } />
|
|
114
|
+ <div className = 'device-selector-trigger'>
|
|
115
|
+ <span
|
|
116
|
+ className = { `device-selector-icon ${this.props.icon}` } />
|
|
117
|
+ <span className = 'device-selector-trigger-text'>
|
|
118
|
+ { triggerText }
|
|
119
|
+ </span>
|
|
120
|
+ { EXPAND_ICON }
|
|
121
|
+ </div>
|
131
|
122
|
);
|
132
|
123
|
}
|
133
|
124
|
|
|
@@ -171,7 +162,8 @@ class DeviceSelector extends Component {
|
171
|
162
|
items = { [ { items: options.items || [] } ] }
|
172
|
163
|
noMatchesFound
|
173
|
164
|
= { this.props.t('deviceSelection.noOtherDevices') }
|
174
|
|
- onItemActivated = { this._onSelect }>
|
|
165
|
+ onItemActivated = { this._onSelect }
|
|
166
|
+ shouldFitContainer = { true }>
|
175
|
167
|
{ this._createDropdownTrigger(triggerText) }
|
176
|
168
|
</AKDropdownMenu>
|
177
|
169
|
);
|