Skip to content

Commit

Permalink
chore: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Franqsanz committed Sep 16, 2024
1 parent 281fbeb commit 96bc101
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 83 deletions.
40 changes: 3 additions & 37 deletions src/components/skeletons/SkeletonABooks.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
import React from 'react';
import { Skeleton, SkeletonText, Flex, Box, Stack } from '@chakra-ui/react';
import { Skeleton, Flex } from '@chakra-ui/react';

import { MySimpleGrid } from '@components/ui/MySimpleGrid';
import { MyContainer } from '@components/ui/MyContainer';
import { Aside } from '@components/aside/Aside';
import { SkeletonTags } from '@components/skeletons/SkeletonTags';
import { SkeletonType } from '@components/types';
import { SkeletonContainer } from '@components/skeletons/SkeletonContainer';

export function SkeletonAllBooks({ showTags = true }: SkeletonType) {
const Cards = Array.from({ length: 12 }, (_, index) => (
<Stack key={index} spacing='2' mb='10'>
<Skeleton
w={{ base: '120px', sm: '150px', md: '200px' }}
h={{ base: '160px', sm: '200px', md: '300px' }}
rounded='lg'
></Skeleton>
<SkeletonText mt='1' noOfLines={2} spacing='2' skeletonHeight='4' />
</Stack>
));

return (
<>
{showTags && (
Expand All @@ -30,28 +17,7 @@ export function SkeletonAllBooks({ showTags = true }: SkeletonType) {
</Flex>
</>
)}
<MyContainer>
<Aside>
<Box mt={{ base: '7', md: '97px' }}>
<SkeletonText
mt='1'
noOfLines={2}
spacing='2'
skeletonHeight='5'
mb='10'
/>
<SkeletonText
mt='1'
noOfLines={14}
spacing='2'
skeletonHeight='3'
mb='10'
/>
<SkeletonText mt='1' noOfLines={4} spacing='2' skeletonHeight='3' />
</Box>
</Aside>
<MySimpleGrid>{Cards}</MySimpleGrid>
</MyContainer>
<SkeletonContainer />
</>
);
}
46 changes: 46 additions & 0 deletions src/components/skeletons/SkeletonContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import { Box, Skeleton, SkeletonText, Stack } from '@chakra-ui/react';

import { Aside } from '@components/aside/Aside';
import { MyContainer } from '@components/ui/MyContainer';
import { MySimpleGrid } from '@components/ui/MySimpleGrid';

export function SkeletonContainer() {
const Cards = Array.from({ length: 12 }, (_, index) => (
<Stack key={index} spacing='2' mb='10'>
<Skeleton
w={{ base: '120px', sm: '150px', md: '200px' }}
h={{ base: '160px', sm: '200px', md: '300px' }}
rounded='lg'
></Skeleton>
<SkeletonText mt='1' noOfLines={2} spacing='2' skeletonHeight='4' />
</Stack>
));

return (
<>
<MyContainer>
<Aside>
<Box mt={{ base: '7', md: '97px' }}>
<SkeletonText
mt='1'
noOfLines={2}
spacing='2'
skeletonHeight='5'
mb='10'
/>
<SkeletonText
mt='1'
noOfLines={14}
spacing='2'
skeletonHeight='3'
mb='10'
/>
<SkeletonText mt='1' noOfLines={4} spacing='2' skeletonHeight='3' />
</Box>
</Aside>
<MySimpleGrid>{Cards}</MySimpleGrid>
</MyContainer>
</>
);
}
47 changes: 3 additions & 44 deletions src/components/skeletons/SkeletonProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,17 @@
import React from 'react';
import {
Box,
Flex,
Skeleton,
SkeletonCircle,
SkeletonText,
Stack,
} from '@chakra-ui/react';
import { Flex, Skeleton, SkeletonCircle } from '@chakra-ui/react';

import { MyContainer } from '@components/ui/MyContainer';
import { Aside } from '@components/aside/Aside';
import { MySimpleGrid } from '@components/ui/MySimpleGrid';
import { SkeletonContainer } from '@components/skeletons/SkeletonContainer';

export function SkeletonProfile() {
const Cards = Array.from({ length: 12 }, (_, index) => (
<Stack key={index} spacing='2' mb='10'>
<Skeleton
w={{ base: '120px', sm: '150px', md: '200px' }}
h={{ base: '160px', sm: '200px', md: '300px' }}
rounded='lg'
></Skeleton>
<SkeletonText mt='1' noOfLines={2} spacing='2' skeletonHeight='4' />
</Stack>
));

return (
<>
<Flex as='section' justify='center' direction='column' mt='7'>
<SkeletonCircle size='100px' m='auto' />
<Skeleton w='235px' h='25px' m='0 auto' mt='6' />
<Skeleton w='180px' h='20px' m='0 auto' my='3' />
</Flex>
<MyContainer>
<Aside>
<Box mt={{ base: '7', md: '97px' }}>
<SkeletonText
mt='1'
noOfLines={2}
spacing='2'
skeletonHeight='5'
mb='10'
/>
<SkeletonText
mt='1'
noOfLines={14}
spacing='2'
skeletonHeight='3'
mb='10'
/>
<SkeletonText mt='1' noOfLines={4} spacing='2' skeletonHeight='3' />
</Box>
</Aside>
<MySimpleGrid>{Cards}</MySimpleGrid>
</MyContainer>
<SkeletonContainer />
</>
);
}
23 changes: 22 additions & 1 deletion src/pages/Favorites.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import React, { useEffect } from 'react';
import { NavLink, ScrollRestoration } from 'react-router-dom';
import { Box, Flex, Icon, Image, Link, Spinner } from '@chakra-ui/react';
import {
Box,
Flex,
Icon,
Image,
Link,
Spinner,
useColorModeValue,
} from '@chakra-ui/react';
import { useInView } from 'react-intersection-observer';
import { MdOutlineExplore } from 'react-icons/md';

Expand All @@ -19,6 +27,7 @@ import { SkeletonAllBooks } from '@components/skeletons/SkeletonABooks';
import { emptyFavorites } from '@assets/assets';

export default function Favorites() {
const grayColor = useColorModeValue('#E2E8F0', '#2D3748');
const { ref, inView } = useInView();
const { currentUser } = useAuth();
const uid = currentUser?.uid;
Expand Down Expand Up @@ -136,6 +145,18 @@ export default function Favorites() {
<ContainerTitle title='Mis favoritos' />
<ScrollRestoration />
<MySliderCategories />
<Flex
display={{ base: 'flex', xl: 'none' }}
mt='4'
pt='3'
pb='3'
px={{ base: '7', md: '20', sm: '10' }}
justify={{ base: 'space-around', sm: 'space-between' }}
align='stretch'
borderY={`1px solid ${grayColor}`}
>
<ResultLength data={data?.pages[0].info.totalBooks} />
</Flex>
<MyContainer>{asideAndCardsUI}</MyContainer>
<Box ref={ref}>{fetchingNextPageUI}</Box>
</>
Expand Down
15 changes: 14 additions & 1 deletion src/pages/profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { MyContainer } from '@components/ui/MyContainer';
// import { logOut } from '../../services/firebase/auth';

export function Profile() {
const grayColor = useColorModeValue('#E2E8F0', '#2D3748');
const bgCover = useColorModeValue('gray.100', 'gray.700');
const { ref, inView } = useInView();
const getToken = window.localStorage.getItem('app_tk');
Expand Down Expand Up @@ -213,11 +214,23 @@ export function Profile() {
{createdAt}
</Flex>
</Flex>
<Flex justify='center' borderBottom='1px solid #A0AEC0'>
<Flex justify='center'>
<Box mt='3' mb='1' fontSize={{ base: 'md', md: 'lg' }}>
PUBLICACIONES
</Box>
</Flex>
<Flex
display={{ base: 'flex', xl: 'none' }}
mt='4'
pt='3'
pb='3'
px={{ base: '7', md: '20', sm: '10' }}
justify={{ base: 'space-around', sm: 'space-between' }}
align='stretch'
borderY={`1px solid ${grayColor}`}
>
<ResultLength data={profileData?.pages[0].info.totalBooks} />
</Flex>
<MyContainer>{asideAndCardsUI}</MyContainer>
<Box ref={ref}>{fetchingNextPageUI}</Box>
</>
Expand Down
1 change: 1 addition & 0 deletions src/store/useCategoryStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface CategoryType {
const disabledRoutes = [
'/explore',
'/most-viewed',
'/my-favorites',
'/books/filter/year/',
'/books/filter/language/',
];
Expand Down

0 comments on commit 96bc101

Please sign in to comment.