Skip to content
Snippets Groups Projects
Commit 808ecb9d authored by Loïc Poullain's avatar Loïc Poullain
Browse files

Cacher titres PLF 2020 si pas de PLF

parent 3dff29b0
Branches
No related tags found
1 merge request!7Isoler les portées CSS, mettre le nouveau code couleur, faire un peu de ménage
......@@ -36,6 +36,7 @@ class Alinea2 extends PureComponent {
baseOutputInput,
expandArticlePanelHandler,
isPanelExpanded,
reformePLF,
style,
} = this.props;
return (
......@@ -50,7 +51,7 @@ class Alinea2 extends PureComponent {
<Typography style={styleTitreThematique}>
Plafonds du quotient familial
</Typography>
<p style={styleTitreThematiqueModifPLF}>Modifiés par le PLF 2020</p>
{reformePLF && <p style={styleTitreThematiqueModifPLF}>Modifiés par le PLF 2020</p>}
</LexExpansionPanelSummary>
<LexExpansionPanelDetails style={styleExpansionpanel}>
......@@ -112,10 +113,15 @@ class Alinea2 extends PureComponent {
}
}
Alinea2.defaultProps = {
reformePLF: null,
};
Alinea2.propTypes = {
baseOutputInput: PropTypes.func.isRequired,
expandArticlePanelHandler: PropTypes.func.isRequired,
isPanelExpanded: PropTypes.bool.isRequired,
reformePLF: PropTypes.shape(),
style: PropTypes.shape().isRequired,
};
......
......@@ -5,10 +5,11 @@ import ArticleAlinea2 from "./article-alinea-2-component";
const PANEL_NAME = "panel2";
const mapStateToProps = ({ currentExpandedArticlePanel }) => {
const mapStateToProps = ({ currentExpandedArticlePanel, reformePLF }) => {
const isPanelExpanded = currentExpandedArticlePanel === PANEL_NAME;
return {
isPanelExpanded,
reformePLF,
};
};
......
......@@ -56,6 +56,7 @@ class Alinea4a extends PureComponent {
expandArticlePanelHandler,
formulaOutputInput,
isPanelExpanded,
reformePLF,
style,
} = this.props;
return (
......@@ -68,7 +69,7 @@ class Alinea4a extends PureComponent {
expandIcon={<ExpandMoreIcon />}
style={styleExpansionpanel}>
<Typography style={styleTitreThematique}>Décote</Typography>
<p style={styleTitreThematiqueModifPLF}>Modifiée par le PLF 2020</p>
{reformePLF && <p style={styleTitreThematiqueModifPLF}>Modifiée par le PLF 2020</p>}
</LexExpansionPanelSummary>
<LexExpansionPanelDetails style={styleExpansionpanel}>
......@@ -117,11 +118,16 @@ class Alinea4a extends PureComponent {
}
}
Alinea4a.defaultProps = {
reformePLF: null,
};
Alinea4a.propTypes = {
baseOutputInput: PropTypes.func.isRequired,
expandArticlePanelHandler: PropTypes.func.isRequired,
formulaOutputInput: PropTypes.func.isRequired,
isPanelExpanded: PropTypes.bool.isRequired,
reformePLF: PropTypes.shape(),
style: PropTypes.shape().isRequired,
};
......
......@@ -7,10 +7,12 @@ const PANEL_NAME = "panel4a";
const mapStateToProps = ({
currentExpandedArticlePanel,
reformePLF,
}) => {
const isPanelExpanded = currentExpandedArticlePanel === PANEL_NAME;
return {
isPanelExpanded,
reformePLF,
};
};
......
......@@ -166,7 +166,9 @@ class Alinea4b extends PureComponent {
}
render() {
const { expandArticlePanelHandler, isPanelExpanded, style } = this.props;
const {
expandArticlePanelHandler, isPanelExpanded, reformePLF, style,
} = this.props;
return (
<LexExpansionPanel
square
......@@ -179,7 +181,7 @@ class Alinea4b extends PureComponent {
<Typography style={styleTitreThematique}>
Réfaction foyers modestes
</Typography>
<p style={styleTitreThematiqueModifPLF}>Abrogée par le PLF 2020</p>
{reformePLF && <p style={styleTitreThematiqueModifPLF}>Abrogée par le PLF 2020</p>}
</LexExpansionPanelSummary>
<LexExpansionPanelDetails style={styleExpansionpanel}>
......@@ -190,12 +192,17 @@ class Alinea4b extends PureComponent {
}
}
Alinea4b.defaultProps = {
reformePLF: null,
};
Alinea4b.propTypes = {
baseOutputInput: PropTypes.func.isRequired,
expandArticlePanelHandler: PropTypes.func.isRequired,
formulaOutputInput: PropTypes.func.isRequired,
formulaOutputInputCombiLin: PropTypes.func.isRequired,
isPanelExpanded: PropTypes.bool.isRequired,
reformePLF: PropTypes.shape(),
style: PropTypes.shape().isRequired,
};
......
......@@ -73,7 +73,7 @@ const stylesTheme = theme => ({
},
});
function LegendeArticle({ classes }) {
function LegendeArticle({ classes, montrerPLF }) {
return (
<div className={classes.container}>
<Typography inline className={classes.styleLegende}>
......@@ -82,6 +82,7 @@ function LegendeArticle({ classes }) {
<Typography inline className={classes.styleCodeExistant}>
Droit existant
</Typography>
{montrerPLF && (
<Typography inline className={classes.styleAvantPLF}>
<a
className={classes.alink}
......@@ -91,6 +92,7 @@ function LegendeArticle({ classes }) {
<OpenInNewIcon className={classes.styleOpenInNewIcon} />
</a>
</Typography>
)}
<Typography inline className={classes.styleAmendement}>
Mon amendement
</Typography>
......@@ -100,5 +102,6 @@ function LegendeArticle({ classes }) {
LegendeArticle.propTypes = {
classes: PropTypes.shape().isRequired,
montrerPLF: PropTypes.bool.isRequired,
};
export default withStyles(stylesTheme, { withTheme: true })(LegendeArticle);
......@@ -10,7 +10,8 @@ import ReformeurComponent from "./reformeur-component";
const mapStateToProps = (state, { width }) => {
const useMobileView = width === "xs" || width === "sm";
return { useMobileView };
const montrerPLF = state.reformePLF !== null;
return { montrerPLF, useMobileView };
};
const mapDispatchToProps = dispatch => ({
......
......@@ -23,10 +23,10 @@ class ReformeurComponent extends PureComponent {
this.setState({ indextab });
};
renderDesktopView = () => (
renderDesktopView = montrerPLF => (
<div className="clearfix">
<div className="moitie-gauche">
<LegendeArticle />
<LegendeArticle montrerPLF={montrerPLF} />
<Articles />
</div>
<div className="moitie-droite">
......@@ -36,7 +36,7 @@ class ReformeurComponent extends PureComponent {
</div>
);
renderMobileView = () => {
renderMobileView = (montrerPLF) => {
const { indextab } = this.state;
return (
<Fragment>
......@@ -56,7 +56,7 @@ class ReformeurComponent extends PureComponent {
index={indextab}
onChangeIndex={this.handleOnChangeIndex}>
<div style={{ padding: 24 }}>
<LegendeArticle />
<LegendeArticle montrerPLF={montrerPLF} />
<Articles />
</div>
<div style={{ padding: 24 }}>
......@@ -69,11 +69,11 @@ class ReformeurComponent extends PureComponent {
};
render() {
const { useMobileView } = this.props;
const { montrerPLF, useMobileView } = this.props;
return (
<div className="main-index">
{useMobileView && this.renderMobileView()}
{!useMobileView && this.renderDesktopView()}
{useMobileView && this.renderMobileView(montrerPLF)}
{!useMobileView && this.renderDesktopView(montrerPLF)}
</div>
);
}
......@@ -81,6 +81,7 @@ class ReformeurComponent extends PureComponent {
ReformeurComponent.propTypes = {
initializeAppllicationStoreFromAPI: PropTypes.func.isRequired,
montrerPLF: PropTypes.bool.isRequired,
useMobileView: PropTypes.bool.isRequired,
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment