Commit f49d6e6a authored by Connor Hudson's avatar Connor Hudson Committed by GitHub

Merge pull request #767 from technoboy10/mobile-nav-footer

Fix GH-217: Implement responsive nav and footer (woohoo!)
parents 20f944c7 c009497b
...@@ -5,6 +5,8 @@ var Slider = require('react-slick'); ...@@ -5,6 +5,8 @@ var Slider = require('react-slick');
var Thumbnail = require('../thumbnail/thumbnail.jsx'); var Thumbnail = require('../thumbnail/thumbnail.jsx');
var frameless = require('../../lib/frameless.js');
require('slick-carousel/slick/slick.scss'); require('slick-carousel/slick/slick.scss');
require('slick-carousel/slick/slick-theme.scss'); require('slick-carousel/slick/slick-theme.scss');
require('./carousel.scss'); require('./carousel.scss');
...@@ -27,12 +29,29 @@ var Carousel = React.createClass({ ...@@ -27,12 +29,29 @@ var Carousel = React.createClass({
render: function () { render: function () {
var settings = this.props.settings || {}; var settings = this.props.settings || {};
defaults(settings, { defaults(settings, {
centerMode: false,
dots: false, dots: false,
infinite: false, infinite: false,
lazyLoad: true, lazyLoad: true,
slidesToShow: 5, slidesToShow: 5,
slidesToScroll: 5, slidesToScroll: 5,
variableWidth: true variableWidth: true,
responsive: [
{breakpoint: frameless.mobile, settings: {
arrows: true,
slidesToScroll: 1,
slidesToShow: 1,
centerMode: true
}},
{breakpoint: frameless.tablet, settings: {
slidesToScroll: 2,
slidesToShow: 2
}},
{breakpoint: frameless.desktop, settings: {
slidesToScroll: 4,
slidesToShow: 4
}}
]
}); });
var arrows = this.props.items.length > settings.slidesToShow; var arrows = this.props.items.length > settings.slidesToShow;
var classes = classNames( var classes = classNames(
......
...@@ -4,6 +4,9 @@ var FormattedMessage = require('react-intl').FormattedMessage; ...@@ -4,6 +4,9 @@ var FormattedMessage = require('react-intl').FormattedMessage;
var FooterBox = require('../container/footer.jsx'); var FooterBox = require('../container/footer.jsx');
var LanguageChooser = require('../../languagechooser/languagechooser.jsx'); var LanguageChooser = require('../../languagechooser/languagechooser.jsx');
var MediaQuery = require('react-responsive');
var frameless = require('../../../lib/frameless');
require('./footer.scss'); require('./footer.scss');
var Footer = React.createClass({ var Footer = React.createClass({
...@@ -11,6 +14,45 @@ var Footer = React.createClass({ ...@@ -11,6 +14,45 @@ var Footer = React.createClass({
render: function () { render: function () {
return ( return (
<FooterBox> <FooterBox>
<MediaQuery maxWidth={frameless.tablet - 1}>
<div className="lists">
<dl>
<dd>
<a href="/about/">
<FormattedMessage id='general.aboutScratch' />
</a>
</dd>
<dd>
<a href="/jobs/">
<FormattedMessage id='general.jobs' />
</a>
</dd>
<dd>
<a href="/contact-us/">
<FormattedMessage id='general.contactUs' />
</a>
</dd>
</dl>
<dl>
<dd>
<a href="/terms_of_use/">
<FormattedMessage id='general.termsOfUse' />
</a>
</dd>
<dd>
<a href="/privacy_policy/">
<FormattedMessage id='general.privacyPolicy' />
</a>
</dd>
<dd>
<a href="/community_guidelines/">
<FormattedMessage id='general.guidelines' />
</a>
</dd>
</dl>
</div>
</MediaQuery>
<MediaQuery minWidth={frameless.tablet}>
<div className="lists"> <div className="lists">
<dl> <dl>
<dt> <dt>
...@@ -52,7 +94,6 @@ var Footer = React.createClass({ ...@@ -52,7 +94,6 @@ var Footer = React.createClass({
</a> </a>
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt> <dt>
<FormattedMessage id='general.community' /> <FormattedMessage id='general.community' />
...@@ -162,7 +203,7 @@ var Footer = React.createClass({ ...@@ -162,7 +203,7 @@ var Footer = React.createClass({
</dd> </dd>
</dl> </dl>
</div> </div>
</MediaQuery>
<LanguageChooser /> <LanguageChooser />
<div className="copyright"> <div className="copyright">
......
@import "../../../colors"; @import "../../../colors";
@import "../../../frameless";
#footer { #footer {
.lists { .lists {
...@@ -6,11 +7,10 @@ ...@@ -6,11 +7,10 @@
text-align: center; text-align: center;
flex-direction: row; flex-direction: row;
flex-wrap: nowrap; flex-wrap: nowrap;
justify-content: space-between; justify-content: space-around;
dl { dl {
display: inline-block; display: inline-block;
width: 130pt;
vertical-align: top; vertical-align: top;
text-align: left; text-align: left;
font-size: .8rem; font-size: .8rem;
......
...@@ -251,7 +251,9 @@ var Navigation = React.createClass({ ...@@ -251,7 +251,9 @@ var Navigation = React.createClass({
<a className={dropdownClasses} <a className={dropdownClasses}
href="#" onClick={this.handleAccountNavClick}> href="#" onClick={this.handleAccountNavClick}>
<Avatar src={this.props.session.session.user.thumbnailUrl} alt="" /> <Avatar src={this.props.session.session.user.thumbnailUrl} alt="" />
<span className='profile-name'>
{this.props.session.session.user.username} {this.props.session.session.user.username}
</span>
</a> </a>
<Dropdown <Dropdown
as="ul" as="ul"
......
@import "../../../colors"; @import "../../../colors";
@import "../../../frameless";
#navigation { #navigation {
&.staging { &.staging {
...@@ -231,3 +232,97 @@ ...@@ -231,3 +232,97 @@
} }
} }
} }
//4 columns
@media only screen and (max-width: $mobile - 1) {
#navigation .inner {
width: $cols4;
> ul > li {
&.login-item {
margin-left: 0;
}
&.account-nav {
margin-left: 0;
> a {
.avatar {
margin-right: 0;
}
&:after {
display: none;
}
}
}
}
.create,
.discuss,
.explore,
.search,
.help,
.mystuff,
.profile-name {
display: none;
}
}
}
//6 columns
@media only screen and (min-width: $mobile) and (max-width: $tablet - 1) {
#navigation .inner {
width: $cols6;
> ul > li {
&.login-item {
margin-left: 0;
}
&.account-nav {
margin-left: 0;
> a {
.avatar {
margin-right: 0;
}
&:after {
display: none;
}
}
}
}
.discuss,
.explore,
.search,
.mystuff,
.profile-name {
display: none;
}
}
}
//8 columns
@media only screen and (min-width: $tablet) and (max-width: $desktop - 1) {
#navigation .inner {
width: $cols8;
> ul > li {
&.login-item,
&.account-nav {
margin-left: 0;
}
}
.explore,
.search,
.mystuff {
display: none;
}
}
}
/* This file contains breakpoints from _frameless.scss, to be used in MediaQuery elements.
* All units are in px, as per _frameless.scss and the MediaQuery default arguments.
*/
module.exports = {
desktop: 942,
tablet: 640,
mobile: 480
};
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
"pattern": "^/?$", "pattern": "^/?$",
"routeAlias": "/?$", "routeAlias": "/?$",
"view": "splash/splash", "view": "splash/splash",
"title": "Imagine, Program, Share" "title": "Imagine, Program, Share",
"viewportWidth": "device-width"
}, },
{ {
"name": "about", "name": "about",
......
...@@ -21,6 +21,9 @@ var Page = require('../../components/page/www/page.jsx'); ...@@ -21,6 +21,9 @@ var Page = require('../../components/page/www/page.jsx');
var TeacherBanner = require('../../components/teacher-banner/teacher-banner.jsx'); var TeacherBanner = require('../../components/teacher-banner/teacher-banner.jsx');
var Welcome = require('../../components/welcome/welcome.jsx'); var Welcome = require('../../components/welcome/welcome.jsx');
var MediaQuery = require('react-responsive');
var frameless = require('../../lib/frameless');
require('./splash.scss'); require('./splash.scss');
var Splash = injectIntl(React.createClass({ var Splash = injectIntl(React.createClass({
...@@ -393,7 +396,9 @@ var Splash = injectIntl(React.createClass({ ...@@ -393,7 +396,9 @@ var Splash = injectIntl(React.createClass({
<News items={this.state.news} messages={messages} /> <News items={this.state.news} messages={messages} />
</div> </div>
] : [ ] : [
<MediaQuery minWidth={frameless.desktop}>
<Intro projectCount={this.state.projectCount} messages={messages} key="intro"/> <Intro projectCount={this.state.projectCount} messages={messages} key="intro"/>
</MediaQuery>
]) : [] ]) : []
} }
......
@import "../../frameless";
.splash { .splash {
.splash-header { .splash-header {
display: flex; display: flex;
...@@ -39,3 +41,41 @@ ...@@ -39,3 +41,41 @@
margin-bottom: 20px; margin-bottom: 20px;
} }
} }
//4 columns
@media only screen and (max-width: $mobile - 1) {
.splash {
.splash-header {
flex-wrap: wrap;
justify-content: center;
.box {
width: $cols4;
}
}
}
}
//6 columns
@media only screen and (min-width: $mobile) and (max-width: $tablet - 1) {
.splash {
.splash-header {
flex-wrap: wrap;
justify-content: center;
.box {
width: $cols6;
}
}
}
}
//6 columns
@media only screen and (min-width: $tablet) and (max-width: $desktop - 1) {
.splash {
.splash-header {
margin: 0 auto;
width: $cols8;
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment