File tree 7 files changed +93
-7
lines changed
7 files changed +93
-7
lines changed Original file line number Diff line number Diff line change 18
18
"no-plusplus" : 0 ,
19
19
"no-unused-expressions" : 0 ,
20
20
"babel/no-unused-expressions" : 2 ,
21
- "import/prefer-default-export" : 0
21
+ "import/prefer-default-export" : 0 ,
22
+ "jsx-a11y/anchor-is-valid" : [
23
+ " error" ,
24
+ {
25
+ "components" : [" Link" ],
26
+ "specialLink" : [" hrefLeft" , " hrefRight" ],
27
+ "aspects" : [" noHref" , " preferButton" ]
28
+ }
29
+ ]
22
30
}
23
31
}
Original file line number Diff line number Diff line change 1
1
import React , { Component , Fragment } from "react" ;
2
2
import PropTypes from "prop-types" ;
3
- import _ from "lodash" ;
3
+ import Tab from "./Tab" ;
4
+
5
+ import { onEnter } from "../helpers" ;
4
6
5
7
class ControlledTab extends Component {
6
8
state = {
@@ -22,14 +24,18 @@ class ControlledTab extends Component {
22
24
< Fragment >
23
25
< Tab block >
24
26
{ this . props . options . map ( ( { label, value } ) => {
27
+ const onClick = ( ) => {
28
+ this . setState ( { active : value } ) ;
29
+ } ;
30
+
25
31
return (
26
32
< Fragment key = { value } >
27
33
< Tab . Heading
28
34
active = { this . state . active === value }
29
- onClick = { ( ) => {
30
- this . setState ( { active : value } ) ;
31
- } }
32
- children = { < a > { label } </ a > }
35
+ tabIndex = "0"
36
+ onClick = { onClick }
37
+ onKeyPress = { onEnter ( onClick ) }
38
+ children = { < a href = "#" > { label } </ a > }
33
39
/>
34
40
</ Fragment >
35
41
) ;
@@ -40,8 +46,10 @@ class ControlledTab extends Component {
40
46
) ;
41
47
}
42
48
}
49
+
43
50
ControlledTab . defaultProps = {
44
- defaultActive : undefined
51
+ defaultActive : undefined ,
52
+ options : [ ]
45
53
} ;
46
54
47
55
ControlledTab . propTypes = {
Original file line number Diff line number Diff line change @@ -28,4 +28,18 @@ const EmptyState = props => {
28
28
) ;
29
29
} ;
30
30
31
+ EmptyState . defaultProps = {
32
+ className : "" ,
33
+ children : undefined ,
34
+ title : undefined ,
35
+ icon : undefined
36
+ } ;
37
+
38
+ EmptyState . propTypes = {
39
+ className : PropTypes . string ,
40
+ children : PropTypes . node ,
41
+ title : PropTypes . node ,
42
+ icon : PropTypes . node
43
+ } ;
44
+
31
45
export default EmptyState ;
Original file line number Diff line number Diff line change @@ -25,4 +25,14 @@ const Page = props => {
25
25
return < div { ...myProps } className = { className } /> ;
26
26
} ;
27
27
28
+ Page . defaultProps = {
29
+ className : "" ,
30
+ centered : false
31
+ } ;
32
+
33
+ Page . propTypes = {
34
+ className : PropTypes . string ,
35
+ centered : PropTypes . bool
36
+ } ;
37
+
28
38
export default Page ;
Original file line number Diff line number Diff line change @@ -38,4 +38,18 @@ const Panel = props => {
38
38
) ;
39
39
} ;
40
40
41
+ Panel . defaultProps = {
42
+ className : "" ,
43
+ children : undefined ,
44
+ title : undefined ,
45
+ footer : undefined
46
+ } ;
47
+
48
+ Panel . propTypes = {
49
+ className : PropTypes . string ,
50
+ children : PropTypes . node ,
51
+ title : PropTypes . node ,
52
+ footer : PropTypes . node
53
+ } ;
54
+
41
55
export default Panel ;
Original file line number Diff line number Diff line change @@ -28,6 +28,16 @@ const Tab = props => {
28
28
return < ul { ...myProps } className = { className } /> ;
29
29
} ;
30
30
31
+ Tab . defaultProps = {
32
+ className : "" ,
33
+ block : false
34
+ } ;
35
+
36
+ Tab . propTypes = {
37
+ className : PropTypes . string ,
38
+ block : PropTypes . bool
39
+ } ;
40
+
31
41
Tab . Heading = props => {
32
42
const { active } = props ;
33
43
// add the className prop to the className
@@ -46,4 +56,14 @@ Tab.Heading = props => {
46
56
return < li { ...myProps } className = { className } /> ;
47
57
} ;
48
58
59
+ Tab . Heading . defaultProps = {
60
+ className : "" ,
61
+ active : false
62
+ } ;
63
+
64
+ Tab . Heading . propTypes = {
65
+ className : PropTypes . string ,
66
+ active : PropTypes . bool
67
+ } ;
68
+
49
69
export default Tab ;
Original file line number Diff line number Diff line change @@ -29,4 +29,16 @@ const Toast = props => {
29
29
return < div { ...myProps } className = { className } /> ;
30
30
} ;
31
31
32
+ Toast . defaultProps = {
33
+ className : "" ,
34
+ primary : false ,
35
+ centered : false
36
+ } ;
37
+
38
+ Toast . propTypes = {
39
+ className : PropTypes . string ,
40
+ primary : PropTypes . bool ,
41
+ centered : PropTypes . bool
42
+ } ;
43
+
32
44
export default Toast ;
You can’t perform that action at this time.
0 commit comments