File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ const SelectBox = React.forwardRef(function SelectBox(props) {
12
12
const selectedListItemRef = useRef ( null ) ;
13
13
const listRef = useRef ( null ) ;
14
14
15
- const handleKeyDown = event => {
16
- const { key } = event ;
15
+ const handleKeyDown = ( { key } ) => {
17
16
switch ( key ) {
18
17
case 'ArrowDown' :
19
18
if ( value < options . length - 1 ) onSelect ( value + 1 ) ;
@@ -40,16 +39,16 @@ const SelectBox = React.forwardRef(function SelectBox(props) {
40
39
ref = { listRef }
41
40
onKeyDown = { handleKeyDown }
42
41
>
43
- { options . map ( o => (
44
- < StyledOptionsListItem key = { o . value . toString ( ) } >
42
+ { options . map ( option => (
43
+ < StyledOptionsListItem key = { option . value . toString ( ) } >
45
44
< StyledOptionsListItemInnerButton
46
- onClick = { ( ) => onSelect ( o . value ) }
45
+ onClick = { ( ) => onSelect ( option . value ) }
47
46
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 }
51
50
>
52
- { o . label }
51
+ { option . label }
53
52
</ StyledOptionsListItemInnerButton >
54
53
</ StyledOptionsListItem >
55
54
) ) }
Original file line number Diff line number Diff line change 1
- /* eslint-disable no-console */
2
1
import React , { useState } from 'react' ;
3
2
import styled from 'styled-components' ;
4
3
You can’t perform that action at this time.
0 commit comments