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

zooniverse / front-end-monorepo / 16273721427

14 Jul 2025 05:34PM UTC coverage: 77.871% (-0.06%) from 77.933%
16273721427

Pull #6959

github

web-flow
Merge ba06fe453 into 8eaeac2ec
Pull Request #6959: lib-react-components: Add ShareIconButton component

11264 of 16867 branches covered (66.78%)

Branch coverage included in aggregate %.

17 of 26 new or added lines in 4 files covered. (65.38%)

2 existing lines in 1 file now uncovered.

17458 of 20017 relevant lines covered (87.22%)

401.02 hits per line

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

32.08
/packages/lib-react-components/src/ShareIconButton/ShareIconButton.js
1
import { Notification } from 'grommet'
1✔
2
import { ShareOption } from 'grommet-icons'
70!
3
import { useState } from 'react'
1✔
4

5
import { useTranslation } from '../translations/i18n'
1✔
6
import IconActionButton from '../IconActionButton'
2✔
7

8
function ShareIconButton({
9
  ...props
4✔
10
}) {
11
  const [visible, setVisible] = useState(false)
4✔
12

13
  const { t } = useTranslation()
4✔
14

NEW
15
  async function writeClipboardText() {
×
NEW
16
    const url = window.location.href
×
17
    
18
    try {
NEW
19
      await navigator.clipboard.writeText(url)
×
20
    } catch (error) {
NEW
21
      console.error(error.message)
×
22
    }
NEW
23
  }
×
24

NEW
25
  async function onOpen() {
×
26
    await writeClipboardText()
NEW
27
    setVisible(true)
×
NEW
28
  }
×
29
  
30
  function onClose() {
NEW
31
    setVisible(false)
×
32
  }
33

34
  return (
4✔
35
    <>
36
      <IconActionButton
37
        a11yTitle={t('ShareIconButton.share')}
38
        icon={<ShareOption />}
39
        onClick={onOpen}
40
        {...props}
41
      />
42
      {visible && (
4!
43
        <Notification
44
          message={t('ShareIconButton.copied')}
45
          onClose={onClose}
46
          time={4000}
47
          toast
48
        />
49
      )}
50
    </>
51
  )
52
}
1✔
53

54
export default ShareIconButton
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