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

feat: create document viewer component #976

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LinaYahya
Copy link
Contributor

closes #975

Copy link

sonarcloud bot commented Aug 8, 2024

@LinaYahya LinaYahya self-assigned this Aug 8, 2024
@LinaYahya LinaYahya requested a review from pyphilia August 8, 2024 14:21
@LinaYahya LinaYahya marked this pull request as ready for review August 8, 2024 14:21
@@ -97,7 +98,7 @@
"@emotion/cache": "~11.10.7 || ~11.11.0 || ~11.13.0",
"@emotion/react": "~11.10.6 || ~11.11.0 || ~11.13.0",
"@emotion/styled": "~11.10.6 || ~11.11.0 || ~11.13.0",
"@graasp/sdk": "^4.14.0",
"@graasp/sdk": "*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert.

@@ -116,7 +117,7 @@
"@emotion/cache": "~11.11.0",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.5",
"@graasp/sdk": "4.22.0",
"@graasp/sdk": "https://github.com/graasp/graasp-sdk.git#616-docs-mimetypes",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to update.

<FileDocument uri={url} />
<DownloadButtonFileItem
id={id}
name={originalFileName ?? item.name}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to show the item.name

Suggested change
name={originalFileName ?? item.name}
name={item.name}

@@ -30,7 +30,7 @@ export const SizingWrapper = ({
}): JSX.Element => {
const width = getWidthFromSizing(size);
return (
<Box maxWidth='100%' width={width}>
<Box maxWidth='100%' width={width} flex={1}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be careful here, why do you need flex=1? Add a comment, and could you please try out many different item types to be sure sizing is not broken?

gap={0.5}
alignItems={alignItems}
width='100%'
flex={1}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

import FileDocument from './FileDocument';

const meta: Meta<typeof FileDocument> = {
title: 'Items/Document File',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Document is actually what it is, but because of our other nomenclature I would prefer something a bit closer to "viewer" and to the library you used.

Suggested change
title: 'Items/Document File',
title: 'Items/FileDocumentViewer',

type Props = {
uri: string;
};
const FileDocument = ({ uri }: Props): JSX.Element => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const FileDocument = ({ uri }: Props): JSX.Element => {
const FileDocumentViewer = ({ uri }: Props): JSX.Element => {


export const Document: Story = {
args: {
uri: 'https://www.lehman.edu/faculty/john/classroomrespolicy1.docx',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just read the docs, do you think we could use a local file like this:

   { uri: require("./example-files/pdf.pdf") }, // Local File

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display files within FileItem for doc, xls file types
2 participants