|
1 | 1 | import React from 'react'; |
2 | 2 | import styled from 'styled-components'; |
| 3 | +import PropTypes from 'prop-types'; |
3 | 4 | import { bindActionCreators } from 'redux'; |
4 | 5 | import { useDispatch, useSelector } from 'react-redux'; |
5 | | -import { remSize } from '../../theme'; |
| 6 | +import { remSize, prop } from '../../theme'; |
6 | 7 | import IconButton from './IconButton'; |
7 | | -import { TerminalIcon } from '../../common/icons'; |
| 8 | +import { TerminalIcon, FolderIcon } from '../../common/icons'; |
8 | 9 | import * as IDEActions from '../../modules/IDE/actions/ide'; |
9 | 10 |
|
10 | | -const BottomBarContent = styled.h2` |
| 11 | +const BottomBarContent = styled.div` |
11 | 12 | padding: ${remSize(8)}; |
12 | | - |
| 13 | + display: flex; |
| 14 | +
|
13 | 15 | svg { |
14 | 16 | max-height: ${remSize(32)}; |
| 17 | +
|
| 18 | + } |
| 19 | +
|
| 20 | + path { fill: ${prop('primaryTextColor')} !important } |
| 21 | +
|
| 22 | + .inverted { |
| 23 | + path { fill: ${prop('backgroundColor')} !important } |
| 24 | + rect { fill: ${prop('primaryTextColor')} !important } |
15 | 25 | } |
16 | 26 | `; |
17 | 27 |
|
18 | | -export default () => { |
| 28 | +// Maybe this component shouldn't be connected, and instead just receive the `actions` prop |
| 29 | +const ActionStrip = ({ toggleExplorer }) => { |
19 | 30 | const { expandConsole, collapseConsole } = bindActionCreators(IDEActions, useDispatch()); |
20 | 31 | const { consoleIsExpanded } = useSelector(state => state.ide); |
21 | 32 |
|
22 | | - const actions = [{ icon: TerminalIcon, aria: 'Say Something', action: consoleIsExpanded ? collapseConsole : expandConsole }]; |
| 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 | + ]; |
23 | 39 |
|
24 | 40 | return ( |
25 | 41 | <BottomBarContent> |
26 | | - {actions.map(({ icon, aria, action }) => |
27 | | - (<IconButton |
28 | | - icon={icon} |
29 | | - aria-label={aria} |
30 | | - key={`bottom-bar-${aria}`} |
31 | | - onClick={() => action()} |
32 | | - />))} |
| 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 | + />))} |
33 | 54 | </BottomBarContent> |
34 | 55 | ); |
35 | 56 | }; |
| 57 | + |
| 58 | +ActionStrip.propTypes = { |
| 59 | + toggleExplorer: PropTypes.func |
| 60 | +}; |
| 61 | + |
| 62 | +ActionStrip.defaultProps = { |
| 63 | + toggleExplorer: () => {} |
| 64 | +}; |
| 65 | + |
| 66 | +export default ActionStrip; |
0 commit comments