Skip to content
Snippets Groups Projects
Commit e95c8047 authored by Loïc Poullain's avatar Loïc Poullain Committed by Augustin Wenger
Browse files

Cacher titres PLF 2020 si pas de PLF

parent d2859dc7
No related branches found
No related tags found
1 merge request!2Rendre l'affichage du PLF optionnel
......@@ -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,
};
};
......
......@@ -39,6 +39,7 @@ class Alinea4a extends PureComponent {
expandArticlePanelHandler,
formulaOutputInput,
isPanelExpanded,
reformePLF,
style,
} = this.props;
return (
......@@ -51,7 +52,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}>
......@@ -87,11 +88,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,
};
};
......
......@@ -149,7 +149,9 @@ class Alinea4b extends PureComponent {
}
render() {
const { expandArticlePanelHandler, isPanelExpanded, style } = this.props;
const {
expandArticlePanelHandler, isPanelExpanded, reformePLF, style,
} = this.props;
return (
<LexExpansionPanel
square
......@@ -162,7 +164,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}>
......@@ -173,12 +175,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 => ({
......
......@@ -25,10 +25,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">
......@@ -38,7 +38,7 @@ class ReformeurComponent extends PureComponent {
</div>
);
renderMobileView = () => {
renderMobileView = (montrerPLF) => {
const { indextab } = this.state;
return (
<Fragment>
......@@ -58,7 +58,7 @@ class ReformeurComponent extends PureComponent {
index={indextab}
onChangeIndex={this.handleOnChangeIndex}>
<div style={{ padding: 24 }}>
<LegendeArticle />
<LegendeArticle montrerPLF={montrerPLF} />
<Articles />
</div>
<div style={{ padding: 24 }}>
......@@ -71,11 +71,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>
);
}
......@@ -83,6 +83,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