Improve mobile UI (#875)

* make toolbar fit window on mobile

* don't prefetch /about

* improve /about page

* fix layout for /account and /snippets

* fix img on /about mobile

* unneeded change
main
Michael Fix 5 years ago committed by GitHub
parent 83e75410da
commit 10cc6fdb93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -375,6 +375,7 @@ class Editor extends React.Component {
list={LANGUAGES} list={LANGUAGES}
onChange={this.updateLanguage} onChange={this.updateLanguage}
/> />
<div className="toolbar-second-row">
<BackgroundSelect <BackgroundSelect
onChange={this.updateBackground} onChange={this.updateBackground}
updateHighlights={this.updateHighlights} updateHighlights={this.updateHighlights}
@ -400,6 +401,7 @@ class Editor extends React.Component {
backgroundImage={backgroundImage} backgroundImage={backgroundImage}
/> />
</div> </div>
</div>
</Toolbar> </Toolbar>
<Dropzone accept="image/*, text/*, application/*" onDrop={this.onDrop}> <Dropzone accept="image/*, text/*, application/*" onDrop={this.onDrop}>
@ -443,6 +445,14 @@ class Editor extends React.Component {
display: flex; display: flex;
margin-left: auto; margin-left: auto;
} }
.toolbar-second-row {
height: 40px;
display: flex;
flex: 1;
}
.toolbar-second-row > :global(div:not(:last-of-type)) {
margin-right: 0.5rem;
}
`} `}
</style> </style>
</div> </div>

@ -173,6 +173,7 @@ function ExportMenu({
.export-menu-container { .export-menu-container {
position: relative; position: relative;
color: ${COLORS.PURPLE}; color: ${COLORS.PURPLE};
flex: 1;
} }
.flex { .flex {

@ -5,7 +5,7 @@ import { COLORS } from '../lib/constants'
const Footer = () => ( const Footer = () => (
<footer role="contentinfo" className="mt3"> <footer role="contentinfo" className="mt3">
<nav className="mt3"> <nav className="mt3">
<Link href="/about"> <Link href="/about" prefetch={false}>
<a className="link" href="/about"> <a className="link" href="/about">
about about
</a> </a>
@ -43,6 +43,7 @@ const Footer = () => (
{` {`
footer { footer {
font-size: 14px; font-size: 14px;
text-align: center;
} }
footer > div { footer > div {
@ -51,8 +52,7 @@ const Footer = () => (
} }
nav { nav {
display: flex; margin: 0 auto;
align-items: center;
} }
a { a {

@ -5,9 +5,15 @@ import Header from './Header'
import Footer from './Footer' import Footer from './Footer'
import Announcement from './Announcement' import Announcement from './Announcement'
const COLUMN = `
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
`
class Page extends React.Component { class Page extends React.Component {
render() { render() {
const { children, enableHeroText } = this.props const { children, enableHeroText, flex } = this.props
return ( return (
<main className="main mt4 mb4"> <main className="main mt4 mb4">
<Meta /> <Meta />
@ -22,12 +28,14 @@ class Page extends React.Component {
<style jsx> <style jsx>
{` {`
.main { .main {
display: flex; ${flex ? COLUMN : ''}
justify-content: center; }
flex-direction: column; @media (min-width: 1024px) {
align-items: center; .main {
${COLUMN};
min-width: 1080px; /* temporary fix for mobile overflow issue */ min-width: 1080px; /* temporary fix for mobile overflow issue */
} }
}
`} `}
</style> </style>
</main> </main>

@ -8,7 +8,7 @@ const Toolbar = props => (
.toolbar { .toolbar {
width: 100%; width: 100%;
height: 40px; height: 40px;
margin-bottom: 16px; margin-bottom: 1rem;
display: flex; display: flex;
position: relative; position: relative;
z-index: 3; z-index: 3;
@ -22,6 +22,18 @@ const Toolbar = props => (
.toolbar > :global(div):last-child { .toolbar > :global(div):last-child {
margin-right: 0px; margin-right: 0px;
} }
@media (max-width: 768px) {
.toolbar {
max-width: 100%;
height: auto;
flex-direction: column;
}
.toolbar > :global(div:not(:last-of-type)) {
margin-right: 0;
margin-bottom: 1rem;
}
}
`} `}
</style> </style>
</div> </div>

@ -146,7 +146,6 @@ export default () => (
font-style: normal; font-style: normal;
text-transform: initial; text-transform: initial;
letter-spacing: initial; letter-spacing: initial;
/* min-width: 848px; */
min-height: 704px; min-height: 704px;
} }

@ -112,6 +112,17 @@ export default () => (
.about { .about {
font-size: 16px; font-size: 16px;
max-width: 632px; max-width: 632px;
margin: 0 auto var(--x4);
}
@media (max-width: 768px) {
.about {
max-width: 90vw;
}
}
img {
max-width: 100%;
} }
h2 { h2 {

@ -248,7 +248,7 @@ function Settings() {
function SettingsPage() { function SettingsPage() {
return ( return (
<Page> <Page flex={true}>
<MetaLinks /> <MetaLinks />
<Settings /> <Settings />
</Page> </Page>

@ -240,7 +240,7 @@ function SnippetsPage() {
} }
export default () => ( export default () => (
<Page enableHeroText={true}> <Page enableHeroText={true} flex={true}>
<MetaLinks /> <MetaLinks />
<SnippetsPage /> <SnippetsPage />
</Page> </Page>

Loading…
Cancel
Save