reorder declarations

This commit is contained in:
Abhinav-grd 2021-04-27 12:59:32 +05:30
parent 24bc4d57ca
commit b52bc0af20

View file

@ -6,14 +6,6 @@ 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';
interface Props {
show: boolean;
onHide: () => void;
attributes: CollectionNamerAttributes;
}
interface formValues {
albumName: string;
}
export interface CollectionNamerAttributes { export interface CollectionNamerAttributes {
callback: (name) => Promise<void>; callback: (name) => Promise<void>;
title: string; title: string;
@ -25,13 +17,17 @@ export type SetCollectionNamerAttributes = React.Dispatch<
React.SetStateAction<CollectionNamerAttributes> React.SetStateAction<CollectionNamerAttributes>
>; >;
interface Props {
show: boolean;
onHide: () => void;
attributes: CollectionNamerAttributes;
}
interface formValues {
albumName: string;
}
export default function CollectionNamer({ attributes, ...props }: Props) { export default function CollectionNamer({ attributes, ...props }: Props) {
const collectionNameInputRef = useRef(null); const collectionNameInputRef = useRef(null);
const onSubmit = ({ albumName }: formValues) => {
attributes.callback(albumName);
props.onHide();
};
useEffect(() => { useEffect(() => {
if (attributes) { if (attributes) {
setTimeout(() => { setTimeout(() => {
@ -44,6 +40,10 @@ export default function CollectionNamer({ attributes, ...props }: Props) {
<MessageDialog show={false} onHide={() => null} attributes={{}} /> <MessageDialog show={false} onHide={() => null} attributes={{}} />
); );
} }
const onSubmit = ({ albumName }: formValues) => {
attributes.callback(albumName);
props.onHide();
};
return ( return (
<MessageDialog <MessageDialog
show={props.show} show={props.show}