I am working on integrating the File Display Constellation component using the React SDK and have published a custom component to Pega following the example provided in the official documentation:
https://design.pega.com/extend/file-display/#Usage.
While the component renders the uploaded file name correctly in the Pega runtime, the file type icon (image icon) is not displayed as expected .
However, when I run the same component in Storybook, the file type icon is displayed correctly based on the file extension (for example, myfile.do c).
Observations:
-
The same React component and configuration are used in both Storybook and Pega.
-
Storybook correctly shows the file type icon based on the file extension.
-
In Pega Constellation runtime, the icon does not appear.
Expected behavior:
The file type icon should be displayed in Pega runtime, similar to how it appears in Storybook.
Actual behavior:
Only the file name is rendered; the file type icon is missing.
Code snippet:
import { FileDisplay, useToaster } from ‘@pega/cosm os-r eact-core’;
export default function Test() {
const { push } = useToaster();
const handlePreview = true ? id => push({ content: `Previewed ${i d}` }) : undefined;
const handleDownload = true ? id => push({ content: `Downloaded ${ id}` }) : undefined;
const imageSrc = true
? ‘https://www.pega.com/sites/default/files/styles/480/public/media/images/2021-02/ pwi-2021-prevcard.jpg’
: ‘https://pega.c om/media/comp ress.zip’;
ret urn (
<FileDi splay
id='item-1 '
variant={‘file’}
displa yText={‘Pega World iNspire’}
value= {true ? imageSrc : undefined}
onPreview={handlePreview}
onDownload={handleDo wnload}
co mpac t={false}
/>
);
};
Please let me know if any additional details or screenshots are required from my side.
