experiment with the react-responsive library

This commit is contained in:
Technoboy10 2016-07-25 10:53:57 -04:00
parent 188841c73c
commit daf803d4a3
7 changed files with 26 additions and 31 deletions

View file

@ -60,6 +60,7 @@
"lodash.defaultsdeep": "3.10.0", "lodash.defaultsdeep": "3.10.0",
"lodash.merge": "3.3.2", "lodash.merge": "3.3.2",
"lodash.omit": "3.1.0", "lodash.omit": "3.1.0",
"lodash.pickby": "^4.4.0",
"lodash.range": "3.0.1", "lodash.range": "3.0.1",
"minilog": "2.0.8", "minilog": "2.0.8",
"node-sass": "3.3.3", "node-sass": "3.3.3",
@ -73,6 +74,7 @@
"react-modal": "1.3.0", "react-modal": "1.3.0",
"react-onclickoutside": "4.1.1", "react-onclickoutside": "4.1.1",
"react-redux": "4.4.5", "react-redux": "4.4.5",
"react-responsive": "^1.1.4",
"react-slick": "0.12.2", "react-slick": "0.12.2",
"react-telephone-input": "3.4.5", "react-telephone-input": "3.4.5",
"redux": "3.5.2", "redux": "3.5.2",

View file

@ -3,6 +3,7 @@ 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');
require('./footer.scss'); require('./footer.scss');
@ -11,7 +12,7 @@ var Footer = React.createClass({
render: function () { render: function () {
return ( return (
<FooterBox> <FooterBox>
{this.props.layout == 'COLS4' || this.props.layout == 'COLS6' ? [ <MediaQuery maxWidth={639}>
<div className="lists"> <div className="lists">
<dl> <dl>
<dd> <dd>
@ -48,7 +49,8 @@ var Footer = React.createClass({
</dd> </dd>
</dl> </dl>
</div> </div>
] : [ </MediaQuery>
<MediaQuery minWidth={640}>
<div className="lists"> <div className="lists">
<dl> <dl>
<dt> <dt>
@ -199,7 +201,7 @@ var Footer = React.createClass({
</dd> </dd>
</dl> </dl>
</div> </div>
]} </MediaQuery>
<LanguageChooser /> <LanguageChooser />
<div className="copyright"> <div className="copyright">

View file

@ -17,6 +17,7 @@ var Login = require('../../login/login.jsx');
var Modal = require('../../modal/modal.jsx'); var Modal = require('../../modal/modal.jsx');
var NavigationBox = require('../container/navigation.jsx'); var NavigationBox = require('../container/navigation.jsx');
var Registration = require('../../registration/registration.jsx'); var Registration = require('../../registration/registration.jsx');
var MediaQuery = require('react-responsive');
require('./navigation.scss'); require('./navigation.scss');
@ -248,8 +249,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="" />
{this.props.layout == 'COLS8' || this.props.layout == 'COLS12' ? <MediaQuery minWidth={640} component='span'>
this.props.session.session.user.username : ''} {this.props.session.session.user.username}
</MediaQuery>
</a> </a>
<Dropdown <Dropdown
as="ul" as="ul"

View file

@ -1,5 +1,4 @@
var React = require('react'); var React = require('react');
var connect = require('react-redux').connect;
var classNames = require('classnames'); var classNames = require('classnames');
var Navigation = require('../../navigation/www/navigation.jsx'); var Navigation = require('../../navigation/www/navigation.jsx');
@ -14,24 +13,17 @@ var Page = React.createClass({
return ( return (
<div className="page"> <div className="page">
<div id="navigation" className={classes}> <div id="navigation" className={classes}>
<Navigation layout={this.props.layout}/> <Navigation/>
</div> </div>
<div id="view"> <div id="view">
{this.props.children} {this.props.children}
</div> </div>
<div id="footer"> <div id="footer">
<Footer layout={this.props.layout}/> <Footer/>
</div> </div>
</div> </div>
); );
} }
}); });
var mapStateToProps = function (state) { module.exports = Page;
return {
layout: state.layout
};
};
var ConnectedPage = connect(mapStateToProps)(Page);
module.exports = ConnectedPage;

View file

@ -5,12 +5,11 @@ var detailsReducer = require('./conference-details.js').detailsReducer;
var permissionsReducer = require('./permissions.js').permissionsReducer; var permissionsReducer = require('./permissions.js').permissionsReducer;
var sessionReducer = require('./session.js').sessionReducer; var sessionReducer = require('./session.js').sessionReducer;
var tokenReducer = require('./token.js').tokenReducer; var tokenReducer = require('./token.js').tokenReducer;
var layout = require('./layout.js'); // var layout = require('./layout.js');
var appReducer = combineReducers({ var appReducer = combineReducers({
session: sessionReducer, session: sessionReducer,
token: tokenReducer, token: tokenReducer,
layout: layout,
permissions: permissionsReducer, permissions: permissionsReducer,
conferenceSchedule: scheduleReducer, conferenceSchedule: scheduleReducer,
conferenceDetails: detailsReducer conferenceDetails: detailsReducer

View file

@ -6,7 +6,6 @@ var React = require('react');
var api = require('../../lib/api'); var api = require('../../lib/api');
var render = require('../../lib/render.jsx'); var render = require('../../lib/render.jsx');
var sessionActions = require('../../redux/session.js'); var sessionActions = require('../../redux/session.js');
var layout = require('../../redux/layout.js');
var shuffle = require('../../lib/shuffle.js').shuffle; var shuffle = require('../../lib/shuffle.js').shuffle;
var Activity = require('../../components/activity/activity.jsx'); var Activity = require('../../components/activity/activity.jsx');
@ -43,12 +42,6 @@ var Splash = injectIntl(React.createClass({
permissions: {} permissions: {}
}; };
}, },
componentWillMount: function () {
this.props.dispatch(layout.getLayout());
for (var query in layout.mediaQueries) {
layout.mediaQueries[query].addListener(this.onResize);
}
},
componentDidUpdate: function (prevProps) { componentDidUpdate: function (prevProps) {
if (this.props.session.session.user != prevProps.session.session.user) { if (this.props.session.session.user != prevProps.session.session.user) {
if (this.props.session.session.user) { if (this.props.session.session.user) {
@ -94,9 +87,6 @@ var Splash = injectIntl(React.createClass({
} }
} }
}, },
onResize: function () {
this.props.dispatch(layout.getLayout());
},
getActivity: function () { getActivity: function () {
api({ api({
uri: '/proxy/users/' + this.props.session.session.user.username + '/activity?limit=5' uri: '/proxy/users/' + this.props.session.session.user.username + '/activity?limit=5'
@ -449,8 +439,7 @@ var Splash = injectIntl(React.createClass({
var mapStateToProps = function (state) { var mapStateToProps = function (state) {
return { return {
session: state.session, session: state.session,
permissions: state.permissions, permissions: state.permissions
layout: state.layout
}; };
}; };

View file

@ -65,8 +65,17 @@
.box { .box {
width: $cols6; width: $cols6;
white-space: normal;
} }
} }
} }
} }
//6 columns
@media only screen and (min-width: $tablet) and (max-width: $desktop - 1) {
.splash {
.splash-header {
margin: 0 auto;
width: $cols8;
}
}
}