11import React from 'react' ;
2- import styled from 'styled-components' ;
32import PropTypes from 'prop-types' ;
4- import { bindActionCreators } from 'redux' ;
5- import { useDispatch , useSelector } from 'react-redux' ;
3+ import styled from 'styled-components' ;
64import { remSize , prop } from '../../theme' ;
75import IconButton from './IconButton' ;
8- import { TerminalIcon , FolderIcon } from '../../common/icons' ;
9- import * as IDEActions from '../../modules/IDE/actions/ide' ;
106
117const BottomBarContent = styled . div `
128 padding: ${ remSize ( 8 ) } ;
13- display: flex;
9+ display: grid;
10+ grid-template-columns: repeat(8,1fr);
1411
1512 svg {
1613 max-height: ${ remSize ( 32 ) } ;
17-
1814 }
1915
2016 path { fill: ${ prop ( 'primaryTextColor' ) } !important }
@@ -25,42 +21,28 @@ const BottomBarContent = styled.div`
2521 }
2622` ;
2723
28- // Maybe this component shouldn't be connected, and instead just receive the `actions` prop
29- const ActionStrip = ( { toggleExplorer } ) => {
30- const { expandConsole, collapseConsole } = bindActionCreators ( IDEActions , useDispatch ( ) ) ;
31- const { consoleIsExpanded } = useSelector ( state => state . ide ) ;
32-
33- const actions = [
34- {
35- icon : TerminalIcon , inverted : true , aria : 'Open terminal console' , action : consoleIsExpanded ? collapseConsole : expandConsole
36- } ,
37- { icon : FolderIcon , aria : 'Open files explorer' , action : toggleExplorer }
38- ] ;
39-
40- return (
41- < BottomBarContent >
42- { actions . map ( ( {
43- icon, aria, action, inverted
44- } ) =>
45- (
46- < IconButton
47- inverted = { inverted }
48- className = { inverted && 'inverted' }
49- icon = { icon }
50- aria-label = { aria }
51- key = { `bottom-bar-${ aria } ` }
52- onClick = { ( ) => action ( ) }
53- /> ) ) }
54- </ BottomBarContent >
55- ) ;
56- } ;
24+ const ActionStrip = ( { actions } ) => (
25+ < BottomBarContent >
26+ { actions . map ( ( {
27+ icon, aria, action, inverted
28+ } ) =>
29+ ( < IconButton
30+ inverted = { inverted }
31+ className = { inverted && 'inverted' }
32+ icon = { icon }
33+ aria-label = { aria }
34+ key = { `bottom-bar-${ aria } ` }
35+ onClick = { action }
36+ /> ) ) }
37+ </ BottomBarContent > ) ;
5738
5839ActionStrip . propTypes = {
59- toggleExplorer : PropTypes . func
60- } ;
61-
62- ActionStrip . defaultProps = {
63- toggleExplorer : ( ) => { }
40+ actions : PropTypes . arrayOf ( PropTypes . shape ( {
41+ icon : PropTypes . any ,
42+ aria : PropTypes . string . isRequired ,
43+ action : PropTypes . func . isRequired ,
44+ inverted : PropTypes . bool
45+ } ) ) . isRequired
6446} ;
6547
6648export default ActionStrip ;
0 commit comments