👌 move files button to bottom bar

This commit is contained in:
ghalestrilo 2020-08-11 18:03:09 -03:00
parent b88a40327e
commit d667b4b0c8
4 changed files with 53 additions and 23 deletions

View file

@ -16,6 +16,8 @@ import More from '../images/more.svg';
import Code from '../images/code.svg'; import Code from '../images/code.svg';
import Terminal from '../images/terminal.svg'; import Terminal from '../images/terminal.svg';
import Folder from '../images/folder-padded.svg';
import CircleTerminal from '../images/circle-terminal.svg'; import CircleTerminal from '../images/circle-terminal.svg';
import CircleFolder from '../images/circle-folder.svg'; import CircleFolder from '../images/circle-folder.svg';
import CircleInfo from '../images/circle-info.svg'; import CircleInfo from '../images/circle-info.svg';
@ -86,6 +88,8 @@ export const MoreIcon = withLabel(More);
export const TerminalIcon = withLabel(Terminal); export const TerminalIcon = withLabel(Terminal);
export const CodeIcon = withLabel(Code); export const CodeIcon = withLabel(Code);
export const FolderIcon = withLabel(Folder);
export const CircleTerminalIcon = withLabel(CircleTerminal); export const CircleTerminalIcon = withLabel(CircleTerminal);
export const CircleFolderIcon = withLabel(CircleFolder); export const CircleFolderIcon = withLabel(CircleFolder);
export const CircleInfoIcon = withLabel(CircleInfo); export const CircleInfoIcon = withLabel(CircleInfo);

View file

@ -1,35 +1,66 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import PropTypes from 'prop-types';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { remSize } from '../../theme'; import { remSize, prop } from '../../theme';
import IconButton from './IconButton'; import IconButton from './IconButton';
import { TerminalIcon } from '../../common/icons'; import { TerminalIcon, FolderIcon } from '../../common/icons';
import * as IDEActions from '../../modules/IDE/actions/ide'; import * as IDEActions from '../../modules/IDE/actions/ide';
const BottomBarContent = styled.h2` const BottomBarContent = styled.div`
padding: ${remSize(8)}; padding: ${remSize(8)};
display: flex;
svg { svg {
max-height: ${remSize(32)}; max-height: ${remSize(32)};
}
path { fill: ${prop('primaryTextColor')} !important }
.inverted {
path { fill: ${prop('backgroundColor')} !important }
rect { fill: ${prop('primaryTextColor')} !important }
} }
`; `;
export default () => { // Maybe this component shouldn't be connected, and instead just receive the `actions` prop
const ActionStrip = ({ toggleExplorer }) => {
const { expandConsole, collapseConsole } = bindActionCreators(IDEActions, useDispatch()); const { expandConsole, collapseConsole } = bindActionCreators(IDEActions, useDispatch());
const { consoleIsExpanded } = useSelector(state => state.ide); const { consoleIsExpanded } = useSelector(state => state.ide);
const actions = [{ icon: TerminalIcon, aria: 'Say Something', action: consoleIsExpanded ? collapseConsole : expandConsole }]; const actions = [
{
icon: TerminalIcon, inverted: true, aria: 'Open terminal console', action: consoleIsExpanded ? collapseConsole : expandConsole
},
{ icon: FolderIcon, aria: 'Open files explorer', action: toggleExplorer }
];
return ( return (
<BottomBarContent> <BottomBarContent>
{actions.map(({ icon, aria, action }) => {actions.map(({
(<IconButton icon, aria, action, inverted
icon={icon} }) =>
aria-label={aria} (
key={`bottom-bar-${aria}`} <IconButton
onClick={() => action()} inverted={inverted}
/>))} className={inverted && 'inverted'}
icon={icon}
aria-label={aria}
key={`bottom-bar-${aria}`}
onClick={() => action()}
/>))}
</BottomBarContent> </BottomBarContent>
); );
}; };
ActionStrip.propTypes = {
toggleExplorer: PropTypes.func
};
ActionStrip.defaultProps = {
toggleExplorer: () => {}
};
export default ActionStrip;

View file

@ -0,0 +1,4 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M25.144 12.0961V22.4321C25.144 22.8801 24.792 23.2321 24.344 23.2321H7.768C7.32 23.2321 7 22.8801 7 22.4321V12.0961C7 11.2321 7.704 10.5281 8.568 10.5281H23.576C24.44 10.5281 25.144 11.2321 25.144 12.0961Z" fill="#F0F0F0"/>
<path d="M9.24023 9.6C9.24023 9.6 9.24023 8 10.5842 8H15.1282C16.4402 8 16.4402 9.6 16.4402 9.6H9.24023Z" fill="#F0F0F0"/>
</svg>

After

Width:  |  Height:  |  Size: 459 B

View file

@ -35,8 +35,6 @@ import ActionStrip from '../../../components/mobile/ActionStrip';
import useAsModal from '../../../components/useAsModal'; import useAsModal from '../../../components/useAsModal';
import { PreferencesIcon } from '../../../common/icons'; import { PreferencesIcon } from '../../../common/icons';
import Dropdown from '../../../components/Dropdown'; import Dropdown from '../../../components/Dropdown';
import FloatingNav from '../../../components/mobile/FloatingNav';
const getRootFile = files => files && files.filter(file => file.name === 'root')[0]; const getRootFile = files => files && files.filter(file => file.name === 'root')[0];
const getRootFileID = files => (root => root && root.id)(getRootFile(files)); const getRootFileID = files => (root => root && root.id)(getRootFile(files));
@ -123,12 +121,6 @@ const MobileIDEView = (props) => {
onPressClose={toggle} onPressClose={toggle}
/>), true); />), true);
// toggle sidebar starting opened
// useEffect(toggleExplorer, []);
const floatingNavOptions =
[{ icon: CircleFolderIcon, onPress: toggleExplorer }];
return ( return (
<Screen fullscreen> <Screen fullscreen>
<Explorer /> <Explorer />
@ -183,7 +175,6 @@ const MobileIDEView = (props) => {
provideController={setTmController} provideController={setTmController}
setUnsavedChanges={setUnsavedChanges} setUnsavedChanges={setUnsavedChanges}
/> />
<FloatingNav items={floatingNavOptions} />
</IDEWrapper> </IDEWrapper>
<Footer> <Footer>
@ -192,7 +183,7 @@ const MobileIDEView = (props) => {
<Console /> <Console />
</Expander> </Expander>
)} )}
<ActionStrip /> <ActionStrip toggleExplorer={toggleExplorer} />
</Footer> </Footer>
</Screen> </Screen>
); );