• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

inclusion-numerique / coop-mediation-numerique / 327e9be6-2e04-49bd-93a0-d8e55d9dde58

21 Jan 2026 12:55PM UTC coverage: 7.441% (-2.6%) from 10.027%
327e9be6-2e04-49bd-93a0-d8e55d9dde58

push

circleci

web-flow
Merge pull request #381 from inclusion-numerique/dev

release

469 of 9630 branches covered (4.87%)

Branch coverage included in aggregate %.

24 of 1556 new or added lines in 160 files covered. (1.54%)

1049 existing lines in 152 files now uncovered.

1330 of 14546 relevant lines covered (9.14%)

41.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/apps/web/src/components/BackButtonWithModal.tsx
1
'use client'
2

3
import Button, { type ButtonProps } from '@codegouvfr/react-dsfr/Button'
4
import { createModal } from '@codegouvfr/react-dsfr/Modal'
5
import classNames from 'classnames'
6
import { useRouter } from 'next/navigation'
7
import React, { ReactNode } from 'react'
8

9
const BackButtonModalDefinition = createModal({
×
10
  id: 'back-button-modal',
11
  isOpenedByDefault: false,
12
})
13

14
const BackButtonWithModal = ({
×
15
  modalTitle,
16
  modalContent,
17
  modalConfirmButtonLabel = 'Quitter',
×
18
  modalCancelButtonLabel = 'Annuler',
×
19
  href,
20
  children = 'Retour',
×
21
  className,
22
}: {
23
  modalTitle: ReactNode
24
  modalContent: ReactNode
25
  modalConfirmButtonLabel?: string
26
  modalCancelButtonLabel?: string
27
  href?: string // no href means use router.back()
28
  children?: ReactNode
29
  className?: string
30
}) => {
NEW
31
  const router = useRouter()
×
NEW
32
  const backButtonProps = href
×
33
    ? ({
34
        linkProps: { href },
35
        children: modalConfirmButtonLabel,
36
      } satisfies ButtonProps)
37
    : ({
NEW
38
        onClick: () => router.back(),
×
39
        children: modalConfirmButtonLabel,
40
      } satisfies ButtonProps)
41

NEW
42
  return (
×
43
    <>
44
      <Button
45
        priority="tertiary no outline"
46
        size="small"
47
        className={classNames('fr-mt-4v fr-mb-4v', className)}
48
        iconId="fr-icon-arrow-left-line"
49
        {...BackButtonModalDefinition.buttonProps}
50
      >
51
        {children}
52
      </Button>
53
      <BackButtonModalDefinition.Component
54
        title={modalTitle}
55
        buttons={[
56
          {
57
            children: modalCancelButtonLabel,
58
            priority: 'secondary',
59
            onClick: BackButtonModalDefinition.close,
60
          },
61
          backButtonProps,
62
        ]}
63
      >
64
        {modalContent}
65
      </BackButtonModalDefinition.Component>
66
    </>
67
  )
68
}
69

70
export default BackButtonWithModal
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc