1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 04:05:01 +00:00
mon-entreprise/source/components/RuleLink.js
Maxime Quandalle bcb251923c
🎨 Meilleur affichage des multiplicateurs
Affichage des multiplicateurs directement au niveau des tranches et
supprime l'affichage du label "multiplicateur" qui était difficile à
comprendre.

Ajout d'un attribut de règle "acronyme", utilisé pour afficher un nom de
règle plus court au niveau des tranches d'un barème.
2019-10-17 09:33:00 +02:00

42 lines
952 B
JavaScript

/* @flow */
import withColours from 'Components/utils/withColours'
import withSitePaths from 'Components/utils/withSitePaths'
import { encodeRuleName, nameLeaf } from 'Engine/rules'
import { compose } from 'ramda'
import React from 'react'
import { Link } from 'react-router-dom'
import './RuleLink.css'
import type { Règle } from 'Types/RegleTypes'
import type { ThemeColours } from 'Components/utils/withColours'
type Props = Règle & {
sitePaths: Object,
style: CSSStyleDeclaration,
colours: ThemeColours
}
const RuleLink = ({
dottedName,
title,
colours: { colour },
style,
sitePaths,
children
}: Props) => {
const newPath =
sitePaths.documentation.index + '/' + encodeRuleName(dottedName)
return (
<Link
to={newPath}
className="rule-link"
title={title}
style={{ color: colour, ...style }}>
{children || title || nameLeaf(dottedName)}
</Link>
)
}
export default compose(
withSitePaths,
withColours
)(RuleLink)