Procházet zdrojové kódy

fix(button-group): use ButtonGroup from the Button package

That standalone ButtonGroup package has been deprecated.
The deprecation warning says to use the ButtonGroup component
from the Button package.
master
Leonard Kim před 8 roky
rodič
revize
c2901808ca

+ 0
- 1
package.json Zobrazit soubor

@@ -17,7 +17,6 @@
17 17
   "dependencies": {
18 18
     "@atlaskit/avatar": "8.0.5",
19 19
     "@atlaskit/button": "5.4.2",
20
-    "@atlaskit/button-group": "1.5.3",
21 20
     "@atlaskit/dropdown-menu": "3.10.2",
22 21
     "@atlaskit/droplist": "4.11.1",
23 22
     "@atlaskit/field-text": "4.0.1",

+ 21
- 12
react/features/base/dialog/components/StatelessDialog.web.js Zobrazit soubor

@@ -1,5 +1,4 @@
1
-import AKButton from '@atlaskit/button';
2
-import AKButtonGroup from '@atlaskit/button-group';
1
+import Button, { ButtonGroup } from '@atlaskit/button';
3 2
 import ModalDialog from '@atlaskit/modal-dialog';
4 3
 import { AtlasKitThemeProvider } from '@atlaskit/theme';
5 4
 import PropTypes from 'prop-types';
@@ -189,12 +188,14 @@ class StatelessDialog extends Component {
189 188
         }
190 189
 
191 190
         return (
192
-            <AKButton
191
+            <Button
193 192
                 appearance = 'subtle'
194 193
                 id = { CANCEL_BUTTON_ID }
195
-                onClick = { this._onCancel }>
194
+                key = 'cancel'
195
+                onClick = { this._onCancel }
196
+                type = 'button'>
196 197
                 { this.props.t(this.props.cancelTitleKey || 'dialog.Cancel') }
197
-            </AKButton>
198
+            </Button>
198 199
         );
199 200
     }
200 201
 
@@ -205,12 +206,18 @@ class StatelessDialog extends Component {
205 206
      * @returns {ReactElement}
206 207
      */
207 208
     _renderFooter() {
209
+        // Filter out falsy (null) values because {@code ButtonGroup} will error
210
+        // if passed in anything but buttons with valid type props.
211
+        const buttons = [
212
+            this._renderCancelButton(),
213
+            this._renderOKButton()
214
+        ].filter(Boolean);
215
+
208 216
         return (
209 217
             <footer className = 'modal-dialog-footer'>
210
-                <AKButtonGroup>
211
-                    { this._renderCancelButton() }
212
-                    { this._renderOKButton() }
213
-                </AKButtonGroup>
218
+                <ButtonGroup>
219
+                    { buttons }
220
+                </ButtonGroup>
214 221
             </footer>
215 222
         );
216 223
     }
@@ -245,14 +252,16 @@ class StatelessDialog extends Component {
245 252
         }
246 253
 
247 254
         return (
248
-            <AKButton
255
+            <Button
249 256
                 appearance = 'primary'
250 257
                 form = 'modal-dialog-form'
251 258
                 id = { OK_BUTTON_ID }
252 259
                 isDisabled = { this.props.okDisabled }
253
-                onClick = { this._onSubmit }>
260
+                key = 'submit'
261
+                onClick = { this._onSubmit }
262
+                type = 'button'>
254 263
                 { this.props.t(this.props.okTitleKey || 'dialog.Ok') }
255
-            </AKButton>
264
+            </Button>
256 265
         );
257 266
     }
258 267
 

Načítá se…
Zrušit
Uložit