Skip to content

Commit

Permalink
đŸ€© Affichage des rĂ©fĂ©rences sur les rĂ©ponses aux questions
Browse files Browse the repository at this point in the history
  • Loading branch information
mquandalle committed Oct 21, 2020
1 parent 4573a82 commit 1ce36b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 11 additions & 1 deletion mon-entreprise/source/components/conversation/Question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, { useCallback, useEffect, useState } from 'react'
import emoji from 'react-easy-emoji'
import { Trans } from 'react-i18next'
import { Explicable } from './Explicable'
import { References } from 'publicodes'

/* Ceci est une saisie de type "radio" : l'utilisateur choisit une réponse dans
une liste, ou une liste de listes. Les données @choices sont un arbre de type:
Expand Down Expand Up @@ -105,7 +106,7 @@ export default function Question({
)}
{choices.children &&
choices.children.map(
({ title, dottedName, description, children, icons }) =>
({ title, dottedName, description, children, icons, références }) =>
children ? (
<li key={dottedName} className="variant">
<div>{title}</div>
Expand All @@ -123,6 +124,7 @@ export default function Question({
icons,
onSubmit: handleSubmit,
description,
références,
onChange: handleChange
}}
/>
Expand Down Expand Up @@ -159,6 +161,14 @@ export const RadioLabel = props => (
<Explicable>
<h2>{props.label}</h2>
<Markdown source={props.description} />
{props.références && (
<>
<h3>
<Trans>En savoir plus</Trans>
</h3>
<References refs={props.références} />
</>
)}
</Explicable>
)}
</>
Expand Down
2 changes: 2 additions & 0 deletions publicodes/source/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { BasepathContext, EngineContext } from './contexts'
import RulePage from './rule/Rule'

export { RuleLink } from './RuleLink'
import References from './rule/References'
export { References }

type DocumentationProps<Names extends string> = {
documentationPath: string
Expand Down
4 changes: 2 additions & 2 deletions publicodes/source/components/rule/References.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type RefProps = {
}

function Ref({ name, link }: RefProps) {
const refKey = findRefKey(link),
domain = cleanDomain(link)
const refKey = findRefKey(link)
const domain = cleanDomain(link)
return (
<li
style={{
Expand Down

0 comments on commit 1ce36b4

Please sign in to comment.