Skip to content

Commit

Permalink
fix: make thumbnails nice in grid view
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh committed Feb 5, 2024
1 parent 0abb860 commit 7cf0f84
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/components/main/ItemCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ItemMembership,
ItemType,
PermissionLevel,
ThumbnailSize,
} from '@graasp/sdk';
import { Card as GraaspCard, Thumbnail } from '@graasp/ui';

Expand Down Expand Up @@ -53,7 +54,10 @@ const ItemComponent = ({
canMove = true,
}: Props): JSX.Element => {
const { id, name } = item;
const { data: thumbnailUrl, isLoading } = hooks.useItemThumbnailUrl({ id });
const { data: thumbnailUrl, isLoading } = hooks.useItemThumbnailUrl({
id,
size: ThumbnailSize.Medium,
});

const alt = name;
const defaultValueComponent = (
Expand All @@ -80,6 +84,7 @@ const ItemComponent = ({
url={thumbnailUrl ?? linkUrl}
alt={alt}
defaultComponent={defaultValueComponent}
sx={{ width: '100%', height: '100%', objectFit: 'cover' }}
/>
);

Expand Down
14 changes: 8 additions & 6 deletions src/components/table/ItemNameCellRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Box, Typography } from '@mui/material';

import { DiscriminatedItem, ItemType, getEmbeddedLinkExtra } from '@graasp/sdk';
import {
DiscriminatedItem,
ItemType,
getEmbeddedLinkExtra,
getMimetype,
} from '@graasp/sdk';
import { ItemIcon, Thumbnail } from '@graasp/ui';

import { hooks } from '../../config/queryClient';
Expand All @@ -25,11 +30,8 @@ const ItemNameCellRenderer = (
type={item.type}
iconSrc={iconSrc}
alt={alt}
extra={
item.type === ItemType.S3_FILE || item.type === ItemType.LOCAL_FILE
? item.extra
: undefined
}
mimetype={getMimetype(item.extra)}
sx={{ border: '2px solid red' }}
/>
);

Expand Down

0 comments on commit 7cf0f84

Please sign in to comment.