@@ -5,7 +5,7 @@ import { nanoid } from 'nanoid';
55import PropTypes from 'prop-types' ;
66import React from 'react' ;
77
8- import Button from './components/Button ' ;
8+ import GlobalActions from './components/GlobalActions ' ;
99import TreeNode from './components/TreeNode' ;
1010import defaultLang from './lang/default' ;
1111import iconsShape from './shapes/iconsShape' ;
@@ -288,35 +288,14 @@ class CheckboxTree extends React.Component {
288288 ) ;
289289 }
290290
291- renderExpandAll ( ) {
292- const {
293- icons : { expandAll, collapseAll } ,
294- lang,
295- showExpandAll,
296- } = this . props ;
291+ renderGlobalOptions ( ) {
292+ const { showExpandAll } = this . props ;
297293
298294 if ( ! showExpandAll ) {
299295 return null ;
300296 }
301297
302- return (
303- < div className = "rct-options" >
304- < Button
305- className = "rct-option rct-option-expand-all"
306- title = { lang . expandAll }
307- onClick = { this . onExpandAll }
308- >
309- { expandAll }
310- </ Button >
311- < Button
312- className = "rct-option rct-option-collapse-all"
313- title = { lang . collapseAll }
314- onClick = { this . onCollapseAll }
315- >
316- { collapseAll }
317- </ Button >
318- </ div >
319- ) ;
298+ return < GlobalActions onCollapseAll = { this . onCollapseAll } onExpandAll = { this . onExpandAll } /> ;
320299 }
321300
322301 renderHiddenInput ( ) {
@@ -377,7 +356,7 @@ class CheckboxTree extends React.Component {
377356 < div className = { className } id = { id } >
378357 < LanguageContext . Provider value = { lang } >
379358 < IconContext . Provider value = { mergedIcons } >
380- { this . renderExpandAll ( ) }
359+ { this . renderGlobalOptions ( ) }
381360 { this . renderHiddenInput ( ) }
382361 { treeNodes }
383362 </ IconContext . Provider >
0 commit comments