From 1b480cb4cba67e00863d64f2954c224432083a06 Mon Sep 17 00:00:00 2001 From: mama Date: Wed, 4 Oct 2017 18:14:41 +0200 Subject: [PATCH] Formattage du code --- source/components/rule/References.js | 90 +++++++++++++++------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/source/components/rule/References.js b/source/components/rule/References.js index 483db7976..154366a63 100644 --- a/source/components/rule/References.js +++ b/source/components/rule/References.js @@ -1,62 +1,72 @@ -import React from 'react' -import R from 'ramda' -import './References.css' -import references from 'Règles/ressources/références/références.yaml' +import React from "react" +import R from "ramda" +import "./References.css" +import references from "Règles/ressources/références/références.yaml" export default class References extends React.Component { state = { showComplementary: false } - render(){ - let - {refs} = this.props, - {complementary, official} = - R.groupBy( ([name, link]) => - this.findRefKey(link) ? 'official' : 'complementary' + render() { + let { refs } = this.props, + { complementary, official } = R.groupBy( + ([name, link]) => (this.findRefKey(link) ? "official" : "complementary") )(R.toPairs(refs)), showComplementary = this.state.showComplementary, showComplementaryButton = !this.state.showComplementary && complementary - return + return ( + + ) } renderRef = ([name, link]) => { let refKey = this.findRefKey(link), - refData = refKey && references[refKey] || {}, - domain = this.cleanDomain(link) + refData = (refKey && references[refKey]) || {}, + domain = this.cleanDomain(link) - return
  • - - - {domain} - {refData.image && - } + return ( +
  • + + + {domain} + {refData.image && ( + + )} + - - - {R.head(name).toUpperCase() + R.tail(name)} - -
  • + + {R.head(name).toUpperCase() + R.tail(name)} + + + ) } findRefKey(link) { return Object.keys(references).find(r => link.indexOf(r) > -1) } cleanDomain(link) { return (link.indexOf("://") > -1 - ? link.split('/')[2] - : link.split('/')[0]).replace('www.', '') + ? link.split("/")[2] + : link.split("/")[0] + ).replace("www.", "") } }