-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Mobile Sketch Preview Screen #1467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
0d119aa
bdedc63
0877d39
5c80702
49a9fe7
e5bbb53
0633c3b
e11756d
8a067a8
123c2b0
d00506a
a11bc44
776c3d2
eb3bc59
0e66756
597cb9b
7604e27
ec8566f
ebb9525
75bd5a3
1eb1bff
c39211d
78ec304
9ca0995
7d24c07
8a0b09d
7805acc
a1d6abf
3143cc3
b4c1b86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
import { prop, remSize } from '../../theme'; | ||
import Button from '../../common/Button'; | ||
|
||
const textColor = prop('primaryTextColor'); | ||
|
||
const IconButton = styled.button` | ||
const ButtonWrapper = styled(Button)` | ||
width: 3rem; | ||
> svg { | ||
width: 100%; | ||
height: auto; | ||
fill: ${textColor}; | ||
stroke: ${textColor}; | ||
height: 100%; | ||
} | ||
`; | ||
|
||
const IconButton = props => (<ButtonWrapper | ||
iconBefore={props.children} | ||
kind={Button.kinds.inline} | ||
{...{ ...props, children: null }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you need to put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's null if I don't pass anything, but in this case I wanted to pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I introduced an |
||
/>); | ||
|
||
IconButton.propTypes = { | ||
children: PropTypes.element.isRequired | ||
}; | ||
|
||
export default IconButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/* eslint-disable */ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
|
@@ -23,59 +22,56 @@ import { getHTMLFile } from '../reducers/files'; | |
import Editor from '../components/Editor'; | ||
import { ExitIcon } from '../../../common/icons'; | ||
|
||
import PreferencesIcon from '../../../images/preferences.svg'; | ||
import PlayIcon from '../../../images/triangle-arrow-right.svg'; | ||
import { PreferencesIcon, PlayIcon } from '../../../common/icons'; | ||
|
||
import IconButton from '../../../components/mobile/IconButton'; | ||
import Header from '../../../components/mobile/Header'; | ||
import Screen from '../../../components/mobile/MobileScreen'; | ||
import Footer from '../../../components/mobile/Footer'; | ||
import IDEWrapper from '../../../components/mobile/IDEWrapper'; | ||
|
||
const IconLinkWrapper = styled(Link)` | ||
width: 3rem; | ||
margin-right: 1.25rem; | ||
margin-left: none; | ||
const IconContainer = styled.div` | ||
marginLeft: 2rem; | ||
display: flex; | ||
`; | ||
|
||
const TitleContainer = styled.div` | ||
|
||
`; | ||
|
||
const isUserOwner = ({ project, user }) => (project.owner && project.owner.id === user.id); | ||
|
||
const IDEViewMobile = (props) => { | ||
const { | ||
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage, selectedFile, updateFileContent, files, closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges, startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console, showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch | ||
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage, | ||
selectedFile, updateFileContent, files, | ||
closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges, | ||
startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console, | ||
showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch | ||
} = props; | ||
|
||
const [tmController, setTmController] = useState(null); | ||
|
||
const [overlay, setOverlay] = useState(null); | ||
const [tmController, setTmController] = useState(null); // eslint-disable-line | ||
const [overlay, setOverlay] = useState(null); // eslint-disable-line | ||
|
||
return ( | ||
<Screen> | ||
<Header> | ||
<IconLinkWrapper to="/" aria-label="Return to original editor"> | ||
<ExitIcon /> | ||
</IconLinkWrapper> | ||
<div> | ||
<IconButton to="/mobile" aria-label="Return to original editor"> | ||
<ExitIcon viewBox="0 0 16 16" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you using viewbox here to change the size of the icon? I would prefer if you explicitly set the width and height, and maybe this needs to be added to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll remove the |
||
</IconButton> | ||
<div style={{ marginLeft: '1rem' }}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if possible i would prefer to not have inline styles! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The next PR fixes this by improving the structure of the |
||
<h2>{project.name}</h2> | ||
<h3>{selectedFile.name}</h3> | ||
</div> | ||
|
||
<div style={{ marginLeft: '2rem' }}> | ||
<IconContainer> | ||
<IconButton onClick={() => setOverlay('preferences')}> | ||
<PreferencesIcon focusable="false" aria-hidden="true" /> | ||
</IconButton> | ||
<Link | ||
to="/mobile/preview" | ||
onClick={() => { | ||
// alert('starting sketch'); | ||
startSketch(); | ||
}} | ||
> | ||
<IconButton> | ||
<PlayIcon viewBox="-1 -1 7 7" focusable="false" aria-hidden="true" /> | ||
</IconButton> | ||
</Link> | ||
</div> | ||
<IconButton to="/mobile/preview" onClick={() => { startSketch(); }}> | ||
<PlayIcon viewBox="-1 -1 7 7" focusable="false" aria-hidden="true" /> | ||
</IconButton> | ||
</IconContainer> | ||
</Header> | ||
|
||
<IDEWrapper> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* eslint-disable */ | ||
import React, { useEffect } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Link } from 'react-router'; | ||
import { bindActionCreators } from 'redux'; | ||
import { connect } from 'react-redux'; | ||
import styled from 'styled-components'; | ||
import Header from '../../components/mobile/Header'; | ||
import IconButton from '../../components/mobile/IconButton'; | ||
import PreviewFrame from '../IDE/components/PreviewFrame'; | ||
import Screen from '../../components/mobile/MobileScreen'; | ||
import * as ProjectActions from '../IDE/actions/project'; | ||
|
@@ -26,12 +26,6 @@ const Content = styled.div` | |
margin-top: ${remSize(68)}; | ||
`; | ||
|
||
const IconLinkWrapper = styled(Link)` | ||
width: 2rem; | ||
margin-right: 1.25rem; | ||
margin-left: none; | ||
`; | ||
|
||
const MobileSketchView = (props) => { | ||
// TODO: useSelector requires react-redux ^7.1.0 | ||
// const htmlFile = useSelector(state => getHTMLFile(state.files)); | ||
|
@@ -53,18 +47,13 @@ const MobileSketchView = (props) => { | |
|
||
const { preferences, ide } = props; | ||
|
||
useEffect(() => { | ||
// console.log(params); | ||
// getProject(params.project_id, params.username); | ||
}); | ||
|
||
return ( | ||
<Screen> | ||
<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" /> | ||
</IconLinkWrapper> | ||
<div> | ||
</IconButton> | ||
<div style={{ marginLeft: '1rem' }}> | ||
<h2>{projectName}</h2> | ||
<h3><br /></h3> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the purpose of this mark-up?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It just heightens the header by an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might have to use CSS to add padding to the h2? And maybe set the previous screens header to a know height? Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I'm fixing this on the next PR, and improving the |
||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,13 @@ export default { | |
Icon: { | ||
default: grays.middleGray, | ||
hover: grays.darker | ||
}, | ||
Panel: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are same colours as the buttons, so we'll have a problem if someone later puts a Button on top of a Panel as they'll be the same. Shall we take the colours from the console header component? Cassie made accessibility colour changes a a while back to ensure the contrast worked across all the themes. So:
The colours are here. I know it's a bit of a pain to do this, but it'll really help with the move to styled-components and away from SCSS and helping to make the design more consistent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, but these are the colors that Panels use on the mobile UI (on Headers and Footers at least), so I'm not sure what to do. I wonder if they even mean the same thing on both UIs. I think I'll create a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If possible, it would be great to have the same set of colours work for mobile and the legacy UI. My feeling is branching the theme into Panel.mobile and Panel.notMobile creates more code for us to maintain. Your right that maybe this isn't a reusable panel colour, so if it's not possible to find common colours, then my preference is that we name the variable something other than Panel. @catarak, what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I investigated this a bit, and It's an important decision that goes beyond the scope of the PR, so I'll create an issue and we can discuss it there! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, good idea. So shall we call this MobilePanel or something for now and we can get this merged in? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @andrewn, that it would be helpful if possible to not have mobile specific colors. @ghalestrilo and I talked this over and thought it would make sense to open a new issue/PR with respect to the panel and button color contrasts, see #1484. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! I'll update this :) |
||
default: { | ||
foreground: colors.black, | ||
background: grays.light, | ||
border: grays.middleLight, | ||
}, | ||
} | ||
}, | ||
[Theme.dark]: { | ||
|
@@ -120,6 +127,13 @@ export default { | |
Icon: { | ||
default: grays.middleLight, | ||
hover: grays.lightest | ||
}, | ||
Panel: { | ||
default: { | ||
foreground: grays.light, | ||
background: grays.dark, | ||
border: grays.middleDark, | ||
}, | ||
} | ||
}, | ||
[Theme.contrast]: { | ||
|
@@ -152,6 +166,13 @@ export default { | |
Icon: { | ||
default: grays.mediumLight, | ||
hover: colors.yellow | ||
}, | ||
Panel: { | ||
default: { | ||
foreground: grays.light, | ||
background: grays.dark, | ||
border: grays.middleDark, | ||
}, | ||
} | ||
}, | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.