Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix560 experts cards view mobile #758

Merged
merged 2 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/old/modules/experts/components/ExpertsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,18 @@ const ExpertsView: React.FC = () => {
</>
);

const LoadMoreButtonEl = (
<LoadMoreButton
clicked={loadMore}
isLastPage={isLastPage}
loading={loading}
totalPages={totalPages}
totalElements={totalElements}
pageNumber={pageNumber}
textType={LoadMoreButtonTextType.EXPERT}
/>
);

if (mobile) {
return (
<ExpertsViewMobile
Expand All @@ -362,6 +374,7 @@ const ExpertsView: React.FC = () => {
SelectedTypes={SelectedTypes}
FilterCheckboxes={FilterCheckboxes}
setPage={loadMore}
LoadMoreButton={LoadMoreButtonEl}
/>
);
}
Expand Down Expand Up @@ -411,15 +424,7 @@ const ExpertsView: React.FC = () => {
<>
<ExpertsList experts={experts} />
<Grid container justify="center">
<LoadMoreButton
clicked={loadMore}
isLastPage={isLastPage}
loading={loading}
totalPages={totalPages}
totalElements={totalElements}
pageNumber={pageNumber}
textType={LoadMoreButtonTextType.EXPERT}
/>
{LoadMoreButtonEl}
</Grid>
</>
)}
Expand Down
13 changes: 11 additions & 2 deletions src/old/modules/experts/components/ExpertsViewMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { LoadingContainer } from 'old/lib/components/Loading/LoadingContainer';
import FiltersMenu from 'components/FiltersMenuMobile/FiltersMenu';
import FiltersButton from 'old/lib/components/FiltersButton/FiltersButton';
import { LoadingStatusType, LoadingStatusEnum, IExpert } from 'old/lib/types';
import UpButton from 'old/lib/components/UpButton/UpButton';
import { useStyles } from '../styles/ExpertsViewMobile.styles';
import { AutoPaginationExpertsList } from './AutoPaginationExpertsList';
import { ExpertsList } from '../../../lib/components/Experts/ExpertsList';

interface IExpertsViewMobileProps {
page: number;
Expand All @@ -16,6 +17,7 @@ interface IExpertsViewMobileProps {
SelectedTypes: JSX.Element;
FilterCheckboxes: JSX.Element | false;
setPage: () => void;
LoadMoreButton: JSX.Element;
}

const ExpertsViewMobile: FC<IExpertsViewMobileProps> = ({
Expand All @@ -27,6 +29,7 @@ const ExpertsViewMobile: FC<IExpertsViewMobileProps> = ({
SelectedTypes,
FilterCheckboxes,
setPage,
LoadMoreButton,
}) => {
const classes = useStyles();

Expand All @@ -45,9 +48,15 @@ const ExpertsViewMobile: FC<IExpertsViewMobileProps> = ({
{page === 0 && loading === LoadingStatusEnum.pending ? (
<LoadingContainer loading={loading} expand />
) : (
<AutoPaginationExpertsList experts={experts} setPage={setPage} />
<>
<ExpertsList experts={experts} />
<Grid container justify="center">
{LoadMoreButton}
</Grid>
</>
)}
</Grid>
<UpButton />
<FiltersButton
filtersMenuOpen={filtersMenuOpen}
setFiltersMenuOpen={setFiltersMenuOpen}
Expand Down