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

Add new revamped dropdown widget #9815

Closed
wants to merge 171 commits into from
Closed

Conversation

nakulnagargade
Copy link
Collaborator

Closes #8228.

@nakulnagargade nakulnagargade changed the base branch from appbuilder-1.7 to appbuilder-1.8 May 27, 2024 05:36
@nakulnagargade
Copy link
Collaborator Author

Search box loses focus as soon as user types. Prevent user from typing more than one word

Screen.Recording.2024-05-23.at.4.37.47.PM.mov

This is fixed.

Copy link

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentValue, JSON.stringify(selectOptions)]);

useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we split it into multiple functions? Do we really need to update all exposed variables when only one value changes? Atleast we can move out the exposed functions to separate useEffect since new functions are created in every invocations

height: _height,
boxShadow: state.isFocused ? boxShadow : boxShadow,
borderRadius: Number.parseFloat(fieldBorderRadius),
borderColor: !isValid
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we move all these nested ternary logic to a separate function if its nested more than 3 or 4 levels
Sample:

const getInputBorderColor = () => {
  if (!isValid) {
    return 'var(--status-error-strong)';
  }

  if (state.isFocused) {
    if (accentColor !== '#4368E3') {
      return accentColor;
    }
    return 'var(--primary-accent-strong)';
  }

  if (fieldBorderColor !== '#CCD1D5') {
    return fieldBorderColor;
  }

  if (isDropdownDisabled || isDropdownLoading) {
    return '1px solid var(--borders-disabled-on-white)';
  }

  return 'var(--borders-default)';
};

<>
<div
data-cy={`label-${String(component.name).toLowerCase()} `}
className={`dropdown-widget d-flex ${
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we use classnames package and clean this up.?

@nakulnagargade
Copy link
Collaborator Author

Closing this PR since this changes are also available in #9837.

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.

4 participants