update AllCollectionCard

This commit is contained in:
Abhinav 2022-05-26 20:37:38 +05:30
parent 34fee57dd7
commit e82d961d4c
2 changed files with 27 additions and 20 deletions

View file

@ -2,18 +2,26 @@ import { Typography } from '@mui/material';
import constants from 'utils/strings/constants';
import React from 'react';
import CollectionCard from '../CollectionCard';
import { CollectionSummary } from 'types/collection';
interface Iprops {
collectionTile: any;
collectionSummary: CollectionSummary;
onCollectionClick: (collectionID: number) => void;
}
export default function AllCollectionCard({
collectionTile,
onCollectionClick,
collectionAttributes,
latestFile,
fileCount,
}) {
collectionSummary,
}: Iprops) {
return (
<CollectionCard
large
latestFile={latestFile}
onClick={() => onCollectionClick(collectionAttributes.id)}>
collectionTile={collectionTile}
latestFile={collectionSummary.latestFile}
onClick={() =>
onCollectionClick(collectionSummary.collectionAttributes.id)
}>
<div>
<Typography
css={`
@ -21,7 +29,7 @@ export default function AllCollectionCard({
font-weight: 600;
line-height: 20px;
`}>
{collectionAttributes.name}
{collectionSummary.collectionAttributes.name}
</Typography>
<Typography
css={`
@ -29,7 +37,7 @@ export default function AllCollectionCard({
font-weight: 400;
line-height: 20px;
`}>
{fileCount} {constants.PHOTOS}
{collectionSummary.fileCount} {constants.PHOTOS}
</Typography>
</div>
</CollectionCard>

View file

@ -7,10 +7,12 @@ import { CollectionSummary } from 'types/collection';
interface Iprops {
collectionSummaries: CollectionSummary[];
onCollectionClick: (id?: number) => void;
collectionTile: any;
}
export default function AllCollectionContent({
collectionSummaries,
onCollectionClick,
collectionTile,
}: Iprops) {
return (
<DialogContent>
@ -18,17 +20,14 @@ export default function AllCollectionContent({
style={{
flexWrap: 'wrap',
}}>
{collectionSummaries.map(
({ latestFile, collectionAttributes, fileCount }) => (
<AllCollectionCard
onCollectionClick={onCollectionClick}
collectionAttributes={collectionAttributes}
key={collectionAttributes.id}
latestFile={latestFile}
fileCount={fileCount}
/>
)
)}
{collectionSummaries.map((collectionSummary) => (
<AllCollectionCard
collectionTile={collectionTile}
onCollectionClick={onCollectionClick}
collectionSummary={collectionSummary}
key={collectionSummary.collectionAttributes.id}
/>
))}
</FlexWrapper>
</DialogContent>
);