moved attribute type to respective components

This commit is contained in:
Abhinav-grd 2021-04-27 11:20:03 +05:30
parent 506a889c98
commit ea079fffe8
4 changed files with 28 additions and 22 deletions

View file

@ -6,7 +6,6 @@ import { Formik } from 'formik';
import * as Yup from 'yup'; import * as Yup from 'yup';
import SubmitButton from 'components/SubmitButton'; import SubmitButton from 'components/SubmitButton';
import MessageDialog from 'components/MessageDialog'; import MessageDialog from 'components/MessageDialog';
import { CollectionNamerAttributes } from '..';
interface Props { interface Props {
show: boolean; show: boolean;
@ -16,6 +15,17 @@ interface Props {
interface formValues { interface formValues {
albumName: string; albumName: string;
} }
export interface CollectionNamerAttributes {
callback: (name) => Promise<void>;
title: string;
autoFilledName: string;
buttonText: string;
}
export type SetCollectionNamerAttributes = React.Dispatch<
React.SetStateAction<CollectionNamerAttributes>
>;
export default function CollectionNamer({ attributes, ...props }: Props) { export default function CollectionNamer({ attributes, ...props }: Props) {
const collectionNameInputRef = useRef(null); const collectionNameInputRef = useRef(null);

View file

@ -16,6 +16,15 @@ export const CollectionIcon = styled.div`
outline: none; outline: none;
`; `;
export interface CollectionSelectorAttributes {
callback: (collection) => Promise<void>;
showNextModal: () => void;
title: string;
}
export type SetCollectionSelectorAttributes = React.Dispatch<
React.SetStateAction<CollectionSelectorAttributes>
>;
interface Props { interface Props {
show: boolean; show: boolean;
onHide: () => void; onHide: () => void;

View file

@ -10,11 +10,7 @@ import {
import styled from 'styled-components'; import styled from 'styled-components';
import { SetDialogMessage } from 'utils/billingUtil'; import { SetDialogMessage } from 'utils/billingUtil';
import constants from 'utils/strings/constants'; import constants from 'utils/strings/constants';
import { CollectionNamerAttributes } from '..'; import { SetCollectionNamerAttributes } from './CollectionNamer';
type SetCollectionNamerAttributes = React.Dispatch<
React.SetStateAction<CollectionNamerAttributes>
>;
interface CollectionProps { interface CollectionProps {
collections: Collection[]; collections: Collection[];

View file

@ -47,8 +47,12 @@ import AlertBanner from './components/AlertBanner';
import MessageDialog, { MessageAttributes } from 'components/MessageDialog'; import MessageDialog, { MessageAttributes } from 'components/MessageDialog';
import { useDropzone } from 'react-dropzone'; import { useDropzone } from 'react-dropzone';
import EnteSpinner from 'components/EnteSpinner'; import EnteSpinner from 'components/EnteSpinner';
import CollectionNamer from './components/CollectionNamer'; import CollectionNamer, {
import CollectionSelector from './components/CollectionSelector'; CollectionNamerAttributes,
} from './components/CollectionNamer';
import CollectionSelector, {
CollectionSelectorAttributes,
} from './components/CollectionSelector';
import { LoadingOverlay } from 'components/LoadingOverlay'; import { LoadingOverlay } from 'components/LoadingOverlay';
const DATE_CONTAINER_HEIGHT = 45; const DATE_CONTAINER_HEIGHT = 45;
const IMAGE_CONTAINER_HEIGHT = 200; const IMAGE_CONTAINER_HEIGHT = 200;
@ -147,20 +151,7 @@ export type selectedState = {
count: number; count: number;
}; };
export interface CollectionSelectorAttributes { export default function Gallery() {
callback: (collection) => Promise<void>;
showNextModal: () => void;
title: string;
}
export interface CollectionNamerAttributes {
callback: (name) => Promise<void>;
title: string;
autoFilledName: string;
buttonText: string;
}
export default function Gallery(props: Props) {
const router = useRouter(); const router = useRouter();
const [collections, setCollections] = useState<Collection[]>([]); const [collections, setCollections] = useState<Collection[]>([]);
const [ const [