From 61760839dc72299b93092c2c11808d337d283ec0 Mon Sep 17 00:00:00 2001 From: Mael Date: Mon, 22 Oct 2018 15:33:00 +0000 Subject: [PATCH] =?UTF-8?q?Affichage=20du=20code=20source=20d'une=20r?= =?UTF-8?q?=C3=A8gle=20et=20ses=20filles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/rule/Rule.js | 135 ++++++++++-------- source/components/rule/RuleSource.js | 28 ++++ source/engine/rules.js | 2 +- source/sites/embauche.gouv.fr/pages/Source.js | 21 +-- 4 files changed, 108 insertions(+), 78 deletions(-) create mode 100644 source/components/rule/RuleSource.js diff --git a/source/components/rule/Rule.js b/source/components/rule/Rule.js index 064ef85e1..a51d607f6 100644 --- a/source/components/rule/Rule.js +++ b/source/components/rule/Rule.js @@ -27,6 +27,8 @@ import References from './References' import './Rule.css' import { AttachDictionary } from '../AttachDictionary' import knownMecanisms from 'Engine/known-mecanisms.yaml' +import emoji from 'react-easy-emoji' +import Source from './RuleSource' export default compose( connect((state, props) => ({ @@ -41,6 +43,7 @@ export default compose( withLanguage )( class Rule extends Component { + state = { viewSource: false } render() { let { dottedName, @@ -60,70 +63,82 @@ export default compose( let showValues = valuesToShow || currentExample return ( -
- - {title} - - - + <> + + {this.state.viewSource ? ( + + ) : ( +
+ + {title} + + + -
- {displayedRule.nodeValue ? ( -
-