Skip to content

Commit

Permalink
chore: changes in aside and Search.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Franqsanz committed Dec 6, 2023
1 parent c7e980f commit 7c4d182
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/components/AboutCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Box, Text, Link } from '@chakra-ui/react';
import { aboutCategories } from '../data/links';

export function AboutCategories({ category }: any) {
const filteredAboutCategories = aboutCategories.filter(
(item) => item.category === category,
);
const filteredAboutCategories = aboutCategories.filter((item) => {
return item.category === category;
});

return (
<>
Expand All @@ -18,8 +18,8 @@ export function AboutCategories({ category }: any) {
<Text mt='2' fontSize='sm'>
{description}
</Text>
<Box display='inline' mt='2'>
Fuente:{' '}
<Box display='inline' mt='4'>
Más Info:{' '}
<Link href={wiki} isExternal color='green.600'>
Wikipedia.
</Link>
Expand Down
7 changes: 7 additions & 0 deletions src/components/skeletons/SkeletonABooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ export function SkeletonAllBooks({ showTags = true }: SkeletonType) {
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>
Expand Down
20 changes: 19 additions & 1 deletion src/pages/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { FilterDrawer } from '../components/FilterDrawer';
import ResultLength from '../components/ResultLength';
import { AboutCategories } from '../components/AboutCategories';
import { Lost } from '../assets/assets';
import { aboutCategories } from '../data/links';

export default function Search() {
const location = useLocation();
Expand All @@ -36,6 +37,7 @@ export default function Search() {
const [selectedYear, setSelectedYear] = useState('');
const { query, param } = useParams();
let asideFilter;
let aboutCategoriesUI;
let buttonFilter;

const { data } = useFilter(query, param);
Expand Down Expand Up @@ -170,6 +172,22 @@ export default function Search() {
);
}

// Verifica si los 3 campos de aboutCategories esten con info o no
const categoryCheck = aboutCategories.find((item) => {
return item.category === param;
});

if (categoryCheck) {
const isValid =
categoryCheck.category && categoryCheck.description && categoryCheck.wiki;

if (isValid) {
aboutCategoriesUI = <AboutCategories category={param} />;
} else {
aboutCategoriesUI = null;
}
}

return (
<>
<MainHead title={`${param} | XBuniverse`} />
Expand Down Expand Up @@ -206,7 +224,7 @@ export default function Search() {
>
<Aside>
<ResultLength data={data} />
<AboutCategories category={param} />
{aboutCategoriesUI}
{asideFilter}
</Aside>
{filteredBooks.length > 0 ? (
Expand Down

1 comment on commit 7c4d182

@vercel
Copy link

@vercel vercel bot commented on 7c4d182 Dec 6, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

xbu – ./

xbu.vercel.app
xbu-franqsanz.vercel.app
xbu-git-main-franqsanz.vercel.app

Please sign in to comment.