-
-
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
refactor: labelAlignment prop on all inputable components #1869
refactor: labelAlignment prop on all inputable components #1869
Conversation
src/components/Slider/index.js
Outdated
hideLabel={hideLabel} | ||
labelAlignment={labelAlignment} | ||
inputId={this.sliderId} | ||
/> |
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.
Code Refactoring
Bug Fixes
Contributors@rgah2107, @LeandroTorresSicilia Commit-Lint commandsYou can trigger Commit-Lint actions by commenting on this PR:
|
left: 'flex-start', | ||
center: 'center', | ||
right: 'flex-end', | ||
}; | ||
|
||
const StyledLabel = attachThemeAttrs(styled.label)` |
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.
why no reuse the input label here?
@@ -30,6 +31,18 @@ describe('<Slider />', () => { | |||
const component = mount(<Slider disabled />); | |||
expect(component.find('input').prop('disabled')).toBe(true); | |||
}); | |||
it('should set "left" to labelAlignment prop passed in the Label 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 2 locations. Consider refactoring.
const component = mount(<Slider label="Slider Label" labelAlignment="left" />); | ||
expect(component.find(StyledLabel).prop('labelAlignment')).toBe('left'); | ||
}); | ||
it('should set "right" to labelAlignment prop passed in the Label 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 2 locations. Consider refactoring.
const component = mount(<Slider label="Slider Label" labelAlignment="right" />); | ||
expect(component.find(StyledLabel).prop('labelAlignment')).toBe('right'); | ||
}); | ||
it('should set "center" to labelAlignment if prop not passed in the Label 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 2 locations. Consider refactoring.
Code Climate has analyzed commit 9d3b83b and detected 25 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
fix: #1865
Changes proposed in this PR:
add labelAlignment prop to the Label component
refactor labelAlignment prop on all inputable components
add labelAlignment prop on all inputable components that don't have it
I have followed (at least) the PR section of the contributing guide.
@nexxtway/react-rainbow