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
Bug 1870471: Fix Tech and Dev preview badge styles #6250
Conversation
/kind bug |
@@ -5,7 +5,7 @@ | |||
} | |||
} | |||
|
|||
.tech-preview { | |||
.odc-preview-badge { |
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.
.odc-preview-badge { | |
.osc-preview-badge { |
Not part of the DevConsole package, so can't have 'odc' (aka Openshift Developer Console) prefix.
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.
Changed.
<Label style={{ backgroundColor: '#D93F00' }}>Dev Preview</Label> | ||
<Label | ||
className="odc-preview-badge" | ||
style={{ backgroundColor: '#D93F00', borderRadius: 'var(--pf-global--BorderRadius--sm)' }} |
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.
Include these styles in the css class
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.
Those styles when added in the class seem to be getting overriden by patternfly.
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.
How about using !important
for these styles in the scss?
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.
Thanks! Using !important
worked.
@@ -1,8 +1,14 @@ | |||
import * as React from 'react'; | |||
import { Label } from '@patternfly/react-core'; | |||
import './Badge.scss'; |
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.
Odd - how did this work before?
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.
It would directly use the tech-preview
class, not sure if it would work without the import.
@@ -5,7 +5,7 @@ | |||
} | |||
} | |||
|
|||
.tech-preview { | |||
.odc-preview-badge { |
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.
.odc-preview-badge { | |
.ocs-preview-badge { |
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.
Updated.
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.
This is not updated. I can still see the preview-badge class not prefixed with ocs. https://github.com/openshift/console/pull/6250/files#diff-0c1edabb529e4a788e55f04adb9c44a3
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.
Had gotten confused with the similar review above, fixed now.
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.
Ah that was my bad... Vikram had the right order. openshift console shared
=> ocs
59a0c79
to
b3d9187
Compare
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.
/lgtm
/assign @andrewballantyne |
/retest |
3 similar comments
/retest |
/retest |
/retest |
@rottencandy: This pull request references Bugzilla bug 1870471, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
background-color: #d93f00 !important; | ||
border-radius: var(--pf-global--BorderRadius--sm) !important; |
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.
One of the golden rules of CSS, especially those in an app of this size, is !important
should be avoided.
@rottencandy Please read the MDN page on CSS Specificity, it'll help bring forth this point.
@sahil143 Please read it as well.
background-color: #d93f00 !important; | |
border-radius: var(--pf-global--BorderRadius--sm) !important; | |
&.pf-c-label { | |
background-color: #d93f00; | |
border-radius: var(--pf-global--BorderRadius--sm); | |
} |
You can look in the dev tools for Chrome to see how it's calculated specificity for the current element selected. In this case our .ocs-preview-badge
was several down, this helps bring it up to the top.
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.
Thanks @andrewballantyne , I've tried using type selectors to improve specificity. PTAL.
@@ -5,7 +5,7 @@ | |||
} | |||
} | |||
|
|||
.tech-preview { | |||
.odc-preview-badge { |
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.
Ah that was my bad... Vikram had the right order. openshift console shared
=> ocs
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.
Looks good with the exception of the !important
usages.
/lgtm cancel |
@@ -5,7 +5,9 @@ | |||
} | |||
} | |||
|
|||
.tech-preview { | |||
span.ocs-preview-badge { |
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.
@rottencandy Why span
? What was wrong with the suggested change I gave?
The problem here is you're tying these styles to a semantic rendering, and there is nothing tying these styles to a span
element.
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.
Sorry, I read your comment on email and didn't notice that you had suggested a change, so tried coming up with my own solution. Updated now.
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewballantyne, rohitkrai03, rottencandy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@rottencandy: All pull requests linked via external trackers have merged: Bugzilla bug 1870471 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Fixes:
https://issues.redhat.com/browse/ODC-4440
Analysis / Root cause:
Tech and dev preview badges aren't shown correctly.
Solution Description:
Fix and align badge styles.
Screen shots / Gifs for design review:
Before:
After:
Unit test coverage report:
Unchanged.
Browser conformance: