From 9e80f2b36bddf070b164697033944091b108b050 Mon Sep 17 00:00:00 2001 From: Mael Date: Tue, 23 Jul 2019 16:14:30 +0200 Subject: [PATCH] =?UTF-8?q?:fire:=20Type=20et=20p=C3=A9riode=20de=20l'info?= =?UTF-8?q?box,=20p=C3=A9riode=20pr=C3=A8s=20de=20valeur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/PeriodSwitch.js | 8 +++--- source/components/rule/Header.js | 46 ++++++------------------------- source/components/rule/Rule.css | 6 ---- source/components/rule/Rule.js | 41 +++++++++++++++++++++++++-- 4 files changed, 51 insertions(+), 50 deletions(-) diff --git a/source/components/PeriodSwitch.js b/source/components/PeriodSwitch.js index d536666e6..a03983edb 100644 --- a/source/components/PeriodSwitch.js +++ b/source/components/PeriodSwitch.js @@ -52,8 +52,8 @@ export default compose( return }) return ( -
-
+ + -
-
+ + ) }) diff --git a/source/components/rule/Header.js b/source/components/rule/Header.js index a2c938226..1be57ec85 100644 --- a/source/components/rule/Header.js +++ b/source/components/rule/Header.js @@ -1,9 +1,7 @@ -import PeriodSwitch from 'Components/PeriodSwitch' import withColours from 'Components/utils/withColours' import { path } from 'ramda' import React from 'react' import emoji from 'react-easy-emoji' -import { Trans } from 'react-i18next' import { capitalise0 } from '../../utils' import { Markdown } from '../utils/markdown' import Destinataire from './Destinataire' @@ -21,8 +19,7 @@ let RuleHeader = withColours( name, title, icon, - colours, - valuesToShow + colours }) => (
@@ -40,39 +37,14 @@ let RuleHeader = withColours(
- {(type || flatRule['période']) && ( -
- {type && ( -
-

Type :

- {capitalise0(type)} -
- )} - {do { - let period = flatRule['période'] - period && ( -
-

Période :

- {valuesToShow && period === 'flexible' ? ( - - ) : ( -
- - {period} - -
- )} -
- ) - }} - -
- )} + {do { + let destinataire = path([type, 'destinataire'])(flatRule) + destinataire && ( +
+ +
+ ) + }}
) diff --git a/source/components/rule/Rule.css b/source/components/rule/Rule.css index 240583ca1..2bfa6c063 100644 --- a/source/components/rule/Rule.css +++ b/source/components/rule/Rule.css @@ -20,12 +20,6 @@ h2 small { font-size: 75%; } -#rule #ruleValue { - text-align: center; - font-size: 200%; - margin-bottom: 0.6em; - margin-top: 0.4em; -} #rule #ruleDefault { text-align: center; diff --git a/source/components/rule/Rule.js b/source/components/rule/Rule.js index f69279326..804551568 100644 --- a/source/components/rule/Rule.js +++ b/source/components/rule/Rule.js @@ -30,6 +30,7 @@ import Examples from './Examples' import RuleHeader from './Header' import References from './References' import './Rule.css' +import PeriodSwitch from 'Components/PeriodSwitch' let LazySource = React.lazy(() => import('./RuleSource')) @@ -64,8 +65,6 @@ export default compose( let displayedRule = analysedExample || analysedRule - console.log(displayedRule) - return ( <> {this.state.viewSource ? ( @@ -103,7 +102,23 @@ export default compose( />
-
+
.value { + font-size: 220%; + } + + margin: 0.6em 0; + > * { + margin: 0 0.6em; + } + `}> +
{displayedRule.defaultValue != null && (
@@ -227,3 +246,19 @@ let NamespaceRulesList = compose(
) }) + +let Period = ({ period, valuesToShow }) => + period ? ( + valuesToShow && period === 'flexible' ? ( + + ) : ( + + + {period} + + + ) + ) : null