Add documentation nav menu

pull/2143/head
Jérémy Rialland 2022-08-01 12:55:31 +02:00 committed by Johan Girod
parent 75e5aef14d
commit bb7d45cb97
4 changed files with 16 additions and 18 deletions

View File

@ -32,7 +32,8 @@
"i18n:translate": "yarn workspace site i18n:translate"
},
"resolutions": {
"@types/download/@types/got": "8.3.1"
"@types/download/@types/got": "8.3.1",
"publicodes-react": "betagouv/publicodes#head=add-rules-tree-nav&workspace=publicodes-react"
},
"//": "@types/got:^9 is a hack to do a conflict with @types/download/@types/got and fix type error in download package https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/58929",
"devDependencies": {

View File

@ -81,7 +81,7 @@ export const ServiceWorker = () => {
onRegisterError: (error) => {
// eslint-disable-next-line no-console
console.log('SW registration error', error)
console.error('SW registration error', error)
},
})

View File

@ -15,7 +15,7 @@ import { RootState } from '@/reducers/rootReducer'
import { useSitePaths } from '@/sitePaths'
import rules, { DottedName } from 'modele-social'
import { getDocumentationSiteMap, RulePage } from 'publicodes-react'
import React, { ComponentType, useMemo } from 'react'
import { ComponentProps, useMemo, useRef } from 'react'
import { Helmet } from 'react-helmet-async'
import { Trans, useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
@ -57,7 +57,7 @@ export default function MonEntrepriseRulePage() {
name={documentationSitePaths[pathname]}
/>
<ScrollToTop key={pathname} />
<Grid item md={10}>
<Grid item xs={12}>
<BackToSimulation />
<Spacing xl />
<DocumentationPageBody />
@ -77,6 +77,13 @@ function DocumentationPageBody() {
const { i18n } = useTranslation()
const params = useParams<{ '*': string }>()
const { current: renderers } = useRef({
Head: Helmet,
Link,
Text: Markdown,
References,
} as ComponentProps<typeof RulePage>['renderers'])
return (
<StyledDocumentation>
<RulePage
@ -84,17 +91,7 @@ function DocumentationPageBody() {
rulePath={params['*'] ?? ''}
engine={engine}
documentationPath={documentationPath}
renderers={{
Head: Helmet as ComponentType<{
children: React.ReactNode
}>,
Link: Link as ComponentType<{
to: string
children: React.ReactNode
}>,
Text: Markdown,
References,
}}
renderers={renderers}
/>
</StyledDocumentation>
)

View File

@ -23319,15 +23319,15 @@ __metadata:
languageName: node
linkType: hard
"publicodes-react@npm:^1.0.0-beta.46":
"publicodes-react@betagouv/publicodes#head=add-rules-tree-nav&workspace=publicodes-react":
version: 1.0.0-beta.46
resolution: "publicodes-react@npm:1.0.0-beta.46"
resolution: "publicodes-react@https://github.com/betagouv/publicodes.git#workspace=publicodes-react&commit=a6b3689ddf1842c5de9b9e3324e7d2adfa26f621"
dependencies:
styled-components: ^5.1.0
peerDependencies:
publicodes: 1.0.0-beta.40
react: ^17 || ^18
checksum: c335ef34060d333756fdff39eebe8827141edbe87ba097d380faeeda6f00c948f49cfd4961a249d417460001261933013cfc3ea2bfcaeb8bac79a81be807abf7
checksum: 4f510360b0c9d65b214ab90d9a42a78cc1219917a615f347da775334c12592acfa6911626ab97f2f192b7c9436967475730dc6a5730e8f6d521dbc60ba2ade80
languageName: node
linkType: hard