From 987520183c8cb174892116d75d0e6a6e89ee4d53 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Date: Thu, 19 Dec 2024 07:44:34 -0500 Subject: [PATCH] Fix visual isses on Enabled/Explore tiles --- frontend/src/components/OdhAppCard.tsx | 36 +++++++------ frontend/src/components/OdhCard.scss | 13 +++-- frontend/src/components/OdhExploreCard.tsx | 59 ++++++++++++---------- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/frontend/src/components/OdhAppCard.tsx b/frontend/src/components/OdhAppCard.tsx index b1830acde9..252cb9edcd 100644 --- a/frontend/src/components/OdhAppCard.tsx +++ b/frontend/src/components/OdhAppCard.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import classNames from 'classnames'; import { Link } from 'react-router-dom'; import { AlertVariant, @@ -15,6 +14,7 @@ import { DropdownList, Label, } from '@patternfly/react-core'; +import { css } from '@patternfly/react-styles'; import { EllipsisVIcon, ExternalLinkAltIcon } from '@patternfly/react-icons'; import { OdhApplication } from '~/types'; import { getLaunchStatus, launchQuickStart } from '~/utilities/quickStartUtils'; @@ -104,10 +104,11 @@ const OdhAppCard: React.FC = ({ odhApp }) => { ); } - const launchClasses = classNames('odh-card__footer__link', { - 'm-hidden': !odhApp.spec.link, - 'm-disabled': disabled || !workbenchEnabled, - }); + const launchClasses = css( + 'odh-card__footer__link', + !odhApp.spec.link && 'm-hidden', + (disabled || !workbenchEnabled) && 'm-disabled', + ); const cardFooter = ( @@ -116,9 +117,7 @@ const OdhAppCard: React.FC = ({ odhApp }) => { Launch application @@ -137,11 +136,7 @@ const OdhAppCard: React.FC = ({ odhApp }) => { ); - const cardClasses = classNames('odh-card', { - // Using PF native class to prevent needing custom styling; RHOAI feel free to delete this comment - 'pf-m-disabled': disabled, - 'pf-m-current': selected, - }); + const cardClasses = css('odh-card', selected && 'pf-m-current'); const popoverBodyContent = (hide: () => void) => (
@@ -177,8 +172,9 @@ const OdhAppCard: React.FC = ({ odhApp }) => { bodyContent={popoverBodyContent} position="bottom" > - {/* Note from PatternFly: this implementation is not accessible and should use a button/interactive element instead of a plain span */} - Disabled + ); @@ -189,6 +185,7 @@ const OdhAppCard: React.FC = ({ odhApp }) => { id={odhApp.metadata.name} role="listitem" className={cardClasses} + isDisabled={disabled || !workbenchEnabled} > = ({ odhApp }) => { odhApp.spec.category && odhApp.spec.support !== ODH_PRODUCT_NAME ? (
- - + +
) : null} diff --git a/frontend/src/components/OdhCard.scss b/frontend/src/components/OdhCard.scss index e1305c2da4..304ccad233 100644 --- a/frontend/src/components/OdhCard.scss +++ b/frontend/src/components/OdhCard.scss @@ -1,8 +1,4 @@ .odh-card { - // Removed the custom disabled styling and replaced the existing disabled class in component code with pf-m-disabled - // Updating the custom overrides would have involved adding more overrides for font colors - // Removed the custom odh-card.pf-m-current styling as PF cards with the pf-m-current have styling - // RHOAI feel free to delete above comments & .odh-brand > img { background-color: var(--pf-t--color--white); padding: var(--pf-t--global--spacer--xs); @@ -15,8 +11,12 @@ } &__partner-badge { - padding: 0 var(--pf-t--global--spacer--sm); - + // Override the label outline for disabled cards so it shows in dark theme + &.pf-m-disabled { + .pf-v6-c-label.pf-m-outline { + --pf-v6-c-label--m-outline--BorderColor: var(--pf-t--global--text--color--regular); + } + } &.m-hidden { visibility: hidden; } @@ -40,7 +40,6 @@ } &__disabled-text { - color: var(--pf-t--global--text--color--disabled); font-size: var(--pf-t--global--font--size--body--sm); } diff --git a/frontend/src/components/OdhExploreCard.tsx b/frontend/src/components/OdhExploreCard.tsx index ba07e491b9..1b0770bebf 100644 --- a/frontend/src/components/OdhExploreCard.tsx +++ b/frontend/src/components/OdhExploreCard.tsx @@ -53,36 +53,11 @@ const OdhExploreCard: React.FC = ({ className={cardClasses} > - {odhApp.spec.comingSoon && ( - Coming soon - )} - {!odhApp.spec.comingSoon && odhApp.spec.category && ( - - - - )} - {odhApp.spec.beta && ( - - - - )} - - ), hasNoOffset: true, - className: undefined, + actions: null, }, selectableActions: { selectableActionId: `${odhApp.metadata.name}-selectable-card-id`, @@ -94,7 +69,35 @@ const OdhExploreCard: React.FC = ({ }, })} > - + + + + {odhApp.spec.comingSoon && ( + Coming soon + )} + {!odhApp.spec.comingSoon && odhApp.spec.category && ( + + + + )} + {odhApp.spec.beta && ( + + + + )} + + {odhApp.spec.description}