Skip to content

Commit da33b38

Browse files
authored
feat(item): adds selected class for item container (#155)
1 parent ff426f1 commit da33b38

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

__tests__/__snapshots__/index.spec.js.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ exports[`object-based items match the snapshot of dropdown, list, and item 1`] =
3636
class="rta__list my-rta-list"
3737
>
3838
<li
39-
class="rta__item my-rta-item"
39+
class="rta__item rta__item--selected my-rta-item"
4040
style="background: green;"
4141
>
4242
<div
@@ -52,7 +52,7 @@ exports[`object-based items match the snapshot of dropdown, list, and item 1`] =
5252
</div>
5353
</li>
5454
<li
55-
class="rta__item my-rta-item"
55+
class="rta__item my-rta-item"
5656
style="background: green;"
5757
>
5858
<div
@@ -76,7 +76,7 @@ exports[`object-based items match the snapshot of dropdown, list, and item 2`] =
7676
class="rta__list my-rta-list"
7777
>
7878
<li
79-
class="rta__item my-rta-item"
79+
class="rta__item rta__item--selected my-rta-item"
8080
style="background: green;"
8181
>
8282
<div
@@ -92,7 +92,7 @@ exports[`object-based items match the snapshot of dropdown, list, and item 2`] =
9292
</div>
9393
</li>
9494
<li
95-
class="rta__item my-rta-item"
95+
class="rta__item my-rta-item"
9696
style="background: green;"
9797
>
9898
<div
@@ -112,7 +112,7 @@ exports[`object-based items match the snapshot of dropdown, list, and item 2`] =
112112

113113
exports[`object-based items match the snapshot of dropdown, list, and item 3`] = `
114114
<li
115-
class="rta__item my-rta-item"
115+
class="rta__item rta__item--selected my-rta-item"
116116
style="background: green;"
117117
>
118118
<div
@@ -165,7 +165,7 @@ exports[`object-based items with keys match the snapshot of dropdown, list, and
165165
class="rta__list my-rta-list"
166166
>
167167
<li
168-
class="rta__item my-rta-item"
168+
class="rta__item rta__item--selected my-rta-item"
169169
style="background: green;"
170170
>
171171
<div
@@ -181,7 +181,7 @@ exports[`object-based items with keys match the snapshot of dropdown, list, and
181181
</div>
182182
</li>
183183
<li
184-
class="rta__item my-rta-item"
184+
class="rta__item my-rta-item"
185185
style="background: green;"
186186
>
187187
<div
@@ -197,7 +197,7 @@ exports[`object-based items with keys match the snapshot of dropdown, list, and
197197
</div>
198198
</li>
199199
<li
200-
class="rta__item my-rta-item"
200+
class="rta__item my-rta-item"
201201
style="background: green;"
202202
>
203203
<div
@@ -221,7 +221,7 @@ exports[`object-based items with keys match the snapshot of dropdown, list, and
221221
class="rta__list my-rta-list"
222222
>
223223
<li
224-
class="rta__item my-rta-item"
224+
class="rta__item rta__item--selected my-rta-item"
225225
style="background: green;"
226226
>
227227
<div
@@ -237,7 +237,7 @@ exports[`object-based items with keys match the snapshot of dropdown, list, and
237237
</div>
238238
</li>
239239
<li
240-
class="rta__item my-rta-item"
240+
class="rta__item my-rta-item"
241241
style="background: green;"
242242
>
243243
<div
@@ -253,7 +253,7 @@ exports[`object-based items with keys match the snapshot of dropdown, list, and
253253
</div>
254254
</li>
255255
<li
256-
class="rta__item my-rta-item"
256+
class="rta__item my-rta-item"
257257
style="background: green;"
258258
>
259259
<div
@@ -273,7 +273,7 @@ exports[`object-based items with keys match the snapshot of dropdown, list, and
273273

274274
exports[`object-based items with keys match the snapshot of dropdown, list, and item 3`] = `
275275
<li
276-
class="rta__item my-rta-item"
276+
class="rta__item rta__item--selected my-rta-item"
277277
style="background: green;"
278278
>
279279
<div

src/Item.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ export default class Item extends React.Component<ItemProps, *> {
3737
} = this.props;
3838

3939
return (
40-
<li className={`rta__item ${className || ""}`} style={style}>
40+
<li
41+
className={`rta__item ${
42+
selected === true ? "rta__item--selected" : ""
43+
} ${className || ""}`}
44+
style={style}
45+
>
4146
<div
4247
className={`rta__entity ${
4348
selected === true ? "rta__entity--selected" : ""

0 commit comments

Comments
 (0)