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

feat(react-color-picker): Added transparent option to the AlphaSlider #33572

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

Conversation

ValentinaKozlova
Copy link
Contributor

Added transparent option to the AlphaSlider. It's the same behavior we have in V8 ColorPicker.

Previous Behavior

image

New Behavior

transparency-alpha-slider

Copy link

github-actions bot commented Jan 7, 2025

📊 Bundle size report

✅ No changes found

Copy link

github-actions bot commented Jan 7, 2025

Pull request demo site: URL

@ValentinaKozlova ValentinaKozlova force-pushed the feat/transparent-option-color-picker branch from 5cd6e31 to 242f408 Compare January 8, 2025 10:09
@ValentinaKozlova ValentinaKozlova marked this pull request as ready for review January 8, 2025 11:56
@ValentinaKozlova ValentinaKozlova requested a review from a team as a code owner January 8, 2025 11:56
const newColor: HsvColor = { ...hsvColor, a: newValue / 100 };
setCurrentValue(newValue);
inputOnChange?.(event);
onChange?.(event, { type: 'change', event, color: newColor });
});

const sliderDirection = state.vertical
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider extracting this into a named utility function. This will enhance code readability and simplify unit testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. I was thinking about moving those functions to the separate files but then I'll need to pass plenty parameters there

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 pure functions with a few parameters are way better and easier to maintain than inner functions that rely on scope. If you have more than three arguments, it's a good idea to use an object for the parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants