-
-
Notifications
You must be signed in to change notification settings - Fork 113
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: implement ColorPicker component #1795
feat: implement ColorPicker component #1795
Conversation
FeaturesBug Fixes
Tests
ContributorsCommit-Lint commandsYou can trigger Commit-Lint actions by commenting on this PR:
|
src/components/ColorPicker/commons/saturation/helpers/__test__/calculateBright.spec.js
Show resolved
Hide resolved
@TahimiLeonBravo when using the color picker you need to pass a height to its container in order to see it like Instead if you don't pass a height then it looks like: |
const handleMouseDown = event => { | ||
handleChange(event); | ||
window.addEventListener('mousemove', handleChange); | ||
window.addEventListener('mouseup', unbindEventListeners); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid setting listener in window and instead attach it to specific element to reduce its scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to keep listening for the move event when it is outside the component so that the behavior is like the native component
@LeandroTorresSicilia |
@@ -0,0 +1,17 @@ | |||
import calculateBright from '../calculateBright'; | |||
|
|||
describe('calculateBright', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
const wrapper = mount(<ColorPicker variant="colors-fixed" />); | ||
const componets = ['Saturation', 'Hue', 'Alpha', 'Hex', 'Rgba']; | ||
|
||
componets.forEach(component => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
const wrapper = mount(<ColorPicker defaultColors={[]} />); | ||
const componets = ['Saturation', 'Hue', 'Alpha', 'Hex', 'Rgba']; | ||
|
||
componets.forEach(component => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
const wrapper = mount(<ColorPicker variant="foo" />); | ||
const componets = ['Saturation', 'Hue', 'Alpha', 'Hex', 'Rgba', 'DefaultColors']; | ||
|
||
componets.forEach(component => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
decomposeColor, | ||
} from '../../../../styles/helpers/color'; | ||
|
||
const Rgba = React.forwardRef((_props, ref) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Rgba
has 74 lines of code (exceeds 25 allowed). Consider refactoring.
@@ -0,0 +1,17 @@ | |||
import calculateSaturation from '../calculateSaturation'; | |||
|
|||
describe('calculateSaturation', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
const wrapper = mount(<ColorPicker variant="colors-fixed" />); | ||
const componets = ['Saturation', 'Hue', 'Alpha', 'Hex', 'Rgba']; | ||
|
||
componets.forEach(component => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
const wrapper = mount(<ColorPicker defaultColors={[]} />); | ||
const componets = ['Saturation', 'Hue', 'Alpha', 'Hex', 'Rgba']; | ||
|
||
componets.forEach(component => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
const wrapper = mount(<ColorPicker variant="foo" />); | ||
const componets = ['Saturation', 'Hue', 'Alpha', 'Hex', 'Rgba', 'DefaultColors']; | ||
|
||
componets.forEach(component => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
decomposeColor, | ||
} from '../../../../styles/helpers/color'; | ||
|
||
const Rgba = React.forwardRef((_props, ref) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Rgba
has 74 lines of code (exceeds 25 allowed). Consider refactoring.
@@ -0,0 +1,17 @@ | |||
import calculateBright from '../calculateBright'; | |||
|
|||
describe('calculateBright', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
const wrapper = mount(<ColorPicker variant="colors-fixed" />); | ||
const componets = ['Saturation', 'Hue', 'Alpha', 'Hex', 'Rgba']; | ||
|
||
componets.forEach(component => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
const wrapper = mount(<ColorPicker defaultColors={[]} />); | ||
const componets = ['Saturation', 'Hue', 'Alpha', 'Hex', 'Rgba']; | ||
|
||
componets.forEach(component => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
const wrapper = mount(<ColorPicker variant="foo" />); | ||
const componets = ['Saturation', 'Hue', 'Alpha', 'Hex', 'Rgba', 'DefaultColors']; | ||
|
||
componets.forEach(component => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
decomposeColor, | ||
} from '../../../../styles/helpers/color'; | ||
|
||
const Rgba = React.forwardRef((_props, ref) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Rgba
has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Code Climate has analyzed commit 224bb19 and detected 35 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
fix: #1777
Changes proposed in this PR:
feat: implement ColorPicker component
I have followed (at least) the PR section of the contributing guide.
@nexxtway/react-rainbow