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

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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