refactor: in place input division
This commit is contained in:
32
src/components/ui/InPlaceInput/InPlaceInputMobile.tsx
Normal file
32
src/components/ui/InPlaceInput/InPlaceInputMobile.tsx
Normal file
@ -0,0 +1,32 @@
|
||||
import { FC, ReactNode } from "react";
|
||||
import { modals } from "@mantine/modals";
|
||||
|
||||
type Props = {
|
||||
defaultValue?: string;
|
||||
onComplete: (value: string) => void;
|
||||
getChildren: (startEditing: () => void) => ReactNode;
|
||||
modalTitle?: string;
|
||||
};
|
||||
|
||||
const InPlaceInputMobile: FC<Props> = ({
|
||||
onComplete,
|
||||
getChildren,
|
||||
modalTitle = "",
|
||||
defaultValue = "",
|
||||
}) => {
|
||||
const onStartCreating = () => {
|
||||
modals.openContextModal({
|
||||
modal: "enterNameModal",
|
||||
title: modalTitle,
|
||||
withCloseButton: true,
|
||||
innerProps: {
|
||||
onComplete,
|
||||
defaultValue,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return getChildren(onStartCreating);
|
||||
};
|
||||
|
||||
export default InPlaceInputMobile;
|
||||
Reference in New Issue
Block a user