1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 02:55:01 +00:00
mon-entreprise/source/components/RuleLink.js
Maxime Quandalle 1ffb97c2f6
Renomme "désactive" en "rend non applicable"
Ajout de tests, amélioration de la doc
2019-09-03 22:45:54 +02:00

40 lines
912 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
}: Props) => {
const newPath =
sitePaths.documentation.index + '/' + encodeRuleName(dottedName)
return (
<Link
to={newPath}
className="rule-link"
style={{ color: colour, ...style }}>
{title || nameLeaf(dottedName)}
</Link>
)
}
export default compose(
withSitePaths,
withColours
)(RuleLink)