generated from graasp/graasp-repo
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: show shortcut folder as card * fix: try to make the navigation not suck * fix: make PR changes * fix: update deps
- Loading branch information
Showing
12 changed files
with
229 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Link, useParams } from 'react-router-dom'; | ||
|
||
import { styled } from '@mui/material'; | ||
|
||
import { DiscriminatedItem, ThumbnailSize } from '@graasp/sdk'; | ||
import { Card as GraaspCard, TextDisplay } from '@graasp/ui'; | ||
|
||
import image from '@/assets/avatar.png'; | ||
import { buildContentPagePath } from '@/config/paths'; | ||
import { hooks } from '@/config/queryClient'; | ||
|
||
const StyledLink = styled(Link)(() => ({ | ||
textDecoration: 'none', | ||
})); | ||
|
||
type Props = { | ||
item: DiscriminatedItem; | ||
id?: string; | ||
replaceRoot?: boolean; | ||
}; | ||
|
||
const FolderCard = ({ id, item, replaceRoot = false }: Props): JSX.Element => { | ||
const { rootId } = useParams(); | ||
const { id: itemId, description, name } = item; | ||
const { data: thumbnail } = hooks.useItemThumbnailUrl({ | ||
id: item.id, | ||
size: ThumbnailSize.Medium, | ||
}); | ||
|
||
return ( | ||
<StyledLink | ||
to={buildContentPagePath({ | ||
rootId: replaceRoot ? itemId : rootId, | ||
itemId, | ||
})} | ||
> | ||
<GraaspCard | ||
description={<TextDisplay content={description ?? ''} />} | ||
name={name} | ||
image={thumbnail ?? image} | ||
cardId={id} | ||
/> | ||
</StyledLink> | ||
); | ||
}; | ||
|
||
export default FolderCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.