@@ -9,37 +9,49 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
9
9
OF ANY KIND, either express or implied. See the License for the specific language
10
10
governing permissions and limitations under the License.
11
11
*/
12
- import React from 'react'
12
+ /** @jsx jsx */
13
+ import { css , jsx } from '@emotion/react'
13
14
import PropTypes from 'prop-types'
14
15
import { ActionButton , Text } from '@adobe/react-spectrum'
15
16
16
17
import Bug from '@spectrum-icons/workflow/Bug'
17
18
import Edit from '@spectrum-icons/workflow/Edit'
18
19
19
- const ActionButtons = ( { gitUrl, filePath, branch, issues, ...props } ) => (
20
+ const ActionLink = ( { href, children } ) => (
21
+ < a
22
+ href = { href }
23
+ css = { css `
24
+ text-decoration : none;
25
+ ` }
26
+ target = '_blank'
27
+ rel = 'noopener noreferrer nofollow'
28
+ >
29
+ { children }
30
+ </ a >
31
+ )
32
+
33
+ const ActionButtons = ( {
34
+ gitUrl = '' ,
35
+ filePath = '' ,
36
+ branch = '' ,
37
+ issues,
38
+ ...props
39
+ } ) => (
20
40
< div { ...props } >
21
- < ActionButton
22
- isQuiet
23
- onPress = { ( ) => {
24
- document . location . href = `${ gitUrl } /edit/${ branch } /${ filePath } `
25
- } }
26
- aria-label = 'Edit page'
27
- >
28
- < Edit size = 'S' />
29
- < Text > Edit this page</ Text >
30
- </ ActionButton >
31
- < ActionButton
32
- isQuiet
33
- onPress = { ( ) => {
34
- issues
35
- ? ( document . location . href = issues )
36
- : ( document . location . href = `${ gitUrl } /issues/new?body=Issue%20in%20${ filePath } ` )
37
- } }
38
- aria-label = 'Log issue'
41
+ < ActionLink href = { `${ gitUrl } /edit/${ branch } /${ filePath } ` } >
42
+ < ActionButton isQuiet aria-label = 'Edit page' excludeFromTabOrder >
43
+ < Edit size = 'S' />
44
+ < Text > Edit this page</ Text >
45
+ </ ActionButton >
46
+ </ ActionLink >
47
+ < ActionLink
48
+ href = { issues || `${ gitUrl } /issues/new?body=Issue%20in%20${ filePath } ` }
39
49
>
40
- < Bug size = 'S' />
41
- < Text > Log an issue</ Text >
42
- </ ActionButton >
50
+ < ActionButton isQuiet aria-label = 'Log issue' excludeFromTabOrder >
51
+ < Bug size = 'S' />
52
+ < Text > Log an issue</ Text >
53
+ </ ActionButton >
54
+ </ ActionLink >
43
55
</ div >
44
56
)
45
57
@@ -49,10 +61,4 @@ ActionButtons.propTypes = {
49
61
gitUrl : PropTypes . string
50
62
}
51
63
52
- ActionButtons . defaultProps = {
53
- branch : '' ,
54
- filePath : '' ,
55
- gitUrl : ''
56
- }
57
-
58
64
export { ActionButtons }
0 commit comments