Skip to content

Added function render function option #96

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

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

Conversation

imbedhead
Copy link

No description provided.

Copy link
Owner

@yury-dymov yury-dymov left a comment

Choose a reason for hiding this comment

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

Overall changes look great!
Please address some nits and let's also change 52 to the proper item height evaluation. Depends on styles and custom element renderers the height may vary so we would really like to be able support all kinds of heights. I promise to review much faster next time.

@@ -72,6 +74,8 @@ const defaultProps = {
offsetY: 0,
value: null,
passThroughEnter: false,
renderOptionsList: (markUp, plaintext)=> markUp,
Copy link
Owner

Choose a reason for hiding this comment

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

nit: (markUp, plaintext) => markUp,

const helperOptions = options.slice(0, optionNumber).map((val, idx) => {
const highlightStart = val.toLowerCase().indexOf(value.substr(matchStart, matchLength).toLowerCase());
height -= 52;
Copy link
Owner

Choose a reason for hiding this comment

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

Why 52? Magic constant here is confusing

</li>
);
});

if (!expandUp) {
height = top + offsetY;
Copy link
Owner

Choose a reason for hiding this comment

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

The way logic is spreaded for height evaluation if confusing.

Something like below would be cleaner from my perspective:

const height = expandUp ? (offsetY + helperOptions.length * optionHeight) : top + offsetY;

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