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

refactor: labelAlignment prop on all inputable components #1869

Conversation

rgah2107
Copy link
Collaborator

@rgah2107 rgah2107 commented Sep 28, 2020

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

hideLabel={hideLabel}
labelAlignment={labelAlignment}
inputId={this.sliderId}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

on the Slider component the label must be aligned to the edges, it should not have padding
Screen Shot 2020-10-03 at 3 52 49 PM

@commit-lint
Copy link

commit-lint bot commented Oct 3, 2020

Code Refactoring

  • labelAlignment prop on all inputable components (ff2ec2d)

Bug Fixes

  • label in Slider component (5c26166)

Contributors

@rgah2107, @LeandroTorresSicilia

Commit-Lint commands

You can trigger Commit-Lint actions by commenting on this PR:

  • @Commit-Lint merge patch will merge dependabot PR on "patch" versions (X.X.Y - Y change)
  • @Commit-Lint merge minor will merge dependabot PR on "minor" versions (X.Y.Y - Y change)
  • @Commit-Lint merge major will merge dependabot PR on "major" versions (Y.Y.Y - Y change)
  • @Commit-Lint merge disable will desactivate merge dependabot PR
  • @Commit-Lint review will approve dependabot PR
  • @Commit-Lint stop review will stop approve dependabot PR

left: 'flex-start',
center: 'center',
right: 'flex-end',
};

const StyledLabel = attachThemeAttrs(styled.label)`

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', () => {
Copy link

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', () => {
Copy link

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', () => {
Copy link

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.

@codeclimate
Copy link

codeclimate bot commented Oct 4, 2020

Code Climate has analyzed commit 9d3b83b and detected 25 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 25

View more on Code Climate.

@LeandroTorresSicilia LeandroTorresSicilia merged commit 2066e0d into nexxtway:master Oct 4, 2020
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.

refactor: labelAlignment prop on all inputable components
4 participants