-
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.
style: favorites view is being created
- Loading branch information
Showing
5 changed files
with
89 additions
and
2 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,55 @@ | ||
import React from 'react'; | ||
|
||
import { useAllFavoriteByUser } from '@hooks/queries'; | ||
import { useAuth } from '@contexts/AuthContext'; | ||
import { MySimpleGrid } from '@components/ui/MySimpleGrid'; | ||
import { Card } from '@components/cards/Card'; | ||
import { CardType } from '@components/types'; | ||
import { MainHead } from '@components/layout/Head'; | ||
import { ContainerTitle } from '@components/layout/ContainerTitle'; | ||
|
||
export default function Favorites() { | ||
const { currentUser } = useAuth(); | ||
const uid = currentUser?.uid; | ||
const { data, fetchNextPage, isFetchingNextPage } = useAllFavoriteByUser(uid); | ||
|
||
return ( | ||
<> | ||
<MainHead title='Mis Favoritos | XBuniverse' /> | ||
<ContainerTitle title='Mis Favoritos' /> | ||
<MySimpleGrid> | ||
{data?.pages.map((page, index) => ( | ||
<React.Fragment key={index}> | ||
{page.results.map( | ||
({ | ||
id, | ||
category, | ||
language, | ||
title, | ||
authors, | ||
synopsis, | ||
sourceLink, | ||
pathUrl, | ||
image, | ||
}: CardType) => ( | ||
<React.Fragment key={id}> | ||
<Card | ||
id={id} | ||
category={category} | ||
language={language} | ||
title={title} | ||
authors={authors} | ||
synopsis={synopsis} | ||
sourceLink={sourceLink} | ||
pathUrl={pathUrl} | ||
image={image} | ||
/> | ||
</React.Fragment> | ||
), | ||
)} | ||
</React.Fragment> | ||
))} | ||
</MySimpleGrid> | ||
</> | ||
); | ||
} |
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
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