Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function DesktopModal() {
>
{contents}
</div>
<DesktopModalFooter rightFunction={onConfirm} leftFunction={closeDesktopModal} options={options} />
<DesktopModalFooter rightFunction={onConfirm} leftFunction={onClose} options={options} />
</div>
</div>
</Portal>
Expand Down Expand Up @@ -149,11 +149,10 @@ function DesktopModalHeader({ title, onBack, onClose }: DesktopModalHeaderProps)
);
}

function DesktopModalFooter({ leftFunction, rightFunction = () => {}, options }: DesktopModalFooterProps) {
function DesktopModalFooter({ leftFunction, rightFunction = () => {}, options = {} }: DesktopModalFooterProps) {
const DEFAULT_BUTTON_TEXT = ["취소", "확인"];
const { buttonText = DEFAULT_BUTTON_TEXT, enableFooter = true } = options || { buttonText: DEFAULT_BUTTON_TEXT };

if (!enableFooter) return null;
if (!options.enableFooter) return null;

return (
<div
Expand All @@ -173,11 +172,11 @@ function DesktopModalFooter({ leftFunction, rightFunction = () => {}, options }:
>
{leftFunction && (
<Button colorSchema={"gray"} onClick={leftFunction}>
{buttonText[0]}
{options?.buttonText?.[0] ?? DEFAULT_BUTTON_TEXT[0]}
</Button>
)}
<Button colorSchema={"primary"} onClick={rightFunction}>
{buttonText[1]}
{options?.buttonText?.[1] ?? DEFAULT_BUTTON_TEXT[1]}
</Button>
</ButtonProvider>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/component/space/edit/SpaceManageToggleMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function SpaceManageToggleMenu({
iconSize?: number;
iconColor?: keyof typeof DESIGN_TOKEN_COLOR;
}) {
const { isShowMenu, showMenu } = useToggleMenu();
const { isShowMenu, showMenu, hideMenu } = useToggleMenu();
const navigate = useNavigate();
const { open: openDesktopModal } = useDesktopBasicModal();
const { open: openAlertModal } = useModal();
Expand Down Expand Up @@ -46,6 +46,7 @@ export default function SpaceManageToggleMenu({
enableFooter: false,
},
});
hideMenu();
};

/**
Expand All @@ -67,7 +68,6 @@ export default function SpaceManageToggleMenu({
display: flex;
align-items: center;
justify-content: center;
transition: all 0.4s;
`}
>
<Icon
Expand Down
11 changes: 10 additions & 1 deletion apps/web/src/hooks/useDesktopBasicModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ export const useDesktopBasicModal = () => {
const [modalDataState, setModalDataState] = useAtom(desktopBasicModalState);

const close = useCallback(() => {
setModalDataState({ ...modalDataState, isOpen: false });
setModalDataState({
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모바일의 경우에는 옵션을 넣는 경우가 많지 않아서 발견을 못한 것 같은데, 데스크탑 모달에서 옵션을 넣고 다른 데스크톱 모달을 열면서 옵션 값이 유지되는 현상을 발견했어요! 그래서 초기화해주는 부분을 넣었습니다! (모바일은 조금 더 확인해보겠습니다)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵! 감사합니다!

...modalDataState,
isOpen: false,
options: {
type: "confirm",
buttonText: [],
autoClose: true,
enableFooter: true,
},
});
}, [modalDataState, setModalDataState]);

const open = useCallback(
Expand Down