Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 모달 열기 이벤트 동작 안하는 에러 #675

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
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@tanstack/react-query-devtools": "^4.36.1",
"axios": "^1.5.1",
"browser-image-compression": "^2.0.2",
"celuveat-ui-library": "^1.2.8",
"celuveat-ui-library": "^1.4.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.14.2",
Expand Down Expand Up @@ -58,6 +58,7 @@
"@testing-library/react": "^14.0.0",
"@types/google.maps": "^3.53.5",
"@types/jest": "^29.5.3",
"@types/node": "^20.11.0",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@types/react-slick": "^0.23.11",
Expand Down
24 changes: 23 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import { Suspense } from 'react';
import { styled } from 'styled-components';
import LoadingIndicator from '~/components/@common/LoadingIndicator';

import Router from './router/Router';

function App() {
return <Router />;
return (
<Suspense
fallback={
<StyledProcessing>
<LoadingIndicator size={64} />
</StyledProcessing>
}
>
<Router />
</Suspense>
);
}

export default App;

const StyledProcessing = styled.div`
display: flex;
justify-content: center;
align-items: center;

height: 100vh;
`;
70 changes: 0 additions & 70 deletions frontend/src/components/@common/Dialog/Dialog.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/src/components/@common/Dialog/index.tsx

This file was deleted.

92 changes: 46 additions & 46 deletions frontend/src/components/@common/ErrorBoundary/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
import { Component, ReactElement, ReactNode } from 'react';

interface FallbackRenderProps {
resetErrorBoundary: () => void;
}
interface Props {
children: ReactNode;
fallbackRender: ({ resetErrorBoundary }: FallbackRenderProps) => ReactElement;
reset: () => void;
}

interface State {
hasError: boolean;
}

class ErrorBoundary extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = { hasError: false };
}

static getDerivedStateFromError(): State {
return {
hasError: true,
};
}

resetErrorBoundary() {
const { reset } = this.props;
reset();
this.setState({ hasError: false });
}

render() {
const { hasError } = this.state;
const { children, fallbackRender } = this.props;

if (hasError) {
return fallbackRender({ resetErrorBoundary: () => this.resetErrorBoundary() });
}

return children;
}
}

export default ErrorBoundary;
// import { Component, ReactElement, ReactNode } from 'react';

// interface FallbackRenderProps {
// resetErrorBoundary: () => void;
// }
// interface Props {
// children: ReactNode;
// fallbackRender: ({ resetErrorBoundary }: FallbackRenderProps) => ReactElement;
// reset: () => void;
// }

// interface State {
// hasError: boolean;
// }

// class ErrorBoundary extends Component<Props, State> {
// constructor(props: Props) {
// super(props);
// this.state = { hasError: false };
// }

// static getDerivedStateFromError(): State {
// return {
// hasError: true,
// };
// }

// resetErrorBoundary() {
// const { reset } = this.props;
// reset();
// this.setState({ hasError: false });
// }

// render() {
// const { hasError } = this.state;
// const { children, fallbackRender } = this.props;

// if (hasError) {
// return fallbackRender({ resetErrorBoundary: () => this.resetErrorBoundary() });
// }

// return children;
// }
// }

// export default ErrorBoundary;
2 changes: 1 addition & 1 deletion frontend/src/components/CelebDropDown/CelebDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function CelebDropDown() {
<StyledDropDownWrapper isMobile={isMobile}>
<StyledSelectContainer>
{[OPTION_FOR_CELEB_ALL, ...celebOptions].map(celeb => (
<DropDown.Option as="li" key={celeb.id} externalClick={selectCeleb(celeb)} isCustom>
<DropDown.Option as="li" key={celeb.id} onClick={selectCeleb(celeb)} isCustom>
<StyledDropDownOption>
<CelebDropDownOption celeb={celeb} />
</StyledDropDownOption>
Expand Down
44 changes: 21 additions & 23 deletions frontend/src/components/Form/SuggestionForm/SuggestionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom';
import styled from 'styled-components';
import { postRevisedInfo } from '~/api/restaurant';
import TextButton from '~/components/@common/Button';
import Dialog from '~/components/@common/Dialog';

import { BORDER_RADIUS, FONT_SIZE } from '~/styles/common';

const labels = [
Expand Down Expand Up @@ -37,28 +37,26 @@ function SuggestionForm() {
};

return (
<Dialog title="정보 수정 제안">
<StyledForm onSubmit={handleSubmit}>
<h5>수정 항목</h5>
<p>잘못되었거나 수정이 필요한 정보들을 모두 선택해주세요.</p>
<StyledUnorderedList>
{labels.map(label => (
<StyledListItem>
<CheckBox value={label} onChange={clickCheckBox} />
<span>{label}</span>
</StyledListItem>
))}
<StyledTextarea placeholder="(선택) 내용을 입력해주세요." onChange={onChangeTextarea} />
</StyledUnorderedList>
<TextButton
type="submit"
text="등록하기"
onClick={handleSubmit}
colorType="light"
disabled={!checkedItems.length && !textareaValue}
/>
</StyledForm>
</Dialog>
<StyledForm onSubmit={handleSubmit}>
<h5>수정 항목</h5>
<p>잘못되었거나 수정이 필요한 정보들을 모두 선택해주세요.</p>
<StyledUnorderedList>
{labels.map(label => (
<StyledListItem>
<CheckBox value={label} onChange={clickCheckBox} />
<span>{label}</span>
</StyledListItem>
))}
<StyledTextarea placeholder="(선택) 내용을 입력해주세요." onChange={onChangeTextarea} />
</StyledUnorderedList>
<TextButton
type="submit"
text="등록하기"
onClick={handleSubmit}
colorType="light"
disabled={!checkedItems.length && !textareaValue}
/>
</StyledForm>
);
}

Expand Down
50 changes: 0 additions & 50 deletions frontend/src/components/FormModal/FormModal.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/src/components/FormModal/index.tsx

This file was deleted.

29 changes: 17 additions & 12 deletions frontend/src/components/InfoDropDown/InfoDropDown.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { styled } from 'styled-components';
import { useQuery } from '@tanstack/react-query';
import { DropDown } from 'celuveat-ui-library';
import { useNavigate } from 'react-router-dom';
import { styled } from 'styled-components';
import { getProfile } from '~/api/user';
import { DropDown, Modal } from 'celuveat-ui-library';

import InfoButton from '~/components/@common/InfoButton';
import LoginModal from '~/components/LoginModal';

import { ProfileData } from '~/@types/api.types';
import useCeluveatModal from '~/hooks/useCeluveatModal';
import { getProfile } from '~/api/user';

import type { ProfileData } from '~/@types/api.types';

function InfoDropDown() {
const { openLoginModal } = useCeluveatModal();
const { data, isSuccess: isLogin } = useQuery<ProfileData>({
queryKey: ['profile'],
queryFn: getProfile,
Expand Down Expand Up @@ -40,20 +41,22 @@ function InfoDropDown() {
<StyledDropDownWrapper>
{isLogin ? (
<>
<DropDown.Option as="li" isCustom externalClick={goMyPage}>
<DropDown.Option as="li" isCustom onClick={goMyPage}>
<StyledDropDownOption>마이 페이지</StyledDropDownOption>
</DropDown.Option>
<DropDown.Option as="li" isCustom externalClick={goWishList}>
<DropDown.Option as="li" isCustom onClick={goWishList}>
<StyledDropDownOption>위시리스트</StyledDropDownOption>
</DropDown.Option>
<DropDown.Option as="li" isCustom externalClick={goWithdrawal}>
<DropDown.Option as="li" isCustom onClick={goWithdrawal}>
<StyledDropDownOption>회원 탈퇴</StyledDropDownOption>
</DropDown.Option>
</>
) : (
<DropDown.Option isCustom externalClick={openLoginModal}>
<StyledDropDownOption>로그인</StyledDropDownOption>
</DropDown.Option>
<Modal.OpenButton modalTitle="로그인 및 회원가입" isCustom modalContent={<LoginModal />}>
<DropDown.Option isCustom>
<StyledDropDownOption>로그인</StyledDropDownOption>
</DropDown.Option>
</Modal.OpenButton>
)}
</StyledDropDownWrapper>
</DropDown.Options>
Expand Down Expand Up @@ -99,6 +102,8 @@ const StyledDropDownOption = styled.li`

padding: 0 1rem;

border-radius: 10px;

&:hover {
background: var(--gray-1);
}
Expand Down
Loading
Loading