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

Bug 1870471: Fix Tech and Dev preview badge styles #6250

Merged
merged 1 commit into from Aug 24, 2020

Conversation

rottencandy
Copy link
Contributor

@rottencandy rottencandy commented Aug 6, 2020

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:
scr1

After:
scr0

Unit test coverage report:
Unchanged.

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@rottencandy rottencandy changed the title fix preview badge styles Fix Tech and Dev preview badge styles Aug 6, 2020
@rottencandy
Copy link
Contributor Author

/kind bug

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 6, 2020
@@ -5,7 +5,7 @@
}
}

.tech-preview {
.odc-preview-badge {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.odc-preview-badge {
.osc-preview-badge {

Not part of the DevConsole package, so can't have 'odc' (aka Openshift Developer Console) prefix.

Copy link
Contributor Author

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)' }}
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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';
Copy link
Contributor

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?

Copy link
Contributor Author

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 {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.odc-preview-badge {
.ocs-preview-badge {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 18, 2020
@rottencandy
Copy link
Contributor Author

/assign @andrewballantyne

@rottencandy
Copy link
Contributor Author

/retest

3 similar comments
@rottencandy
Copy link
Contributor Author

/retest

@rottencandy
Copy link
Contributor Author

/retest

@rottencandy
Copy link
Contributor Author

/retest

@rottencandy rottencandy changed the title Fix Tech and Dev preview badge styles Bug 1870471: Fix Tech and Dev preview badge styles Aug 20, 2020
@openshift-ci-robot openshift-ci-robot added bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Aug 20, 2020
@openshift-ci-robot
Copy link
Contributor

@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
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1870471: Fix Tech and Dev preview badge styles

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.

Comment on lines 9 to 10
background-color: #d93f00 !important;
border-radius: var(--pf-global--BorderRadius--sm) !important;
Copy link
Contributor

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.

Suggested change
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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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

Copy link
Contributor

@andrewballantyne andrewballantyne left a 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.

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 21, 2020
@andrewballantyne
Copy link
Contributor

/lgtm cancel

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 21, 2020
@@ -5,7 +5,9 @@
}
}

.tech-preview {
span.ocs-preview-badge {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 24, 2020
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 490b381 into openshift:master Aug 24, 2020
@openshift-ci-robot
Copy link
Contributor

@rottencandy: All pull requests linked via external trackers have merged:

Bugzilla bug 1870471 has been moved to the MODIFIED state.

In response to this:

Bug 1870471: Fix Tech and Dev preview badge styles

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.

@spadgett spadgett added this to the v4.6 milestone Aug 26, 2020
@rottencandy rottencandy deleted the prevbadge branch September 8, 2020 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/shared Related to console-shared kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants