-
Notifications
You must be signed in to change notification settings - Fork 6
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
test: 스토리북에 구글 맵 적용 후 검색 창 스토리북을 개선한다 #926
base: develop
Are you sure you want to change the base?
Changes from all commits
06d0f34
5115d54
6d48604
06cb35c
5665ed7
6092389
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<link | ||
rel="stylesheet" | ||
href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap" | ||
/> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { Wrapper } from '@googlemaps/react-wrapper'; | ||
import type { Preview } from '@storybook/react'; | ||
import { initialize, mswDecorator } from 'msw-storybook-addon'; | ||
|
||
|
@@ -66,16 +67,33 @@ const preview: Preview = { | |
}, | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<React.Fragment> | ||
<QueryClientProvider client={queryClient}> | ||
<GlobalStyle /> | ||
<MemoryRouter initialEntries={['/']}> | ||
<Story /> | ||
</MemoryRouter> | ||
</QueryClientProvider> | ||
</React.Fragment> | ||
), | ||
(Story) => { | ||
const map = document.getElementById('map'); | ||
|
||
if (map) { | ||
map.style.visibility = 'hidden'; | ||
} | ||
|
||
return ( | ||
<React.Fragment> | ||
<QueryClientProvider client={queryClient}> | ||
<GlobalStyle /> | ||
<MemoryRouter initialEntries={['/']}> | ||
<Wrapper | ||
apiKey={ | ||
process.env.NODE_ENV === 'production' | ||
? process.env.GOOGLE_MAPS_API_KEY_PROD! | ||
: process.env.GOOGLE_MAPS_API_KEY_DEV! | ||
} | ||
libraries={['marker']} | ||
> | ||
<Story /> | ||
</Wrapper> | ||
</MemoryRouter> | ||
</QueryClientProvider> | ||
</React.Fragment> | ||
Comment on lines
+77
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 그냥 정말 개인적인 생각인데 컴포넌트 단위 렌더링을 위해 스토리북을 사용하는데 구글 지도가 이 과정에 포함되는게 조금 어색하다는 생각이 듭니다. 컴포넌트 단위로 렌더링을 할 수 있게 컴포넌트에서 구글 지도 api에 대한 참조를 끊어내는것도 괜찮지 않을까 하는 생각입니다! 혹시 어떻게 생각하시나요...?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요거슨 길어질 것 같으니 만나서 얘기합시다 |
||
); | ||
}, | ||
mswDecorator, | ||
], | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,16 +44,13 @@ | |
type="application/manifest+json" | ||
/> | ||
|
||
<link href="https://fonts.googleapis.com" rel="preload" as="font" /> | ||
<link crossorigin href="https://fonts.gstatic.com" rel="preload" as="font" /> | ||
<link href="https://fonts.googleapis.com" rel="preconnect" /> | ||
<link crossorigin href="https://fonts.gstatic.com" rel="preconnect" /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap" | ||
href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=fallback" | ||
rel="preload" | ||
as="style" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap" | ||
rel="stylesheet" | ||
as="font" | ||
onload="this.onload=null; this.rel='stylesheet'" | ||
Comment on lines
+47
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 좋네요 |
||
/> | ||
<title>카페인: 편리한 전기차 충전소 지도</title> | ||
</head> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<React.Fragment>
요거슨 저번에도 얘기하긴 했지만 React import 안하면 오류 메시지 나는 것 때문에 넣어놨습니다. React.Fragment 대신 다른 방법으로 오류 메시지 없애는 방법은 없을까여?🧐There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 풀 땡겨서 확인했을 땐 오류가 없는데 어떤 오류인가여?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 오류 메시지 뜨는 거요!
(
React.Fragment
태그 지우면 저장했을 때 안 쓰는 import 사라져서 저런 오류가 납니다)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금 제 윈도우 환경에서는 안뜨는데 맥에서도 확인해볼게여
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
왜 안나는지 원인을 찾았습니다. 제가 웹스톰을 써서 경고를 자동으로 처리해주는 것 같아요.
import React from 'react';
만 살려두는 경우에 경고가 안뜹니다혹시 import도 제거하셨나여?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넴 저장시 안 쓰는 import는 자동으로 없어지는 게 제 vscode 설정이라 React를 쓰고 있는 곳이 없으면 지워집니다.
import React from 'react';
를 살려두려면 일부러 저장하지 않아야 하는데, 그렇게 하는 것보다는 Fragment 태그를 두는 게 편할 것 같아서 넣어놨어요There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
무슨 말인지 알 것 같네요..
Storybook은 별도의 번들링 프로세스를 구성해서 모듈로 취급되는 관계로, React를 전역으로 가져오려면
import React from 'react';
가 반드시 있어야 하는데, vscode의 미사용 import 제거를 기능을 사용하려다 보니 preview.tsx 내의 import도 자동으로 제거되어서 억지로 Fragment를 쓰고 있는거군요..그런데 제 vscode에서는 다른 import 문장들과는 다르게 해당 react import 문장은 자동으로 제거되지 않는데 내일 한번 확인이 필요할 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞습니다
저만 지워지는 거 였나요😂 낼 확인해봅시다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네넹