-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added color and layout customization #35
base: master
Are you sure you want to change the base?
Conversation
readme.md
Outdated
@@ -98,3 +98,15 @@ Function to call when user selects an item. Item object is passed to that functi | |||
Type: `function` | |||
|
|||
Function to call when user highlights an item. Item object is passed to that function as an argument. | |||
|
|||
### displayDirection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change it to direction
?
readme.md
Outdated
@@ -37,7 +37,7 @@ const Demo = () => { | |||
} | |||
]; | |||
|
|||
return <SelectInput items={items} onSelect={handleSelect} />; | |||
return <SelectInput items={items} onSelect={handleSelect} defaultColor='green' accentColor='red' displayDirection='column'/>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return <SelectInput items={items} onSelect={handleSelect} defaultColor='green' accentColor='red' displayDirection='column'/>; | |
return <SelectInput items={items} onSelect={handleSelect} defaultColor="green" accentColor="red" displayDirection="column"/>; |
readme.md
Outdated
|
||
Type: `argument` | ||
|
||
Argument equal to `row` or `column`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argument equal to `row` or `column`. | |
Change the direction in which list items are displayed. Possible values are `row` or `column`. |
readme.md
Outdated
|
||
### displayDirection | ||
|
||
Type: `argument` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type: `argument` | |
Type: `argument`<br> | |
Default: `column` |
|
||
Argument equal to `row` or `column`. | ||
|
||
### defaultColor / accentColor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are quite a few comments I have on this change to colors, could you extract these changes into a separate PR?
@@ -98,7 +111,7 @@ function SelectInput<V>({ | |||
useInput( | |||
useCallback( | |||
(input, key) => { | |||
if (input === 'k' || key.upArrow) { | |||
if (input === 'k' || key.upArrow || key.leftArrow) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should determine which keys to listen to based on the list direction. Otherwise if direction is column
, pressing left arrow would change the selected item, which would be an incorrect behavior.
I updated the Readme as per your comments. Will work on the color and direction/navigation in a separate PR.
Co-authored-by: Vadim Demedes <[email protected]>
Added the ability to specify selector orientation:
-- include
displayDirection='column'
ordisplayDirection='row'
as an argument when calling SelectInput.Added the ability to pass in a default and an accent color variable.
-- include
defaultColor={someColor}
and/oraccentColor={diffColor}
I was having some trouble with NPM link and testing, but it should be good. Changes are relatively simple.