Skip to content

Commit

Permalink
render SVG in the card header when height and width are not set (open…
Browse files Browse the repository at this point in the history
…datahub-io#869)

* render SVG in the card header when height and width are not set

* update brand
  • Loading branch information
DaoDaoNoCode authored and strangiato committed Oct 18, 2023
1 parent 96ee8b8 commit 25a4582
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions frontend/src/app/App.scss
Expand Up @@ -16,6 +16,10 @@ html, body, #root {
opacity: 1;
color: var(--pf-global--icon--Color--light);
}
&__brand {
height: 36px;
width: 100%;
}
}
// specificity targeting form elements to override --pf-global--FontSize--md
.pf-c-page, .pf-c-modal-box {
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/app/Header.tsx
Expand Up @@ -31,9 +31,11 @@ const Header: React.FC<HeaderProps> = ({ onNotificationsClick }) => {
)}
<MastheadMain>
<MastheadBrand component={(props) => <Link {...props} to="/" />}>
<Brand heights={{ default: '36px' }} alt={`${ODH_PRODUCT_NAME} Logo`}>
<source srcSet={`${window.location.origin}/images/${ODH_LOGO}`} />
</Brand>
<Brand
className="odh-dashboard__brand"
src={`${window.location.origin}/images/${ODH_LOGO}`}
alt={`${ODH_PRODUCT_NAME} Logo`}
/>
</MastheadBrand>
</MastheadMain>
<MastheadContent>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/BrandImage.tsx
Expand Up @@ -35,6 +35,7 @@ const BrandImage: React.FC<BrandImageProps> = ({ src, ...props }) => {
<Brand
{...props}
heights={{ default: '40px' }}
widths={{ default: '100%' }}
onError={() => setImage((prevImage) => ({ imgSrc: prevImage.imgSrc, isValid: false }))}
>
<source srcSet={image.imgSrc} />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/OdhAppCard.tsx
Expand Up @@ -184,7 +184,7 @@ const OdhAppCard: React.FC<OdhAppCardProps> = ({ odhApp }) => {
isSelectable={!disabled}
>
<CardHeader>
<CardHeaderMain style={{ maxWidth: '33%' }}>
<CardHeaderMain style={{ maxWidth: '33%', width: '100%' }}>
<BrandImage src={odhApp.spec.img} alt={odhApp.spec.displayName} />
</CardHeaderMain>
<CardActions hasNoOffset>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/OdhDocCard.tsx
Expand Up @@ -141,7 +141,7 @@ const OdhDocCard: React.FC<OdhDocCardProps> = ({ odhDoc, favorite, updateFavorit
isSelectable
>
<CardHeader>
<CardHeaderMain style={{ maxWidth: '33%' }}>
<CardHeaderMain style={{ maxWidth: '33%', width: '100%' }}>
<BrandImage
src={odhDoc.spec.img || odhDoc.spec.icon || ''}
alt={odhDoc.spec.displayName}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/OdhExploreCard.tsx
Expand Up @@ -61,7 +61,7 @@ const OdhExploreCard: React.FC<OdhExploreCardProps> = ({
onClick={() => !disabled && onSelect()}
>
<CardHeader>
<CardHeaderMain style={{ maxWidth: '33%' }}>
<CardHeaderMain style={{ maxWidth: '33%', width: '100%' }}>
<BrandImage src={odhApp.spec.img} alt={odhApp.spec.displayName} />
</CardHeaderMain>
{!dashboardConfig.spec.dashboardConfig.disableISVBadges && (
Expand Down

0 comments on commit 25a4582

Please sign in to comment.