Skip to content

Commit bcb736b

Browse files
Follows Mitch review to fix itemstore issue
1 parent 77fba0d commit bcb736b

File tree

3 files changed

+7
-72
lines changed

3 files changed

+7
-72
lines changed

src/AccordionItem/__snapshots__/accordion-item.spec.js.snap

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
exports[`AccordionItem renders correctly with accordion false 1`] = `
44
<div
55
className="accordion__item"
6-
itemstore={
7-
ItemContainer {
8-
"_listeners": Array [
9-
[Function],
10-
[Function],
11-
[Function],
12-
],
13-
"state": Object {
14-
"uuid": 0,
15-
},
16-
}
17-
}
186
>
197
<div
208
aria-controls="accordion__body-0"
@@ -48,18 +36,6 @@ exports[`AccordionItem renders correctly with accordion false 1`] = `
4836
exports[`AccordionItem renders correctly with accordion true 1`] = `
4937
<div
5038
className="accordion__item"
51-
itemstore={
52-
ItemContainer {
53-
"_listeners": Array [
54-
[Function],
55-
[Function],
56-
[Function],
57-
],
58-
"state": Object {
59-
"uuid": 0,
60-
},
61-
}
62-
}
6339
>
6440
<div
6541
aria-controls="accordion__body-0"
@@ -93,18 +69,6 @@ exports[`AccordionItem renders correctly with accordion true 1`] = `
9369
exports[`AccordionItem renders correctly with other blocks inside 1`] = `
9470
<div
9571
className="accordion__item"
96-
itemstore={
97-
ItemContainer {
98-
"_listeners": Array [
99-
[Function],
100-
[Function],
101-
[Function],
102-
],
103-
"state": Object {
104-
"uuid": 0,
105-
},
106-
}
107-
}
10872
>
10973
<div
11074
aria-controls="accordion__body-0"
@@ -141,18 +105,6 @@ exports[`AccordionItem renders correctly with other blocks inside 1`] = `
141105
exports[`AccordionItem renders correctly with other blocks inside 2 1`] = `
142106
<div
143107
className="accordion__item"
144-
itemstore={
145-
ItemContainer {
146-
"_listeners": Array [
147-
[Function],
148-
[Function],
149-
[Function],
150-
],
151-
"state": Object {
152-
"uuid": 0,
153-
},
154-
}
155-
}
156108
>
157109
<div
158110
aria-controls="accordion__body-0"
@@ -189,16 +141,6 @@ exports[`AccordionItem renders correctly with other blocks inside 2 1`] = `
189141
exports[`AccordionItem still renders with no AccordionItemTitle or AccordionItemBody 1`] = `
190142
<div
191143
className="accordion__item"
192-
itemstore={
193-
ItemContainer {
194-
"_listeners": Array [
195-
[Function],
196-
],
197-
"state": Object {
198-
"uuid": 0,
199-
},
200-
}
201-
}
202144
>
203145
<div>
204146
Fake title
@@ -212,15 +154,5 @@ exports[`AccordionItem still renders with no AccordionItemTitle or AccordionItem
212154
exports[`AccordionItem still renders with no children at all 1`] = `
213155
<div
214156
className="accordion__item"
215-
itemstore={
216-
ItemContainer {
217-
"_listeners": Array [
218-
[Function],
219-
],
220-
"state": Object {
221-
"uuid": 0,
222-
},
223-
}
224-
}
225157
/>
226158
`;

src/AccordionItem/accordion-item-wrapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const defaultProps = {
2222
disabled: false,
2323
expanded: false,
2424
accordionStore: new AccordionContainer(),
25-
uuid: null,
25+
uuid: undefined,
2626
};
2727

2828
class AccordionItemWrapper extends Component<AccordionItemWrapperProps> {
@@ -41,7 +41,7 @@ class AccordionItemWrapper extends Component<AccordionItemWrapperProps> {
4141
{...this.props}
4242
uuid={uuid}
4343
accordionStore={accordionStore}
44-
itemstore={itemStore}
44+
itemStore={itemStore}
4545
/>
4646
);
4747
}}

src/AccordionItem/accordion-item.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@ import type { ElementProps } from 'react';
55

66
import classNames from 'classnames';
77
import AccordionContainer from '../AccordionContainer/AccordionContainer';
8+
import ItemContainer from '../ItemContainer/ItemContainer';
89

910
type AccordionItemProps = ElementProps<'div'> & {
1011
uuid: string | number,
1112
hideBodyClassName: ?string,
1213
disabled: ?boolean,
1314
expanded: ?boolean,
1415
accordionStore: AccordionContainer,
16+
itemStore: ItemContainer,
1517
};
1618

1719
class AccordionItem extends Component<AccordionItemProps, *> {
1820
componentWillMount() {
19-
const { uuid, accordionStore, itemstore, disabled } = this.props;
21+
const { uuid, accordionStore, itemStore, disabled } = this.props;
2022

21-
itemstore.setUuid(uuid);
23+
itemStore.setUuid(uuid);
2224

2325
const currentItem = accordionStore.state.items.find(
2426
item => item.uuid === uuid,
@@ -59,6 +61,7 @@ class AccordionItem extends Component<AccordionItemProps, *> {
5961
accordionStore,
6062
disabled,
6163
expanded,
64+
itemStore,
6265
...rest
6366
} = this.props;
6467

0 commit comments

Comments
 (0)