Skip to content

Commit d667b4b

Browse files
committed
👌 move files button to bottom bar
1 parent b88a403 commit d667b4b

File tree

4 files changed

+53
-23
lines changed

4 files changed

+53
-23
lines changed

client/common/icons.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import More from '../images/more.svg';
1616
import Code from '../images/code.svg';
1717
import Terminal from '../images/terminal.svg';
1818

19+
import Folder from '../images/folder-padded.svg';
20+
1921
import CircleTerminal from '../images/circle-terminal.svg';
2022
import CircleFolder from '../images/circle-folder.svg';
2123
import CircleInfo from '../images/circle-info.svg';
@@ -86,6 +88,8 @@ export const MoreIcon = withLabel(More);
8688
export const TerminalIcon = withLabel(Terminal);
8789
export const CodeIcon = withLabel(Code);
8890

91+
export const FolderIcon = withLabel(Folder);
92+
8993
export const CircleTerminalIcon = withLabel(CircleTerminal);
9094
export const CircleFolderIcon = withLabel(CircleFolder);
9195
export const CircleInfoIcon = withLabel(CircleInfo);
Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,66 @@
11
import React from 'react';
22
import styled from 'styled-components';
3+
import PropTypes from 'prop-types';
34
import { bindActionCreators } from 'redux';
45
import { useDispatch, useSelector } from 'react-redux';
5-
import { remSize } from '../../theme';
6+
import { remSize, prop } from '../../theme';
67
import IconButton from './IconButton';
7-
import { TerminalIcon } from '../../common/icons';
8+
import { TerminalIcon, FolderIcon } from '../../common/icons';
89
import * as IDEActions from '../../modules/IDE/actions/ide';
910

10-
const BottomBarContent = styled.h2`
11+
const BottomBarContent = styled.div`
1112
padding: ${remSize(8)};
12-
13+
display: flex;
14+
1315
svg {
1416
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 }
1525
}
1626
`;
1727

18-
export default () => {
28+
// Maybe this component shouldn't be connected, and instead just receive the `actions` prop
29+
const ActionStrip = ({ toggleExplorer }) => {
1930
const { expandConsole, collapseConsole } = bindActionCreators(IDEActions, useDispatch());
2031
const { consoleIsExpanded } = useSelector(state => state.ide);
2132

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+
];
2339

2440
return (
2541
<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+
/>))}
3354
</BottomBarContent>
3455
);
3556
};
57+
58+
ActionStrip.propTypes = {
59+
toggleExplorer: PropTypes.func
60+
};
61+
62+
ActionStrip.defaultProps = {
63+
toggleExplorer: () => {}
64+
};
65+
66+
export default ActionStrip;

client/images/folder-padded.svg

Lines changed: 4 additions & 0 deletions
Loading

client/modules/IDE/pages/MobileIDEView.jsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ import ActionStrip from '../../../components/mobile/ActionStrip';
3535
import useAsModal from '../../../components/useAsModal';
3636
import { PreferencesIcon } from '../../../common/icons';
3737
import Dropdown from '../../../components/Dropdown';
38-
import FloatingNav from '../../../components/mobile/FloatingNav';
39-
4038

4139
const getRootFile = files => files && files.filter(file => file.name === 'root')[0];
4240
const getRootFileID = files => (root => root && root.id)(getRootFile(files));
@@ -123,12 +121,6 @@ const MobileIDEView = (props) => {
123121
onPressClose={toggle}
124122
/>), true);
125123

126-
// toggle sidebar starting opened
127-
// useEffect(toggleExplorer, []);
128-
129-
const floatingNavOptions =
130-
[{ icon: CircleFolderIcon, onPress: toggleExplorer }];
131-
132124
return (
133125
<Screen fullscreen>
134126
<Explorer />
@@ -183,7 +175,6 @@ const MobileIDEView = (props) => {
183175
provideController={setTmController}
184176
setUnsavedChanges={setUnsavedChanges}
185177
/>
186-
<FloatingNav items={floatingNavOptions} />
187178
</IDEWrapper>
188179

189180
<Footer>
@@ -192,7 +183,7 @@ const MobileIDEView = (props) => {
192183
<Console />
193184
</Expander>
194185
)}
195-
<ActionStrip />
186+
<ActionStrip toggleExplorer={toggleExplorer} />
196187
</Footer>
197188
</Screen>
198189
);

0 commit comments

Comments
 (0)