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

EcrituresNumeriques / stylo / 12925854411

23 Jan 2025 09:11AM UTC coverage: 25.831% (-4.7%) from 30.523%
12925854411

push

github

web-flow
Merge pull request #1192 from EcrituresNumeriques/feat/vite6

322 of 518 branches covered (62.16%)

Branch coverage included in aggregate %.

3448 of 14077 relevant lines covered (24.49%)

1.66 hits per line

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

0.0
/front/src/components/Modal.jsx
1
import React, { useEffect, useRef } from 'react'
×
2
import PropTypes from 'prop-types'
×
3
import { X } from 'react-feather'
×
4
import Button from './Button'
×
5

6
import styles from './modal.module.scss'
×
7

8
const noop = () => {}
×
9

10
export default function Modal({ title, children, cancel = noop }) {
×
11
  const ref = useRef()
×
12

13
  useEffect(() => {
×
14
    ref.current.showModal()
×
15
    document.body.setAttribute('data-scrolling', false)
×
16

17
    return function cleanup() {
×
18
      document.body.removeAttribute('data-scrolling')
×
19
    }
×
20
  }, [])
×
21

22
  return (
×
23
    <dialog
×
24
      open={false}
×
25
      className={styles.modal}
×
26
      ref={ref}
×
27
      onClose={cancel}
×
28
      aria-labelledby="modal-title"
×
29
    >
30
      <Button
×
31
        aria-label="Close modal"
×
32
        icon={true}
×
33
        className={[styles.secondary, styles.closeButton].join(' ')}
×
34
        onClick={cancel}
×
35
      >
36
        <X aria-hidden />
×
37
      </Button>
×
38

39
      <h1 id="modal-title" className={styles.title}>
×
40
        {title}
×
41
      </h1>
×
42

43
      <div className={styles.modalBody}>{children}</div>
×
44
    </dialog>
×
45
  )
46
}
×
47

48
Modal.propTypes = {
×
49
  title: PropTypes.string.isRequired,
×
50
  cancel: PropTypes.func,
×
51
  children: PropTypes.oneOfType([
×
52
    PropTypes.arrayOf(PropTypes.node),
×
53
    PropTypes.node,
×
54
  ]).isRequired,
×
55
}
×
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