Home page and LastStatements migration

This commit is contained in:
Jalil Arfaoui 2016-09-04 14:24:58 +02:00
parent f5d773ef4e
commit ab8dc1ce90
10 changed files with 79 additions and 44 deletions

View file

@ -0,0 +1,7 @@
.wrapper {
font-family: 'Gotham-Book', sans-serif;
font-size: 1.0em;
line-height: 1.4em;
list-style-type: none;
text-align: justify;
}

View file

@ -0,0 +1,14 @@
import { connect } from 'react-redux';
import Config from 'Config';
import { getStatements } from 'store/selectors';
import { onLastStatementsAccess } from 'store/actions/entities';
const mapStateToProps = state => ({
statements: getStatements(state),
});
const mapDispatchToProps = dispatch => ({
onAccess: () => dispatch(onLastStatementsAccess()),
});
export default connect(mapStateToProps, mapDispatchToProps);

View file

@ -1,21 +1,35 @@
import React, { PropTypes } from 'react';
import { map } from 'ramda';
import React, { PropTypes, Component } from 'react';
import CSSModules from 'react-css-modules';
import Statement from './Statement';
import LastStatementsStyle from './LastStatements.css';
import connector from './connector';
const renderStatements = (statements) => (
map(s => <Statement statement={s} />, statements)
);
class LastStatements extends Component {
static propTypes = {
statements: PropTypes.arrayOf(PropTypes.object),
onAccess: PropTypes.func.isRequired,
};
const LastStatements = ({ statements }) => (
<div id="last-statements">
<h2>Les dernières prises de positions</h2>
<ul id="last-statements">
{renderStatements(statements)};
</ul>
</div>
);
LastStatements.propTypes = {
statements: PropTypes.arrayOf(PropTypes.object),
};
componentWillMount() {
this.props.onAccess();
}
export default LastStatements;
renderStatements = () => this.props.statements.map(
s => <Statement statement={s} />
);
render() {
if (!this.props.statements) return <span>loading last statements ...</span>;
return (
<div styleName="wrapper">
<h2>Les dernières prises de positions</h2>
<ul styleName="wrapper">
{ this.renderStatements() };
</ul>
</div>
);
}
}
export default CSSModules(connector(LastStatements), LastStatementsStyle);

View file

@ -1,4 +1,4 @@
export default {
export default {
root: '/',
subjects: '/s',
publicFigures: '/p',

View file

@ -44,7 +44,7 @@ const loadApplication = (DOMElementId) => {
module.hot.accept('./root/index.jsx', () => {
// If you use Webpack 2 in ES modules mode, you can
// use <App /> here rather than require() a <NextApp />.
const NextApp = require('./root/index').Root;
const NextApp = require('./root/index').default;
ReactDOM.render(
<AppContainer>

View file

@ -8,4 +8,13 @@
.row {
background-size:cover;
background-position: center center;
}
.introduction {
font-family: 'Gotham-Book', sans-serif;
font-size: 1.1em;
line-height: 1.7em;
text-align: center;
color: #FFFFFF;
text-shadow: 0px 0px 30px rgba(0, 115, 162, 1);
}

View file

@ -1,12 +1,20 @@
import React, { PropTypes } from 'react';
import React, { PropTypes, Component } from 'react';
import HomeSubject from './HomeSubject';
import { map } from 'ramda';
const renderSubjects = map(s => <HomeSubject subject={s} />);
class HomeSubjects extends Component {
const HomeSubjects = ({ subjects }) => (renderSubjects(subjects));
HomeSubject.propTypes = {
subjects: PropTypes.arrayOf(PropTypes.object).isRequired,
};
static propTypes = {
subjects: PropTypes.arrayOf(PropTypes.object).isRequired,
}
render() {
if (!this.props.subjects) return <span>loading subjects ...</span>;
return this.props.subjects.map(
s => <HomeSubject subject={s} />
);
}
}
export default HomeSubjects;

View file

@ -16,7 +16,7 @@ const Home = () => (
>
<br /><br /><br /><br /><br /><br />
<h5>Bienvenue sur Débats.co</h5><br />
<div id="white">
<div styleName="introduction">
Débats est un projet francophone et participatif, ayant pour objectif <br />
doffrir une synthèse ouverte, impartiale et vérifiable, des sujets clivants de notre société.
</div>

View file

@ -73,20 +73,3 @@ p {
line-height: 1.7em;
text-align: justify;
}
#white {
font-family: 'Gotham-Book', sans-serif;
font-size: 1.1em;
line-height: 1.7em;
text-align: center;
color: #FFFFFF;
text-shadow: 0px 0px 30px rgba(0, 115, 162, 1);
}
#last-statements {
font-family: 'Gotham-Book', sans-serif;
font-size: 1.0em;
line-height: 1.4em;
list-style-type: none;
text-align: justify;
}