Skip to content

Commit 113417a

Browse files
committed
* removes unused es-lint disable rule
* destructure "key" from event * changes options map variable name
1 parent 82f2a8f commit 113417a

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/SelectBox/SelectBox.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const SelectBox = React.forwardRef(function SelectBox(props) {
1212
const selectedListItemRef = useRef(null);
1313
const listRef = useRef(null);
1414

15-
const handleKeyDown = event => {
16-
const { key } = event;
15+
const handleKeyDown = ({ key }) => {
1716
switch (key) {
1817
case 'ArrowDown':
1918
if (value < options.length - 1) onSelect(value + 1);
@@ -40,16 +39,16 @@ const SelectBox = React.forwardRef(function SelectBox(props) {
4039
ref={listRef}
4140
onKeyDown={handleKeyDown}
4241
>
43-
{options.map(o => (
44-
<StyledOptionsListItem key={o.value.toString()}>
42+
{options.map(option => (
43+
<StyledOptionsListItem key={option.value.toString()}>
4544
<StyledOptionsListItemInnerButton
46-
onClick={() => onSelect(o.value)}
45+
onClick={() => onSelect(option.value)}
4746
type='button'
48-
autoFocus={o.value === value}
49-
isSelected={o.value === value}
50-
ref={o.value === value ? selectedListItemRef : null}
47+
autoFocus={option.value === value}
48+
isSelected={option.value === value}
49+
ref={option.value === value ? selectedListItemRef : null}
5150
>
52-
{o.label}
51+
{option.label}
5352
</StyledOptionsListItemInnerButton>
5453
</StyledOptionsListItem>
5554
))}

src/SelectBox/SelectBox.stories.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import React, { useState } from 'react';
32
import styled from 'styled-components';
43

0 commit comments

Comments
 (0)