Skip to content

Commit 4ac8fa0

Browse files
committed
✨ make console-expanding button on bottom bar
1 parent 604add5 commit 4ac8fa0

File tree

4 files changed

+53
-9
lines changed

4 files changed

+53
-9
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
import { bindActionCreators } from 'redux';
4+
import { useDispatch } from 'react-redux';
5+
import { prop, remSize } from '../../theme';
6+
import IconButton from './IconButton';
7+
import { ExitIcon } from '../../common/icons';
8+
import * as IDEActions from '../../modules/IDE/actions/ide';
9+
10+
const background = prop('MobilePanel.default.background');
11+
const textColor = prop('primaryTextColor');
12+
13+
const BottomBarContent = styled.h2`
14+
padding: ${remSize(12)};
15+
16+
svg {
17+
max-height: ${remSize(32)};
18+
padding: ${remSize(4)}
19+
}
20+
`;
21+
22+
export default () => {
23+
const { expandConsole } = bindActionCreators(IDEActions, useDispatch());
24+
25+
const actions = [{ icon: ExitIcon, aria: 'Say Something', action: expandConsole }];
26+
27+
return (
28+
<BottomBarContent>
29+
{actions.map(({ icon, aria, action }) =>
30+
(<IconButton
31+
icon={icon}
32+
aria-label={aria}
33+
key={`bottom-bar-${aria}`}
34+
onClick={() => action()}
35+
/>))}
36+
</BottomBarContent>
37+
);
38+
};

client/components/mobile/Footer.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import styled from 'styled-components';
3-
import { prop } from '../../theme';
3+
import { prop, grays } from '../../theme';
44

55

66
const background = prop('MobilePanel.default.background');
@@ -12,4 +12,6 @@ export default styled.div`
1212
bottom: 0;
1313
background: ${background};
1414
color: ${textColor};
15+
16+
& > * + * { border-top: dashed 1px ${prop('Separator')} }
1517
`;

client/modules/IDE/pages/MobileIDEView.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ import Footer from '../../../components/mobile/Footer';
2828
import IDEWrapper from '../../../components/mobile/IDEWrapper';
2929
import Console from '../components/Console';
3030
import { remSize } from '../../../theme';
31+
import ActionStrip from '../../../components/mobile/ActionStrip';
3132

3233
const isUserOwner = ({ project, user }) => (project.owner && project.owner.id === user.id);
3334

34-
const BottomBarContent = styled.h2`
35-
padding: ${remSize(12)};
36-
padding-left: ${remSize(32)};
35+
36+
const Expander = styled.div`
37+
height: ${props => (props.expanded ? remSize(160) : remSize(27))};
3738
`;
3839

3940
const MobileIDEView = (props) => {
@@ -103,8 +104,8 @@ const MobileIDEView = (props) => {
103104
/>
104105
</IDEWrapper>
105106
<Footer>
106-
<Console />
107-
<BottomBarContent>Bottom Bar</BottomBarContent>
107+
{ide.consoleIsExpanded && <Expander expanded><Console /></Expander>}
108+
<ActionStrip />
108109
</Footer>
109110
</Screen>
110111
);

client/theme.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ export default {
9696
background: grays.light,
9797
border: grays.middleLight,
9898
},
99-
}
99+
},
100+
Separator: grays.middleLight,
100101
},
101102
[Theme.dark]: {
102103
colors,
@@ -136,7 +137,8 @@ export default {
136137
background: grays.dark,
137138
border: grays.middleDark,
138139
},
139-
}
140+
},
141+
Separator: grays.middleDark,
140142
},
141143
[Theme.contrast]: {
142144
colors,
@@ -176,6 +178,7 @@ export default {
176178
background: grays.dark,
177179
border: grays.middleDark,
178180
},
179-
}
181+
},
182+
Separator: grays.middleDark,
180183
},
181184
};

0 commit comments

Comments
 (0)