>;
+
+interface RenderActionButtonProps {
+ variant: 'close' | 'edit' | 'complete';
+ icon: JSX.Element;
+ text: string | null;
+ onClick: () => void;
+}
+
+const EditFloatingButton = () => {
+ const [isEditMode, setIsEditMode] = useState(false);
+ const [isEditTimeTableMode, setIsEditTimeTableMode] = useState(false);
+ const [isFestivalDeleteMode, setIsFestivalDeleteMode] = useState(false);
+ const [isTextVisible, setIsTextVisible] = useState(true);
+
+ const resetModes = () => {
+ setIsEditTimeTableMode(false);
+ setIsFestivalDeleteMode(false);
+ };
+
+ const handleToggleButton = () => {
+ setIsEditMode((prev) => !prev);
+ setIsTextVisible(true);
+ if (isEditTimeTableMode || isFestivalDeleteMode) resetModes();
+ };
+
+ const handleModeToggle = (modeSetter: ModeSetter): void => {
+ modeSetter((prev: boolean) => !prev);
+ };
+
+ const getBackgroundClassName = () => {
+ return `${styles.background} ${
+ isEditMode && !isEditTimeTableMode && !isFestivalDeleteMode
+ ? styles.backgroundVisible
+ : ''
+ }`;
+ };
+
+ const renderButton = () => {
+ if (isEditMode && (isEditTimeTableMode || isFestivalDeleteMode)) {
+ return renderActionButton({
+ variant: 'complete',
+ icon: ,
+ text: '완료하기',
+ onClick: handleToggleButton,
+ });
+ }
+
+ if (isEditMode) {
+ return renderActionButton({
+ variant: 'close',
+ icon: ,
+ text: null,
+ onClick: handleToggleButton,
+ });
+ }
+
+ return renderActionButton({
+ variant: 'edit',
+ icon: ,
+ text: '편집하기',
+ onClick: handleToggleButton,
+ });
+ };
+
+ const renderActionButton = ({
+ variant,
+ icon,
+ text,
+ onClick,
+ }: RenderActionButtonProps) => (
+
+ );
+
+ const renderActionButtons = () => {
+ if (isEditMode && !isEditTimeTableMode && !isFestivalDeleteMode) {
+ return (
+
+
+
+
+ );
+ }
+ return null;
+ };
+
+ return (
+ <>
+
+ {renderActionButtons()}
+ {renderButton()}
+ >
+ );
+};
+
+export default EditFloatingButton;