1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 01:45:03 +00:00
mon-entreprise/source/components/RuleLink.js
Maxime Quandalle cf513f003d 🔨🎨 Ajout de l'aide unique pour les apprentis
Ré-intégration de l'UI pour l'affichage des aides différées sous le
montant "total chargé" dans le simulateur salarié
2019-09-09 11:33:47 +02:00

41 lines
935 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"
style={{ color: colour, ...style }}>
{children || title || nameLeaf(dottedName)}
</Link>
)
}
export default compose(
withSitePaths,
withColours
)(RuleLink)