-
Notifications
You must be signed in to change notification settings - Fork 10
feat: apply max-width in dialog #394
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
Conversation
🦋 Changeset detectedLatest commit: 0da69fc The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @noahchoii, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the dialog component by introducing a Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
안녕하세요. 다이얼로그 컴포넌트에 max-width를 적용하고 관련 스타일 및 스토리를 업데이트하는 PR을 리뷰했습니다. 전반적으로 좋은 변경이라고 생각합니다. 특히 transition 속성을 transitionProperty와 transitionDuration으로 명시적으로 분리하여 성능을 개선한 점이 인상적입니다. 몇 가지 개선점을 제안드립니다. CSS 파일에서 하드코딩된 px 값과 매직 넘버를 테마 변수로 대체하여 디자인 시스템의 일관성을 높이는 것을 고려해 주세요. 또한, Storybook 파일의 중복 코드를 리팩토링하여 가독성과 유지보수성을 향상시킬 수 있습니다. 자세한 내용은 각 파일의 주석을 참고해 주세요.
I am having trouble creating individual review comments. Click here to see my feedback.
packages/core/src/components/dialog/dialog.css.ts (57-59)
width 값을 rem에서 px 단위의 하드코딩된 값으로 변경하셨습니다. 스타일 가이드 7.3절에 따라 디자인 토큰은 CSS 변수(vars)를 통해 참조하고 하드코딩을 지양해야 합니다.
500px,800px,1140px와 같은 값들은 테마 변수로 관리하는 것이 좋습니다.- 만약 적절한 테마 변수가 없다면,
rem단위를 유지하는 것을 고려해 보세요.rem단위는 루트 폰트 크기에 따라 확장되므로 접근성 면에서 더 유연한 레이아웃을 제공합니다.
md: layerStyle('components', { width: '31.25rem' }),
lg: layerStyle('components', { width: '50rem' }),
xl: layerStyle('components', { width: '71.25rem' }),
References
- 디자인 토큰(색상, 폰트, 간격 등)은 하드코딩하는 대신 CSS 변수(
vars객체)를 통해 참조해야 합니다. 이는 일관성을 유지하고 유지보수를 용이하게 합니다. (link)
packages/core/src/components/dialog/dialog.css.ts (36)
64px는 매직 넘버로 보입니다. 화면 양쪽의 여백을 의도한 것이라면, 테마 변수에 정의된 값을 사용하는 것이 좋습니다. 예를 들어, calc.multiply(vars.spacing.someValue, 2)와 같이 사용하면 유지보수성이 향상되고 디자인 시스템의 일관성을 지킬 수 있습니다.
References
- 디자인 토큰(색상, 폰트, 간격 등)은 하드코딩하는 대신 CSS 변수(
vars객체)를 통해 참조해야 합니다. 이는 일관성을 유지하고 유지보수를 용이하게 합니다. (link)
packages/core/src/components/dialog/dialog.stories.tsx (40-90)
TestBed 스토리에서 각 다이얼로그 크기(xl, lg, md)를 보여주기 위해 코드가 많이 중복되고 있습니다. 가독성과 유지보수성을 높이기 위해 이를 리팩토링하는 것이 좋겠습니다. 예를 들어, 사이즈 배열을 순회하며 컴포넌트를 렌더링하는 방식으로 개선할 수 있습니다.
<>
{(['xl', 'lg', 'md'] as const).map((size) => (
<Dialog.Root {...args} key={size} open size={size}>
<Dialog.Trigger>hihi</Dialog.Trigger>
<Dialog.PortalPrimitive>
<Dialog.OverlayPrimitive />
<Dialog.PopupPrimitive>
<Dialog.Header>
<Dialog.Title>다이얼로그입니다.</Dialog.Title>
</Dialog.Header>
<Dialog.Body>
<Dialog.Description>기본 형태의 다이얼로그입니다.</Dialog.Description>
</Dialog.Body>
<Dialog.Footer>
<Dialog.Close render={<Button colorPalette="contrast">닫기</Button>} />
</Dialog.Footer>
</Dialog.PopupPrimitive>
</Dialog.PortalPrimitive>
</Dialog.Root>
))}
</>
|
✅ All tests passed!
Click here if you need to update snapshots. |
| }, | ||
| }); | ||
|
|
||
| const SPACING = '32px'; |
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.
Is there a reason it's set to 32px here? And how about getting the spacing from our vars using space-400?
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.
I also debated whether to use tokens, but since this wasn't a design decision defined with the designer, but rather an arbitrary value added by the development team to prevent exceeding the browser width, I didn't use tokens!
| flexDirection: 'column', | ||
| alignItems: 'flex-start', | ||
|
|
||
| maxWidth: calc.subtract('100dvw', calc.multiply(SPACING, 2)), |
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.
Is there a reason dvw is specified here? For height below, using svh would be more consistent, though vw should always be the same anyway.
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.
I believe dv*, sv*, and lv* should use appropriate values depending on the situation. Since svw is based on the smallest browser width and doesn't change dynamically, dvw is correct in this case because it does change dynamically. If you have a different opinion or think I've missed something, please let me know!
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.
What I'm curious about is that height is set to svh, while width is set to dvw. Since vw doesn't actually change on mobile, it probably doesn't matter.
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.
I determined that the viewport width (vw) could change when unfolding the screen on devices like the Galaxy Jet Flip or when rotating the device horizontally to enter landscape mode. I initially thought this wouldn't happen with svw, but when I actually tested it, it worked fine even with svw...? So, as you suggested, it would be best to standardize it. I'll make the correction!
| }; | ||
|
|
||
| export const AA: Story = { | ||
| export const TestBed: Story = { |
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.
[NIT]
This is just a suggestion, but I noticed that it's forced to open in the testBed, so it's always open in the Dialog docs. It might be good to add the code below to disable only this component.
export const TestBed: Story = {
parameters: {
docs: { disable: true },
},
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.
Oh, I didn't realize that option was available. Thanks for the suggestion!
MaxLee-dev
left a comment
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.
👍
| }, | ||
| }); | ||
|
|
||
| const SPACING = '32px'; |
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.
It must be modified with rem.
Description of Changes
max-widthChecklist
Before submitting the PR, please make sure you have checked all of the following items.