Skip to content

Commit

Permalink
Also fix the mobile view of the bottom cards
Browse files Browse the repository at this point in the history
  • Loading branch information
ccanos committed Nov 15, 2024
1 parent c47ccd2 commit b03396e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Box, Button, Theme, useMediaQuery } from '@mui/material';
import { CONTRIBUTE_CARD_COLUMNS } from '../../../core/ui/card/ContributeCard';
import GridItem from '../../../core/ui/grid/GridItem';
import { Skeleton } from '@mui/material';
import { gutters } from '../../../core/ui/grid/utils';
import { useTheme } from '@mui/styles';

interface InnovationPacksViewProps extends PageContentBlockProps {
filter: string[];
Expand All @@ -37,6 +39,7 @@ const InnovationPacksView = ({
...props
}: InnovationPacksViewProps) => {
const { t } = useTranslation();
const theme = useTheme();
const isMobile = useMediaQuery<Theme>(theme => theme.breakpoints.down('sm'));

return (
Expand All @@ -54,8 +57,8 @@ const InnovationPacksView = ({
? Array.from({ length: isMobile ? 2 : 5 }).map((_, idx) => (
<Skeleton
key={idx}
width={240}
height={300}
width={gutters(12)(theme)}
height={gutters(13)(theme)}
animation="pulse"
variant="rectangular"
sx={{ borderRadius: 1 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import TemplateTypeFilterMobile from './TemplateTypeFilterMobile';
import { TemplateType } from '../../../core/apollo/generated/graphql-schema';
import TemplateCard from '../../templates/components/cards/TemplateCard';
import { AnyTemplate, AnyTemplateWithInnovationPack } from '../../templates/models/TemplateBase';
import { gutters } from '../../../core/ui/grid/utils';
import { useTheme } from '@mui/styles';

export interface LibraryTemplatesFilter {
templateTypes: TemplateType[];
Expand Down Expand Up @@ -47,6 +49,7 @@ const LibraryTemplatesView = ({
}: Omit<PageContentBlockProps, 'onClick'> & LibraryTemplatesViewProps) => {
const { t } = useTranslation();
const isMobile = useMediaQuery<Theme>(theme => theme.breakpoints.down('sm'));
const theme = useTheme();

return (
<PageContentBlock {...props}>
Expand Down Expand Up @@ -90,11 +93,11 @@ const LibraryTemplatesView = ({

<ScrollableCardsLayoutContainer minHeight={0} orientation={expanded ? 'vertical' : undefined} sameHeight>
{loading
? Array.from({ length: 5 }).map((_, idx) => (
? Array.from({ length: isMobile ? 2 : 5 }).map((_, idx) => (
<Skeleton
key={idx}
width={248}
height={262}
width={gutters(12)(theme)}
height={gutters(13)(theme)}
animation="pulse"
variant="rectangular"
sx={{ borderRadius: 1 }}
Expand All @@ -109,7 +112,7 @@ const LibraryTemplatesView = ({
/>
))}

{isMobile && hasMore && (
{isMobile && !loading && hasMore && (
<GridItem columns={CONTRIBUTE_CARD_COLUMNS}>
<Box
sx={{
Expand Down

0 comments on commit b03396e

Please sign in to comment.