Skip to content

Additions: add clear button in core + add selected item support #146

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

Merged
merged 3 commits into from
Jan 20, 2021

Conversation

liatgo
Copy link
Contributor

@liatgo liatgo commented Jan 7, 2021

TODO - update README about selectedItem and remove markSelectedItem

1. Add clear button to core input:
image

2. Mark selected item (core + material):
basic mode:
image
image
search mode:
image
image

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @kenshooui/[email protected]
npm install @kenshooui/[email protected]
# or 
yarn add @kenshooui/[email protected]
yarn add @kenshooui/[email protected]

@liatgo liatgo requested a review from liorheber January 7, 2021 16:49
@@ -22,6 +24,11 @@ const Input = props => {
value={searchTerm}
onChange={onInputChange}
/>
{searchTerm !== "" && (
<span css={getStyles("clearInput", props)} onClick={onInputChange}>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be a button element, not a span.
It's intended for a click.

@@ -6,6 +6,7 @@ import SearchedItem from "./searched_item/searched_item";
import BasicItem from "./basic_item";

export const ForwardIconRenderer = () => <>➡️</>;
const defaultSelectedItem = { item: [], leaf: "" };
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the default be undefined? Nothing selected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even when nothing is selected I check if selectedItem equals to the current item that renders.
I'm using toString to check if the arrays are equal so I need to give a default that is different them undefined

@liatgo liatgo force-pushed the add-clear-button-and-mark-selected-item branch from d5ef1c0 to 9674229 Compare January 12, 2021 12:51
@liorheber liorheber merged commit 58f6643 into master Jan 20, 2021
@liorheber liorheber deleted the add-clear-button-and-mark-selected-item branch January 20, 2021 17:34
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