@woosmap/ui 4.5.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -62,8 +62,16 @@ class UseCase extends Component {
|
|
|
62
62
|
this.state = { stateSelected: false };
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
onClick = () => {
|
|
66
|
+
const { stateSelected } = this.state;
|
|
67
|
+
const { isSelectable } = this.props;
|
|
68
|
+
if (isSelectable) {
|
|
69
|
+
this.setState({ stateSelected: !stateSelected });
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
65
73
|
render() {
|
|
66
|
-
const { className, children, testId, ...rest } = this.props;
|
|
74
|
+
const { className, children, isSelectable, testId, ...rest } = this.props;
|
|
67
75
|
const { stateSelected } = this.state;
|
|
68
76
|
const classes = cl('use-case', stateSelected ? 'use-case--selected' : false, className);
|
|
69
77
|
return (
|
|
@@ -71,7 +79,7 @@ class UseCase extends Component {
|
|
|
71
79
|
className={classes}
|
|
72
80
|
role="button"
|
|
73
81
|
data-testid={testId}
|
|
74
|
-
onClick={
|
|
82
|
+
onClick={this.onClick}
|
|
75
83
|
onKeyDown={() => {}}
|
|
76
84
|
tabIndex="-1"
|
|
77
85
|
{...rest}
|
|
@@ -85,6 +93,7 @@ class UseCase extends Component {
|
|
|
85
93
|
UseCase.defaultProps = {
|
|
86
94
|
testId: 'usecase',
|
|
87
95
|
className: '',
|
|
96
|
+
isSelectable: false,
|
|
88
97
|
product: PropTypes.oneOf([
|
|
89
98
|
'LOCALITIES',
|
|
90
99
|
'LOCALITIES_ADDRESS_UK',
|
|
@@ -108,6 +117,7 @@ UseCase.propTypes = {
|
|
|
108
117
|
testId: PropTypes.string,
|
|
109
118
|
className: PropTypes.string,
|
|
110
119
|
product: PropTypes.string,
|
|
120
|
+
isSelectable: PropTypes.bool,
|
|
111
121
|
};
|
|
112
122
|
|
|
113
123
|
export default Object.assign(UseCase, {
|
|
@@ -10,7 +10,7 @@ export default Story;
|
|
|
10
10
|
|
|
11
11
|
const Template = () => (
|
|
12
12
|
<div className="mbib flex-column">
|
|
13
|
-
<UseCase>
|
|
13
|
+
<UseCase isSelectable>
|
|
14
14
|
<div className="use-case__header">Store Locator</div>
|
|
15
15
|
<div className="use-case__body">Store Locator</div>
|
|
16
16
|
<div className="use-case__footer">
|