Skip to content

Commit

Permalink
Fix mobile styles nerdakademie#27:
Browse files Browse the repository at this point in the history
no sticky header and footer on small screens;
fix form-width on small screen;
Add link for Google Font Roboto
  • Loading branch information
philipszalla committed Mar 1, 2017
1 parent 67f5264 commit d816f85
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 52 deletions.
1 change: 1 addition & 0 deletions resources/server/view/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ html
head
title= title
meta(name='viewport' content='width=device-width, initial-scale=1.0, user-scalable=no')
link(rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto')
link(rel='stylesheet' href=rootPath + '/css/main.css')
body
div(id="app")
Expand Down
4 changes: 3 additions & 1 deletion src/client/component/pages/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export default React.createClass({
<NavLink to='/edit'><FlatButton label='Bearbeiten' /></NavLink>
</div>}
/>
{this.props.children || <Home />}
<div className='appContent'>
{this.props.children || <Home />}
</div>
<Footer>(c) 2017 <a className='nerdakademie' href='https://nerdakademie.xyz'>Nerdakademie</a> | <a className='nerdakademie' href='https://github.com/nerdakademie/stupa-wahltool'>v1.2.1</a></Footer>
</div>
);
Expand Down
16 changes: 11 additions & 5 deletions src/client/component/pages/ContestantList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,23 @@ class ContestantList extends Component {
this.setState({
contestants
});

this.updateContainerSize();
});
}

updateContainerSize() {
if (ReactDOM.findDOMNode(this.AutoResponsiveContainer) !== null) {
this.setState({
containerWidth: ReactDOM.findDOMNode(this.AutoResponsiveContainer).clientWidth
});
}
}

componentDidMount() {
this.loadContestants();
window.addEventListener('resize', () => {
if (ReactDOM.findDOMNode(this.AutoResponsiveContainer) !== null) {
this.setState({
containerWidth: ReactDOM.findDOMNode(this.AutoResponsiveContainer).clientWidth
});
}
this.updateContainerSize();
}, false);
}

Expand Down
13 changes: 4 additions & 9 deletions src/client/style/_reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ html {
font-family: 'Roboto', sans-serif;
}

body {
margin: 0;
padding: 0;
}

hgroup {
text-align:center;
Expand All @@ -15,15 +19,6 @@ h1 { color: #636363; }

h3 { color: #4a89dc; }

form {
width: 380px;
margin: auto auto;
padding: 2em 2em 2em 2em;
background: #fafafa;
border: 1px solid #ebebeb;
box-shadow: rgba(0,0,0,0.14902) 0px 1px 1px 0px,rgba(0,0,0,0.09804) 0px 1px 2px 0px;
}

footer { text-align: center; }

footer p {
Expand Down
91 changes: 54 additions & 37 deletions src/client/style/main.scss
Original file line number Diff line number Diff line change
@@ -1,62 +1,57 @@
@import 'reset';

/* Topbar */
@media screen and (max-width: 750px) {
.topbar {
display: block !important;
}

#app {
padding-top: 115px !important;
}

}

@media screen and (max-width: 530px) {
#app {
padding-top: 151px !important;
}
}

@media screen and (max-width: 290px) {
#app {
padding-top: 186px !important;
}
}

@media screen and (max-width: 281px) {
#app {
padding-top: 222px !important;
}
}

.topbar div div a.active button div {
color: #999999;
}

.topbar div div a button div {
color: #ffffff;
}

/* END Topbar */

.contestantList {
overflow-wrap: break-word;
}

#app {
padding-top: 70px;
padding-bottom: 70px;
overflow-y: auto;
}

/* Scrollbar */
body {
overflow-y: scroll;
background-color: #ecf0f1;
}
/* END Scrollbar */

/* Content */
#app {
padding-top: 78px;
padding-bottom: 78px;
overflow-y: auto;
}

.appContent {
margin: 0 8px;
}
/* END Content */

/* Forms */
.appContent form {
width: 380px;
margin: auto auto;
padding: 2em;
background: #fafafa;
border: 1px solid #ebebeb;
box-shadow: rgba(0,0,0,0.14902) 0px 1px 1px 0px,rgba(0,0,0,0.09804) 0px 1px 2px 0px;
}

/* max-width = form-width + appContent-margin */
@media screen and (max-width: 390px) {
.appContent form {
width: 100%;
box-sizing: border-box;
}
}
/* END Forms */

/* Footer */
.footer {
background-color: #011F53;
Expand All @@ -70,6 +65,28 @@ body {
color: #ffffff;
width: 100%;
z-index: 300;
box-sizing: border-box;
}

/* END Footer */

@media screen and (max-width: 750px) {
/* Non-sticky */
#app {
padding: 0 !important;
}

.topbar {
display: block !important;
position: relative !important;
}

.footer {
position: relative !important;
}

.appContent {
margin-top: 14px;
margin-bottom: 14px;
}
/* END Non-sticky */
}

0 comments on commit d816f85

Please sign in to comment.