Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Gray out label when disabled #12455

Merged
merged 1 commit into from
Jan 3, 2018

Conversation

user512
Copy link
Contributor

@user512 user512 commented Jan 1, 2018

Fix #7634

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed. (Ask a Brave employee to help if you cannot access this document.)

Test Plan:

go to about:preferences#plugins without installing Pepper Flash and observe label is gray out.
screen shot 2018-01-01 at 2 27 36 pm

Reviewer Checklist:

  • Request a security/privacy review as needed if one was not already requested.

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@@ -131,7 +131,8 @@ class SwitchControl extends ImmutableComponent {
styles.switchControl__text__label,
styles.switchControl__text__label_right,
this.props.small && styles.switchControl__text__label_small,
this.props.customStyleTextRight
this.props.customStyleTextRight,
this.props.disabled && styles.switchControl__text_disabled
Copy link
Contributor

Choose a reason for hiding this comment

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

@user512 would you mind moving this.props.customStyleTextRight under this line as it is expected to override the inherited properties?

@user512 user512 force-pushed the gray-out-text-when-disable branch from 740a84d to f81c12f Compare January 2, 2018 16:02
@@ -131,6 +131,7 @@ class SwitchControl extends ImmutableComponent {
styles.switchControl__text__label,
styles.switchControl__text__label_right,
this.props.small && styles.switchControl__text__label_small,
this.props.disabled && styles.switchControl__text_disabled,
Copy link
Contributor Author

@user512 user512 Jan 2, 2018

Choose a reason for hiding this comment

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

@luixxiul, thank you for the feedback, just fixed as you recommended.
I am not very familiar with styling in this app or styling in React, would you mind telling me how does order affect styling? I tried reading https://github.com/brave/browser-laptop/blob/master/docs/style.md but can't find how order affect styling.

Would be great if you can suggested some reading about styling in React, thanks 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

hey @user512. The order affects styles the same way as CSS cascading works. The last rule overrides the previous so in your changes, the disabled interface would override other styles, which is the correct and expected behavior. Nice work!

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this could be the last conditional but I think it's ok as-is. Thanks!

@codecov-io
Copy link

codecov-io commented Jan 2, 2018

Codecov Report

Merging #12455 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #12455   +/-   ##
=======================================
  Coverage   55.83%   55.83%           
=======================================
  Files         278      278           
  Lines       26977    26977           
  Branches     4362     4362           
=======================================
  Hits        15062    15062           
  Misses      11915    11915
Flag Coverage Δ
#unittest 55.83% <ø> (ø) ⬆️
Impacted Files Coverage Δ
app/renderer/components/common/switchControl.js 83.67% <ø> (ø) ⬆️

@bsclifton bsclifton added this to the 0.22.x (Nightly Channel) milestone Jan 2, 2018
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

++ changes look great! 😄

Including @cezaraugusto for more advice- he put together this helpful guide which is in our wiki that you may enjoy:
https://github.com/brave/browser-laptop/wiki/Refactoring-styles-to-Aphrodite

@bsclifton bsclifton merged commit ecfb106 into brave:master Jan 3, 2018
@user512 user512 deleted the gray-out-text-when-disable branch January 4, 2018 00:47
@bbondy bbondy modified the milestones: 0.22.x (Developer Channel), 0.23.x (Nightly Channel) Feb 25, 2018
@srirambv
Copy link
Collaborator

@bsclifton @user512 Is this fix only for Flash switch or all switch in general when off?

@bsclifton
Copy link
Member

bsclifton commented Jun 20, 2018

@srirambv this should be for all places where it's used (in a disabled state). The test plan captures the only known occurrence... but if you set the disabled field on any other switch controls, it would work like this too.

@srirambv
Copy link
Collaborator

@bsclifton none of the switches which are turned off shows gray out. The flash text does it when there is no flash installed on the machine. Otherwise all other text just looks normal.
12455

@bsclifton
Copy link
Member

@srirambv per the test plan, it should only be grayed out when Flash is not installed on the machine (disabled). Because you can't turn something on if it's not installed 😛 So you just verified this is working as expected 😄 👍

@srirambv
Copy link
Collaborator

That works but the original issue was intended to show grayed out text when the switch was turned off. So i was expecting to see all text in gray which were turned off. Basically like this #7634 (comment)

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

Successfully merging this pull request may close these issues.

7 participants