Skip to content

Commit

Permalink
feat(redmine 1258408): added DocumentView to DocumentDetails page (#46)
Browse files Browse the repository at this point in the history
* feat(redmine 1258408): added DocumentView to DocumentDetails page

* fix: code review
  • Loading branch information
QuentinLeCaignec authored Oct 20, 2023
1 parent 48189c8 commit ffe24fc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/popular-pandas-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@smile/react-front-kit': minor
---

Added `DocumentView` iframe to `DocumentDetails` example page
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
CardNative,
CardPermissions,
} from './DocumentDetails.mock';
import { DocumentView } from './DocumentView';

const theme = primaryTheme;
theme.colorScheme = 'dark';
Expand Down Expand Up @@ -156,7 +157,9 @@ export function DocumentDetails(): ReactElement {
</div>
</div>
<Space h="xl" />
<div className={classes.document} />
<div className={classes.document}>
<DocumentView url="./example.pdf" />
</div>
</Flex>
</Grid.Col>
<Grid.Col className={classes.colRight} span={4}>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ReactElement } from 'react';

interface IDocumentViewProps {
title?: string;
url: string;
}

export function DocumentView(props: IDocumentViewProps): ReactElement {
const { title = 'document', url } = props;

// eslint-disable-next-line react/iframe-missing-sandbox
return <iframe height="100%" src={url} title={title} width="100%" />;
}
Binary file added public/example.pdf
Binary file not shown.

0 comments on commit ffe24fc

Please sign in to comment.