From 9dc102572998226cb38b21886b9b2bc3ba957f65 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Sat, 25 Jun 2022 15:56:04 +0530 Subject: [PATCH] update all collections --- .../Collections/AllCollections/content.tsx | 10 ++------- .../{Container.tsx => dialog.tsx} | 21 ++++++++++++++----- .../Collections/AllCollections/index.tsx | 15 ++++++------- 3 files changed, 26 insertions(+), 20 deletions(-) rename src/components/Collections/AllCollections/{Container.tsx => dialog.tsx} (56%) diff --git a/src/components/Collections/AllCollections/content.tsx b/src/components/Collections/AllCollections/content.tsx index 7ee146cbb..53e062efe 100644 --- a/src/components/Collections/AllCollections/content.tsx +++ b/src/components/Collections/AllCollections/content.tsx @@ -1,28 +1,22 @@ import React from 'react'; import { DialogContent } from '@mui/material'; import { FlexWrapper } from 'components/Container'; -import AllCollectionCard from './CollectionCard'; +import AllCollectionCard from './collectionCard'; import { CollectionSummary } from 'types/collection'; interface Iprops { collectionSummaries: CollectionSummary[]; onCollectionClick: (id?: number) => void; - collectionTile: any; } export default function AllCollectionContent({ collectionSummaries, onCollectionClick, - collectionTile, }: Iprops) { return ( - + {collectionSummaries.map((collectionSummary) => ( ({ +export const AllCollectionDialog = styled(Dialog)<{ + position: 'flex-start' | 'center' | 'flex-end'; +}>(({ theme, position }) => ({ '& .MuiDialog-container': { - justifyContent: 'flex-end', + justifyContent: position, }, '& .MuiPaper-root': { - maxWidth: '498px', + maxWidth: '494px', }, '& .MuiDialogTitle-root': { - padding: theme.spacing(3, 2), + padding: theme.spacing(2), + paddingRight: theme.spacing(1), }, '& .MuiDialogContent-root': { padding: theme.spacing(2), }, + [theme.breakpoints.down(559)]: { + '& .MuiPaper-root': { + width: '324px', + }, + '& .MuiDialogContent-root': { + padding: 6, + }, + }, })); -AllCollectionContainer.propTypes = { +AllCollectionDialog.propTypes = { children: PropTypes.node, onClose: PropTypes.func.isRequired, }; diff --git a/src/components/Collections/AllCollections/index.tsx b/src/components/Collections/AllCollections/index.tsx index 242181906..ecf88c317 100644 --- a/src/components/Collections/AllCollections/index.tsx +++ b/src/components/Collections/AllCollections/index.tsx @@ -1,18 +1,18 @@ -import React, { useMemo } from 'react'; +import React, { useContext, useMemo } from 'react'; import Divider from '@mui/material/Divider'; import { COLLECTION_SORT_BY } from 'constants/collection'; import { sortCollectionSummaries } from 'services/collectionService'; import { Transition, AllCollectionDialog, -} from 'components/Collections/AllCollections/Container'; +} from 'components/Collections/AllCollections/dialog'; import { useLocalState } from 'hooks/useLocalState'; import { LS_KEYS } from 'utils/storage/localStorage'; import AllCollectionsHeader from './header'; import { CollectionSummaries } from 'types/collection'; import AllCollectionContent from './content'; -import { AllCollectionTile } from '../styledComponents'; import { isSystemCollection } from 'utils/collection'; +import { AppContext } from 'pages/_app'; interface Iprops { open: boolean; @@ -25,7 +25,7 @@ const LeftSlideTransition = Transition('up'); export default function AllCollections(props: Iprops) { const { collectionSummaries, open, onClose, setActiveCollection } = props; - + const { isMobile } = useContext(AppContext); const [collectionSortBy, setCollectionSortBy] = useLocalState( LS_KEYS.COLLECTION_SORT_BY, @@ -50,18 +50,19 @@ export default function AllCollections(props: Iprops) { return ( + open={open} + fullScreen={isMobile}>