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

fix(Dimmer): Fix "simple" usage, add disabled prop #795

Merged
merged 2 commits into from
Nov 6, 2016

Conversation

jeffcarbs
Copy link
Member

I realized that #782 breaks the "simple" example: http://react.semantic-ui.com/modules/dimmer#simple-dimmer. That should be enabled by virtue of having a parent with ui dimmable dimmed. See the SUI-core docs: http://semantic-ui.com/modules/dimmer.html#simple-dimmer

Digging into it further, two things stuck out to me:

  • The reason the children were unclickable is because the dimmer always had the visible class, regardless of whether it was active. active controls the opacity, visible sets the visibility.
  • disabled is a prop that overrides any active/visible state so we shouldn't be using it for that.

This fixes both issues.

  • visible is only added when the dimmer is active, which removes the need to force disabled, which enables clicking on children and fixes the "simple" usage.
  • We now expose disabled as a prop which conforms more to our API. A user can set that to override any active/visible state.

Copy link
Member

@levithomason levithomason left a comment

Choose a reason for hiding this comment

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

This is great, thanks much. Couple updates to tests then we can merge this guy.

@@ -29,13 +29,13 @@ describe('Dimmer', () => {
})

describe('active', () => {
it('removes the `disabled` className when true', () => {
it('adds the `transition visible` className when true', () => {
Copy link
Member

Choose a reason for hiding this comment

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

The common test can be configured to assert a className that is different than the prop name. Should be able to replace this describe block with:

common.propKeyOnlyToClassName(Dimmer, 'active', {
  className: 'active transition visible',
})

useKeyOnly(active, 'active'),
useKeyOnly(!active, 'disabled'),
useKeyOnly(active, 'active transition visible'),
useKeyOnly(disabled, 'disabled'),
Copy link
Member

Choose a reason for hiding this comment

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

How about adding a common test for this?

common.propKeyOnlyToClassName(Dimmer, 'disabled')

Copy link
Member Author

Choose a reason for hiding this comment

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

Added 👍

@jeffcarbs jeffcarbs force-pushed the feature/simple-dimmer branch from 673fd0d to 2ae5ce1 Compare November 6, 2016 01:21
@jeffcarbs
Copy link
Member Author

Added those tests and removed the ones for "active" that were testing duplicate functionality already covered by the common tests. Should be g2g 👍

@codecov-io
Copy link

Current coverage is 100% (diff: 100%)

Merging #795 into master will not change coverage

@@           master   #795   diff @@
====================================
  Files         136    136          
  Lines        2198   2198          
  Methods         0      0          
  Messages        0      0          
  Branches        0      0          
====================================
  Hits         2198   2198          
  Misses          0      0          
  Partials        0      0          

Powered by Codecov. Last update 16f59a0...2ae5ce1

@levithomason levithomason merged commit 77aa062 into master Nov 6, 2016
@levithomason levithomason deleted the feature/simple-dimmer branch November 6, 2016 04:33
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