Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

H3RSKO
Copy link

@H3RSKO H3RSKO commented Oct 5, 2020

Added the ability to specify selector orientation:
-- include displayDirection='column' or displayDirection='row' as an argument when calling SelectInput.

Added the ability to pass in a default and an accent color variable.
-- include defaultColor={someColor} and/or accentColor={diffColor}

I was having some trouble with NPM link and testing, but it should be good. Changes are relatively simple.

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
Copy link
Owner

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'/>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Type: `argument`
Type: `argument`<br>
Default: `column`


Argument equal to `row` or `column`.

### defaultColor / accentColor
Copy link
Owner

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) {
Copy link
Owner

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.

H3RSKO and others added 2 commits October 20, 2020 13:38
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants