@woosmap/ui 4.5.0 → 4.7.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
|
@@ -35,20 +35,12 @@ const productImg = {
|
|
|
35
35
|
class Footer extends Component {
|
|
36
36
|
render() {
|
|
37
37
|
const { products, ...rest } = this.props;
|
|
38
|
-
return (
|
|
39
|
-
<div className="use-case__product-item" {...rest}>
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
<img
|
|
43
|
-
className="use-case__product-item__image"
|
|
44
|
-
src={productImg[product.id]}
|
|
45
|
-
alt={product.name}
|
|
46
|
-
/>
|
|
47
|
-
<span className="use-case__product-item__name">{product.name}</span>
|
|
48
|
-
</>
|
|
49
|
-
))}
|
|
38
|
+
return products.map((product) => (
|
|
39
|
+
<div className="use-case__product-item" {...rest} key={product.id}>
|
|
40
|
+
<img className="use-case__product-item__image" src={productImg[product.id]} alt={product.name} />
|
|
41
|
+
<span className="use-case__product-item__name">{product.name}</span>
|
|
50
42
|
</div>
|
|
51
|
-
);
|
|
43
|
+
));
|
|
52
44
|
}
|
|
53
45
|
}
|
|
54
46
|
|
|
@@ -62,8 +54,16 @@ class UseCase extends Component {
|
|
|
62
54
|
this.state = { stateSelected: false };
|
|
63
55
|
}
|
|
64
56
|
|
|
57
|
+
onClick = () => {
|
|
58
|
+
const { stateSelected } = this.state;
|
|
59
|
+
const { isSelectable } = this.props;
|
|
60
|
+
if (isSelectable) {
|
|
61
|
+
this.setState({ stateSelected: !stateSelected });
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
65
|
render() {
|
|
66
|
-
const { className, children, testId, ...rest } = this.props;
|
|
66
|
+
const { className, children, isSelectable, testId, ...rest } = this.props;
|
|
67
67
|
const { stateSelected } = this.state;
|
|
68
68
|
const classes = cl('use-case', stateSelected ? 'use-case--selected' : false, className);
|
|
69
69
|
return (
|
|
@@ -71,7 +71,7 @@ class UseCase extends Component {
|
|
|
71
71
|
className={classes}
|
|
72
72
|
role="button"
|
|
73
73
|
data-testid={testId}
|
|
74
|
-
onClick={
|
|
74
|
+
onClick={this.onClick}
|
|
75
75
|
onKeyDown={() => {}}
|
|
76
76
|
tabIndex="-1"
|
|
77
77
|
{...rest}
|
|
@@ -85,6 +85,7 @@ class UseCase extends Component {
|
|
|
85
85
|
UseCase.defaultProps = {
|
|
86
86
|
testId: 'usecase',
|
|
87
87
|
className: '',
|
|
88
|
+
isSelectable: false,
|
|
88
89
|
product: PropTypes.oneOf([
|
|
89
90
|
'LOCALITIES',
|
|
90
91
|
'LOCALITIES_ADDRESS_UK',
|
|
@@ -108,6 +109,7 @@ UseCase.propTypes = {
|
|
|
108
109
|
testId: PropTypes.string,
|
|
109
110
|
className: PropTypes.string,
|
|
110
111
|
product: PropTypes.string,
|
|
112
|
+
isSelectable: PropTypes.bool,
|
|
111
113
|
};
|
|
112
114
|
|
|
113
115
|
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">
|