👌 use common/Button component for IconButton on screens
This commit is contained in:
parent
7d24c07fcc
commit
8a0b09d416
4 changed files with 30 additions and 35 deletions
|
@ -11,8 +11,8 @@ const Header = styled.div`
|
||||||
background: ${background};
|
background: ${background};
|
||||||
color: ${textColor};
|
color: ${textColor};
|
||||||
padding: ${remSize(12)};
|
padding: ${remSize(12)};
|
||||||
padding-left: ${remSize(32)};
|
padding-left: ${remSize(16)};
|
||||||
padding-right: ${remSize(32)};
|
padding-right: ${remSize(16)};
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -20,6 +20,11 @@ const Header = styled.div`
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
svg {
|
||||||
|
height: 2rem;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default Header;
|
export default Header;
|
||||||
|
|
|
@ -7,14 +7,14 @@ const ButtonWrapper = styled(Button)`
|
||||||
width: 3rem;
|
width: 3rem;
|
||||||
> svg {
|
> svg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: 100%;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const IconButton = ({ children }) => (<ButtonWrapper
|
const IconButton = props => (<ButtonWrapper
|
||||||
aria-label="Add to collection"
|
iconBefore={props.children}
|
||||||
iconBefore={children}
|
|
||||||
kind={Button.kinds.inline}
|
kind={Button.kinds.inline}
|
||||||
|
{...{ ...props, children: null }}
|
||||||
/>);
|
/>);
|
||||||
|
|
||||||
IconButton.propTypes = {
|
IconButton.propTypes = {
|
||||||
|
|
|
@ -30,10 +30,13 @@ import Screen from '../../../components/mobile/MobileScreen';
|
||||||
import Footer from '../../../components/mobile/Footer';
|
import Footer from '../../../components/mobile/Footer';
|
||||||
import IDEWrapper from '../../../components/mobile/IDEWrapper';
|
import IDEWrapper from '../../../components/mobile/IDEWrapper';
|
||||||
|
|
||||||
const IconLinkWrapper = styled(Link)`
|
const IconContainer = styled.div`
|
||||||
width: 3rem;
|
marginLeft: 2rem;
|
||||||
margin-right: 1.25rem;
|
display: flex;
|
||||||
margin-left: none;
|
`;
|
||||||
|
|
||||||
|
const TitleContainer = styled.div`
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const isUserOwner = ({ project, user }) => (project.owner && project.owner.id === user.id);
|
const isUserOwner = ({ project, user }) => (project.owner && project.owner.id === user.id);
|
||||||
|
@ -53,30 +56,22 @@ const IDEViewMobile = (props) => {
|
||||||
return (
|
return (
|
||||||
<Screen>
|
<Screen>
|
||||||
<Header>
|
<Header>
|
||||||
<IconLinkWrapper to="/" aria-label="Return to original editor">
|
<IconButton to="/mobile" aria-label="Return to original editor">
|
||||||
<ExitIcon />
|
<ExitIcon viewBox="0 0 16 16" />
|
||||||
</IconLinkWrapper>
|
</IconButton>
|
||||||
<div>
|
<div style={{ marginLeft: '1rem' }}>
|
||||||
<h2>{project.name}</h2>
|
<h2>{project.name}</h2>
|
||||||
<h3>{selectedFile.name}</h3>
|
<h3>{selectedFile.name}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ marginLeft: '2rem', display: 'flex' }}>
|
<IconContainer>
|
||||||
<IconButton onClick={() => setOverlay('preferences')}>
|
<IconButton onClick={() => setOverlay('preferences')}>
|
||||||
<PreferencesIcon focusable="false" aria-hidden="true" />
|
<PreferencesIcon focusable="false" aria-hidden="true" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Link
|
<IconButton to="/mobile/preview" onClick={() => { startSketch(); }}>
|
||||||
to="/mobile/preview"
|
<PlayIcon viewBox="-1 -1 7 7" focusable="false" aria-hidden="true" />
|
||||||
onClick={() => {
|
</IconButton>
|
||||||
// alert('starting sketch');
|
</IconContainer>
|
||||||
startSketch();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IconButton>
|
|
||||||
<PlayIcon viewBox="-1 -1 7 7" focusable="false" aria-hidden="true" />
|
|
||||||
</IconButton>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<IDEWrapper>
|
<IDEWrapper>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Header from '../../components/mobile/Header';
|
import Header from '../../components/mobile/Header';
|
||||||
|
import IconButton from '../../components/mobile/IconButton';
|
||||||
import PreviewFrame from '../IDE/components/PreviewFrame';
|
import PreviewFrame from '../IDE/components/PreviewFrame';
|
||||||
import Screen from '../../components/mobile/MobileScreen';
|
import Screen from '../../components/mobile/MobileScreen';
|
||||||
import * as ProjectActions from '../IDE/actions/project';
|
import * as ProjectActions from '../IDE/actions/project';
|
||||||
|
@ -25,12 +26,6 @@ const Content = styled.div`
|
||||||
margin-top: ${remSize(68)};
|
margin-top: ${remSize(68)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const IconLinkWrapper = styled(Link)`
|
|
||||||
width: 2rem;
|
|
||||||
margin-right: 1.25rem;
|
|
||||||
margin-left: none;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const MobileSketchView = (props) => {
|
const MobileSketchView = (props) => {
|
||||||
// TODO: useSelector requires react-redux ^7.1.0
|
// TODO: useSelector requires react-redux ^7.1.0
|
||||||
// const htmlFile = useSelector(state => getHTMLFile(state.files));
|
// const htmlFile = useSelector(state => getHTMLFile(state.files));
|
||||||
|
@ -55,9 +50,9 @@ const MobileSketchView = (props) => {
|
||||||
return (
|
return (
|
||||||
<Screen>
|
<Screen>
|
||||||
<Header>
|
<Header>
|
||||||
<IconLinkWrapper to="/mobile" aria-label="Return to original editor">
|
<IconButton to="/mobile" aria-label="Return to original editor">
|
||||||
<ExitIcon viewBox="0 0 16 16" />
|
<ExitIcon viewBox="0 0 16 16" />
|
||||||
</IconLinkWrapper>
|
</IconButton>
|
||||||
<div>
|
<div>
|
||||||
<h2>{projectName}</h2>
|
<h2>{projectName}</h2>
|
||||||
<h3><br /></h3>
|
<h3><br /></h3>
|
||||||
|
|
Loading…
Reference in a new issue