Skip to content

Commit 3e3ff37

Browse files
committed
app-catalog: Display image only when defined
Signed-off-by: Evangelos Skopelitis <[email protected]>
1 parent 97be970 commit 3e3ff37

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

app-catalog/src/components/charts/Details.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,16 @@ export default function ChartDetails() {
8080
name: 'Name',
8181
value: (
8282
<Box display="flex" alignItems="center">
83-
<Box mr={1}>
84-
<img
85-
src={`https://artifacthub.io/image/${chart.logo_image_id}`}
86-
width="25"
87-
height="25"
88-
alt={chart.name}
89-
/>
90-
</Box>
83+
{chart.logo_image_id && (
84+
<Box mr={1}>
85+
<img
86+
src={`https://artifacthub.io/image/${chart.logo_image_id}`}
87+
width="25"
88+
height="25"
89+
alt={chart.name}
90+
/>
91+
</Box>
92+
)}
9193
<Box>{chart.name}</Box>
9294
</Box>
9395
),

app-catalog/src/components/charts/List.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,24 @@ export function ChartsList({ fetchCharts = fetchChartsFromArtifact }) {
220220
justifyContent="space-between"
221221
marginTop="15px"
222222
>
223-
<CardMedia
224-
image={`https://artifacthub.io/image/${chart.logo_image_id}`}
225-
alt={`${chart.name} logo`}
226-
sx={{
227-
width: '60px',
228-
height: '60px',
229-
margin: '1rem',
230-
alignSelf: 'flex-start',
231-
objectFit: 'contain',
232-
}}
233-
component="img"
234-
/>
223+
{chart.logo_image_id && (
224+
<CardMedia
225+
image={`https://artifacthub.io/image/${chart.logo_image_id}`}
226+
alt={`${chart.name} logo`}
227+
sx={{
228+
width: '60px',
229+
height: '60px',
230+
margin: '1rem',
231+
alignSelf: 'flex-start',
232+
objectFit: 'contain',
233+
}}
234+
component="img"
235+
/>
236+
)}
235237
<Box
236238
display="flex"
237239
alignItems="center"
238-
justifyContent="space-around"
240+
marginLeft="auto"
239241
marginRight="10px"
240242
>
241243
{(chart.cncf || chart.repository.cncf) && (

0 commit comments

Comments
 (0)