File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
- import { Button , StyledOcticon } from '@primer/components'
1
+ import { Button , StyledOcticon , themeGet } from '@primer/components'
2
2
import { CheckIcon , CopyIcon } from '@primer/octicons-react'
3
+ import styled from 'styled-components'
3
4
import copy from 'copy-to-clipboard'
4
5
import React from 'react'
5
6
7
+ const CopyToClipboard = styled ( Button ) `
8
+ &:focus {
9
+ box-shadow: 0 0 0 3px ${ themeGet ( 'colors.blue.5' ) } ;
10
+ }
11
+ `
12
+
6
13
function ClipboardCopy ( { value} ) {
7
14
const [ copied , setCopied ] = React . useState ( false )
8
15
@@ -15,15 +22,15 @@ function ClipboardCopy({value}) {
15
22
} , [ copied ] )
16
23
17
24
return (
18
- < Button
25
+ < CopyToClipboard
19
26
aria-label = "Copy to clipboard"
20
27
onClick = { ( ) => {
21
28
copy ( value )
22
29
setCopied ( true )
23
30
} }
24
31
>
25
32
{ copied ? < StyledOcticon icon = { CheckIcon } color = "green.5" /> : < StyledOcticon icon = { CopyIcon } color = "gray.7" /> }
26
- </ Button >
33
+ </ CopyToClipboard >
27
34
)
28
35
}
29
36
You can’t perform that action at this time.
0 commit comments