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

[Feat] Modal 컴포넌트 추가 #83

Merged
merged 6 commits into from
Jan 23, 2025
Merged

[Feat] Modal 컴포넌트 추가 #83

merged 6 commits into from
Jan 23, 2025

Conversation

minseong0324
Copy link
Contributor

@minseong0324 minseong0324 commented Jan 22, 2025

관련 이슈

#39

변경 사항

Modal 컴포넌트를 추가했어요. 추후 useModal를 구현할 예정이에요.

컴파운드하게 제공했어요. 그리고 각 아토믹한 컴포넌트들은 props를 통해 자유롭게 커스텀할 수 있어요.

그리고, 모달이 열리게 되면 모달에 focus될 수 있도록 하고, esc 버튼을 통한 모달 닫기를 통해 키보드 접근성도 챙겼어요.

Toast와 마찬가지로 overlay-kit을 활용해서 오버레이 상태 관리를 활용할 수 있도록 JSDoc도 첨부했어요.

const openModal = () =>
  overlay.open(({ isOpen, close, unmount }) => (
    <Modal
      open={isOpen}
      onClose={close}
      onExited={unmount}
      icon={<Modal.Icon name="notice" color="warning500" />}
      doubleCTA={
        <Modal.DoubleCTA
          cancelProps={{
            children: '취소',
            onClick: close,
          }}
          confirmProps={{
            children: '나가기',
            onClick: () => {
              close();
            },
          }}
        />
      }
    >
      <Modal.Title>정말 나가시겠어요?</Modal.Title>
      <Modal.Description>
        {`이 페이지를 나가면 \n 작성한 내용은 저장되지 않아요`}
      </Modal.Description>
    </Modal>
  ));
2025-01-23.6.27.56.mov
image

레퍼런스

Summary by CodeRabbit

  • 새로운 기능

    • 페이지 내에서 모달 기능 추가
    • 페이지 이탈 시 사용자 확인을 위한 모달 구현
    • 모달 내 아이콘, 제목, 설명, 액션 버튼 지원
  • 사용자 경험 개선

    • 키보드 탐색 및 포커스 관리 기능 추가
    • 모달 애니메이션 및 접근성 향상
  • 스타일링

    • 모달 컴포넌트에 대한 일관된 테마 및 레이아웃 스타일 적용

Copy link

coderabbitai bot commented Jan 22, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/src/app/page.tsx

Oops! Something went wrong! :(

ESLint: 9.17.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@repo/eslint-config' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

개요

Walkthrough

이 풀 리퀘스트는 웹 애플리케이션에 새로운 모달 컴포넌트를 도입합니다. UI 라이브러리에 모달 관련 컴포넌트들(ModalRoot, Dimmer, FocusTrap 등)을 추가하고, 웹 페이지에서 모달을 열 수 있는 기능을 구현했습니다. 모달은 제목, 설명, 아이콘, 액션 버튼 등을 포함하는 유연하고 접근성 있는 컴포넌트로 설계되었습니다.

Changes

파일 변경 요약
apps/web/src/app/page.tsx 모달 열기 기능 추가, @repo/uiModal 컴포넌트 import
packages/ui/src/components/Modal/* 모달 관련 컴포넌트 및 스타일 전면 추가
packages/ui/src/components/index.ts 새로운 모달 컴포넌트 및 타입 export

Suggested labels

enhancement

Suggested reviewers

  • kongnayeon

Possibly related PRs

Poem

🐰 모달의 춤, 사용자와 함께
버튼을 누르면 창이 열리고
선택의 순간, 명확하게
토끼처럼 깡총깡총 UI 위에서
사용자의 여정을 안내해요! 🎉

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (17)
packages/ui/src/components/Modal/compounds/Icon/Icon.tsx (2)

4-4: 타입 정의를 개선해주세요.

ModalIconPropsIconProps를 그대로 상속받고 있어서, size 속성에 대한 제약이 없습니다. 모달 아이콘의 크기를 제한하는 것이 좋을 것 같습니다.

-export type ModalIconProps = IconProps;
+export type ModalIconProps = Omit<IconProps, 'size'> & {
+  size?: 40 | 60 | 80;
+};

6-12: 컴포넌트 문서화가 필요합니다.

개발자들의 원활한 사용을 위해 JSDoc으로 컴포넌트의 용도와 props에 대한 설명을 추가해주세요.

+/**
+ * 모달 내부에서 사용되는 아이콘 컴포넌트입니다.
+ * @param props.size - 아이콘의 크기 (기본값: 80)
+ */
export function Icon({ size = 80, ...props }: ModalIconProps) {
packages/ui/src/components/Modal/Dimmer.tsx (1)

8-19: 접근성과 유지보수성을 개선해주세요.

  1. 접근성 향상을 위해 role="presentation"을 추가해주세요.
  2. 애니메이션 지속 시간을 상수로 분리하면 유지보수가 더 쉬워질 것 같습니다.
  3. JSDoc으로 컴포넌트 문서화를 추가해주세요.
+const ANIMATION_DURATION = 0.2;
+
+/**
+ * 모달의 배경을 어둡게 처리하는 딤(Dim) 컴포넌트입니다.
+ * @param props.onClick - 딤 클릭 시 실행될 콜백 함수
+ */
export function Dimmer({ onClick }: DimmerProps) {
  return (
    <motion.div
      className={styles.overlay}
      initial={{ opacity: 0 }}
-     animate={{ opacity: 1 }}
-     exit={{ opacity: 0 }}
+     animate={{ opacity: 1, transition: { duration: ANIMATION_DURATION } }}
+     exit={{ opacity: 0, transition: { duration: ANIMATION_DURATION } }}
      onClick={onClick}
      aria-hidden="true"
+     role="presentation"
    />
  );
}
packages/ui/src/components/Modal/compounds/CTA/CTA.css.ts (1)

9-17: 스타일 일관성과 사용자 경험을 개선해주세요.

  1. 픽셀 값을 rem 단위로 통일해주세요.
  2. 버튼에 hover, active 상태를 추가하면 사용자 경험이 향상될 것 같습니다.
export const buttonStyle = style({
  width: '100%',
  borderRadius: '1.2rem',
  color: vars.colors.grey,
  backgroundColor: vars.colors.grey950,
  fontSize: vars.typography.fontSize[20],
  fontWeight: vars.typography.fontWeight.semibold,
-  height: '7.2rem',
+  height: '7.2rem',
+  transition: 'background-color 0.2s ease',
+  ':hover': {
+    backgroundColor: vars.colors.grey900,
+  },
+  ':active': {
+    backgroundColor: vars.colors.grey800,
+  },
});
packages/ui/src/components/Modal/compounds/Title/Title.tsx (1)

6-21: 타입 안정성과 문서화를 개선해주세요.

  1. fontSize prop의 타입을 명시적으로 제한하면 좋을 것 같습니다.
  2. JSDoc으로 컴포넌트와 props에 대한 설명을 추가해주세요.
+/**
+ * 모달의 제목을 표시하는 컴포넌트입니다.
+ * @param props.fontSize - 글자 크기 (기본값: 28)
+ * @param props.fontWeight - 글자 굵기 (기본값: 'bold')
+ * @param props.color - 글자 색상 (기본값: 'grey900')
+ */
export function Title({
-  fontSize = 28,
+  fontSize = 28 as const,
  fontWeight = 'bold',
  color = 'grey900',
  ...props
}: ModalTitleProps) {
packages/ui/src/components/Modal/compounds/DoubleCTA/DoubleCTA.css.ts (1)

4-9: 반응형 디자인 고려 필요

고정된 마진 값(4rem)을 사용하고 있습니다. 테마 변수를 사용하여 일관성을 유지하는 것이 좋습니다.

export const doubleCta = style({
  width: '100%',
  display: 'flex',
  gap: vars.space[12],
-  marginTop: '4rem',
+  marginTop: vars.space[16],
});
packages/ui/src/components/Modal/Modal.css.ts (1)

4-12: z-index 관리 개선 필요

z-index 값이 하드코딩되어 있습니다. 테마나 상수로 관리하여 일관성을 유지하는 것이 좋습니다.

+ const Z_INDEX = {
+   overlay: 1000,
+   container: 1001,
+ } as const;

export const overlay = style({
  position: 'fixed',
  top: 0,
  left: 0,
  right: 0,
  bottom: 0,
  backgroundColor: 'rgba(0, 0, 0, 0.5)',
-  zIndex: 0,
+  zIndex: Z_INDEX.overlay,
});
packages/ui/src/components/Modal/compounds/DoubleCTA/DoubleCTA.tsx (2)

13-18: className이 props에 의해 덮어쓰여질 수 있습니다.

{...cancelProps}를 className 이전에 배치하여 사용자 정의 스타일이 기본 스타일을 덮어쓰지 않도록 하는 것이 좋습니다.

 <Button
-  size={cancelProps?.size ?? 'large'}
-  variant={cancelProps?.variant ?? 'terminal'}
-  className={styles.secondaryButtonStyle}
-  {...cancelProps}
+  {...cancelProps}
+  size={cancelProps?.size ?? 'large'}
+  variant={cancelProps?.variant ?? 'terminal'}
+  className={styles.secondaryButtonStyle}
 />

19-24: 동일한 이슈가 confirmProps에도 적용됩니다.

일관성을 위해 confirmProps에도 동일한 수정이 필요합니다.

 <Button
-  size={confirmProps?.size ?? 'large'}
-  variant={confirmProps?.variant ?? 'neutral'}
-  className={styles.ctaButtonStyle}
-  {...confirmProps}
+  {...confirmProps}
+  size={confirmProps?.size ?? 'large'}
+  variant={confirmProps?.variant ?? 'neutral'}
+  className={styles.ctaButtonStyle}
 />
packages/ui/src/components/Modal/FocusTrap.tsx (3)

24-25: focus 작업에 대한 오류 처리가 필요합니다.

focus() 메서드는 실패할 수 있으므로, try-catch 블록으로 감싸는 것이 좋습니다.

- firstFocusable?.focus();
+ try {
+   firstFocusable?.focus();
+ } catch (error) {
+   console.warn('포커스 설정 실패:', error);
+ }

27-43: handleTab 함수를 useCallback으로 메모이제이션하는 것이 좋습니다.

이벤트 핸들러를 메모이제이션하여 불필요한 재생성을 방지할 수 있습니다.

+ const handleTab = useCallback((event: KeyboardEvent) => {
- const handleTab = (event: KeyboardEvent) => {
    if (event.key !== 'Tab') return;

    if (event.shiftKey) {
      if (document.activeElement === firstFocusable) {
        event.preventDefault();
        lastFocusable?.focus();
      }
    } else {
      if (document.activeElement === lastFocusable) {
        event.preventDefault();
        firstFocusable?.focus();
      }
    }
- };
+ }, [firstFocusable, lastFocusable]);

50-52: focus 복원 작업에도 오류 처리가 필요합니다.

cleanup 시의 focus 작업도 try-catch로 처리하는 것이 안전합니다.

 if (previousActiveElement instanceof HTMLElement) {
-  previousActiveElement.focus();
+  try {
+    previousActiveElement.focus();
+  } catch (error) {
+    console.warn('포커스 복원 실패:', error);
+  }
 }
packages/ui/src/components/Modal/Modal.tsx (1)

20-66: JSDoc 문서를 더 개선할 수 있습니다.

다음 사항들을 추가하면 좋을 것 같습니다:

  • 각 서브컴포넌트의 사용 예시
  • 접근성 관련 정보
  • 키보드 인터랙션 가이드
packages/ui/src/components/Modal/ModalRoot.tsx (3)

9-54: 모달 Props에 유효성 검사 속성 추가 제안

모달의 접근성과 유효성을 향상시키기 위해 다음과 같은 추가 props를 고려해보세요:

  • aria-labelledby: 모달의 제목을 지정하는 요소의 ID
  • aria-describedby: 모달의 설명을 지정하는 요소의 ID

73-80: 키보드 접근성 개선 제안

현재 ESC 키 처리는 잘 구현되어 있습니다. 추가적인 접근성 향상을 위해 다음 키보드 이벤트 처리를 고려해보세요:

  • Tab 키: 모달 내부 포커스 순환
  • Enter/Space 키: 선택된 버튼 활성화

89-100: 스크롤 위치 관리 기능 추가 제안

현재 구현은 body 스크롤을 잘 관리하고 있습니다. 사용자 경험 향상을 위해 다음 기능을 추가하는 것을 고려해보세요:

  • 모달이 닫힐 때 이전 스크롤 위치로 복원
  • 긴 모달 컨텐츠를 위한 내부 스크롤 관리
apps/web/src/app/page.tsx (1)

116-116: 모달 트리거 버튼 개선 필요

버튼 구현을 다음과 같이 개선하여 사용자 경험을 향상시키세요:

  • 의미있는 버튼 텍스트 사용
  • 아이콘 추가로 시각적 피드백 제공
  • ARIA 레이블 추가
-<button onClick={openModal}>모달 열기</button>
+<Button
+  onClick={openModal}
+  leftAddon={<Icon name="warning" />}
+  aria-label="페이지 나가기 확인"
+>
+  페이지 나가기
+</Button>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e5f37d1 and 6d3beae.

📒 Files selected for processing (17)
  • apps/web/src/app/page.tsx (3 hunks)
  • packages/ui/src/components/Modal/Dimmer.tsx (1 hunks)
  • packages/ui/src/components/Modal/FocusTrap.tsx (1 hunks)
  • packages/ui/src/components/Modal/Modal.css.ts (1 hunks)
  • packages/ui/src/components/Modal/Modal.tsx (1 hunks)
  • packages/ui/src/components/Modal/ModalRoot.tsx (1 hunks)
  • packages/ui/src/components/Modal/compounds/CTA/CTA.css.ts (1 hunks)
  • packages/ui/src/components/Modal/compounds/CTA/CTA.tsx (1 hunks)
  • packages/ui/src/components/Modal/compounds/Description/Description.css.ts (1 hunks)
  • packages/ui/src/components/Modal/compounds/Description/Description.tsx (1 hunks)
  • packages/ui/src/components/Modal/compounds/DoubleCTA/DoubleCTA.css.ts (1 hunks)
  • packages/ui/src/components/Modal/compounds/DoubleCTA/DoubleCTA.tsx (1 hunks)
  • packages/ui/src/components/Modal/compounds/Icon/Icon.css.ts (1 hunks)
  • packages/ui/src/components/Modal/compounds/Icon/Icon.tsx (1 hunks)
  • packages/ui/src/components/Modal/compounds/Title/Title.css.ts (1 hunks)
  • packages/ui/src/components/Modal/compounds/Title/Title.tsx (1 hunks)
  • packages/ui/src/components/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • packages/ui/src/components/Modal/compounds/Icon/Icon.css.ts
  • packages/ui/src/components/Modal/compounds/Description/Description.css.ts
  • packages/ui/src/components/Modal/compounds/Title/Title.css.ts
🔇 Additional comments (4)
packages/ui/src/components/Modal/compounds/Description/Description.tsx (1)

7-10: 기본값 검증 및 타입 제한 필요

fontSize, fontWeight, color prop에 대한 타입 제한이나 유효성 검사가 없습니다. 특히 fontSize는 number 타입이므로 음수나 너무 큰 값이 들어올 수 있습니다.

다음과 같이 개선하는 것을 고려해보세요:

+ const MIN_FONT_SIZE = 12;
+ const MAX_FONT_SIZE = 32;
export function Description({
-  fontSize = 20,
+  fontSize = Math.min(Math.max(20, MIN_FONT_SIZE), MAX_FONT_SIZE),
  fontWeight = 'medium',
  color = 'grey500',
  ...props
}: ModalDescriptionProps)
packages/ui/src/components/index.ts (1)

42-49: 내보내기가 잘 구성되어 있습니다.

Modal 컴포넌트와 관련 타입들이 기존 패턴을 따라 잘 구성되어 있습니다.

packages/ui/src/components/Modal/Modal.tsx (1)

67-74: 컴포넌트 구성이 잘 되어있습니다.

Compound 컴포넌트 패턴을 활용하여 모달의 각 부분을 잘 모듈화했습니다.

apps/web/src/app/page.tsx (1)

76-103: 🛠️ Refactor suggestion

모달 오류 처리 및 사용자 경험 개선 필요

현재 구현은 기본적인 기능을 잘 수행하고 있습니다. 다음 개선사항을 고려해보세요:

  • 모달 닫기 전 사용자 입력 데이터 저장 처리
  • 네트워크 오류 등의 예외 상황 처리
  • 모달 상태 변경 시 로딩 상태 표시
 confirmProps={{
   children: '나가기',
   onClick: () => {
+    try {
+      // 임시 저장 로직
+      saveTemporaryData();
       close();
+    } catch (error) {
+      // 오류 처리
+      handleError(error);
+    }
   },
 }}

Likely invalid or redundant comment.

Comment on lines +7 to +19
export const CTA = forwardRef<HTMLButtonElement, ModalCTAProps>(
({ size = 'large', variant = 'neutral', ...props }, ref) => (
<div className={styles.cta}>
<Button
ref={ref}
size={size}
variant={variant}
className={styles.buttonStyle}
{...props}
/>
</div>
)
);
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

접근성 개선 필요

CTA 버튼에 대한 접근성 속성이 부족합니다. 스크린 리더 사용자를 위해 aria-label이나 aria-describedby 속성을 추가하는 것이 좋습니다.

또한, div 래퍼가 불필요할 수 있습니다. 스타일링만을 위해 추가된 div는 DOM을 복잡하게 만들 수 있습니다.

export const CTA = forwardRef<HTMLButtonElement, ModalCTAProps>(
  ({ size = 'large', variant = 'neutral', ...props }, ref) => (
-    <div className={styles.cta}>
      <Button
        ref={ref}
        size={size}
        variant={variant}
-       className={styles.buttonStyle}
+       className={`${styles.cta} ${styles.buttonStyle}`}
+       aria-label={props.children?.toString()}
        {...props}
      />
-    </div>
  )
);

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +11 to +29
export const ctaButtonStyle = style({
width: '100%',
borderRadius: '1.2rem',
color: vars.colors.grey,
backgroundColor: vars.colors.grey950,
fontSize: vars.typography.fontSize[20],
fontWeight: vars.typography.fontWeight.semibold,
height: '7.2rem',
});

export const secondaryButtonStyle = style({
width: '100%',
borderRadius: '1.2rem',
color: vars.colors.grey1000,
backgroundColor: vars.colors.grey50,
fontSize: vars.typography.fontSize[20],
fontWeight: vars.typography.fontWeight.semibold,
height: '7.2rem',
});
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

모바일 대응 필요

버튼의 높이와 너비가 고정값으로 설정되어 있어 모바일 환경에서 문제가 될 수 있습니다. 반응형 단위를 사용하거나 미디어 쿼리를 추가하는 것이 좋습니다.

export const ctaButtonStyle = style({
  width: '100%',
  borderRadius: '1.2rem',
  color: vars.colors.grey,
  backgroundColor: vars.colors.grey950,
  fontSize: vars.typography.fontSize[20],
  fontWeight: vars.typography.fontWeight.semibold,
-  height: '7.2rem',
+  minHeight: '7.2rem',
+  '@media': {
+    'screen and (max-width: 768px)': {
+      minHeight: '5.6rem',
+    }
+  }
});
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const ctaButtonStyle = style({
width: '100%',
borderRadius: '1.2rem',
color: vars.colors.grey,
backgroundColor: vars.colors.grey950,
fontSize: vars.typography.fontSize[20],
fontWeight: vars.typography.fontWeight.semibold,
height: '7.2rem',
});
export const secondaryButtonStyle = style({
width: '100%',
borderRadius: '1.2rem',
color: vars.colors.grey1000,
backgroundColor: vars.colors.grey50,
fontSize: vars.typography.fontSize[20],
fontWeight: vars.typography.fontWeight.semibold,
height: '7.2rem',
});
export const ctaButtonStyle = style({
width: '100%',
borderRadius: '1.2rem',
color: vars.colors.grey,
backgroundColor: vars.colors.grey950,
fontSize: vars.typography.fontSize[20],
fontWeight: vars.typography.fontWeight.semibold,
minHeight: '7.2rem',
'@media': {
'screen and (max-width: 768px)': {
minHeight: '5.6rem',
}
}
});
export const secondaryButtonStyle = style({
width: '100%',
borderRadius: '1.2rem',
color: vars.colors.grey1000,
backgroundColor: vars.colors.grey50,
fontSize: vars.typography.fontSize[20],
fontWeight: vars.typography.fontWeight.semibold,
height: '7.2rem',
});

Comment on lines +14 to +27
export const container = style({
position: 'fixed',
top: '50%',
left: '50%',
backgroundColor: vars.colors.grey,
borderRadius: '2.4rem',
padding: `5.2rem ${vars.space[24]} ${vars.space[24]} ${vars.space[24]}`,
zIndex: 1,
width: '56rem',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
transformOrigin: 'center',
});
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

모달 위치 지정 오류

fixed position과 50% 위치 지정만으로는 모달이 정확히 중앙에 위치하지 않습니다. transform 속성을 추가해야 합니다.

export const container = style({
  position: 'fixed',
  top: '50%',
  left: '50%',
+ transform: 'translate(-50%, -50%)',
  backgroundColor: vars.colors.grey,
  borderRadius: '2.4rem',
  padding: `5.2rem ${vars.space[24]} ${vars.space[24]} ${vars.space[24]}`,
- zIndex: 1,
+ zIndex: Z_INDEX.container,
  width: '56rem',
+ maxWidth: '90vw',
  display: 'flex',
  flexDirection: 'column',
  alignItems: 'center',
  transformOrigin: 'center',
});

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +102 to +128
return (
<AnimatePresence onExitComplete={onExited}>
{open && (
<>
{showDimmer && <Dimmer onClick={handleDimmerClick} />}
<FocusTrap>
<motion.div
ref={ref}
className={styles.container}
initial={{ opacity: 0, scale: 0.9, x: '-50%', y: '-50%' }}
animate={{ opacity: 1, scale: 1, x: '-50%', y: '-50%' }}
exit={{ opacity: 0, scale: 0.9, x: '-50%', y: '-50%' }}
transition={{ duration: 0.15 }}
role="dialog"
aria-modal="true"
tabIndex={-1}
>
{icon}
<div className={styles.content}>{children}</div>
{cta}
{doubleCTA}
</motion.div>
</FocusTrap>
</>
)}
</AnimatePresence>
);
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

접근성 속성 보완 필요

현재 구현된 기본적인 ARIA 속성은 좋습니다. 다음 접근성 개선사항을 고려해보세요:

  • aria-label 또는 aria-labelledby 속성 추가
  • 모달 열림/닫힘 상태 변경 시 스크린 리더 알림
 <motion.div
   ref={ref}
   className={styles.container}
   initial={{ opacity: 0, scale: 0.9, x: '-50%', y: '-50%' }}
   animate={{ opacity: 1, scale: 1, x: '-50%', y: '-50%' }}
   exit={{ opacity: 0, scale: 0.9, x: '-50%', y: '-50%' }}
   transition={{ duration: 0.15 }}
   role="dialog"
   aria-modal="true"
+  aria-label={title}
+  aria-describedby="modal-description"
   tabIndex={-1}
 >

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Member

@kongnayeon kongnayeon left a comment

Choose a reason for hiding this comment

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

LGTM 고생하셨습니다~

@minseong0324 minseong0324 merged commit b5d0112 into develop Jan 23, 2025
3 of 7 checks passed
@minseong0324 minseong0324 deleted the feat/#0e09f1da2 branch January 23, 2025 22:17
kongnayeon added a commit that referenced this pull request Feb 5, 2025
* [Feat] 프로젝트 스캐폴딩 (#2)

* docs: 이슈, PR 템플릿 추가

* docs: codeoners 추가

* feat: web 앱 Next.js, React 버전 다운그레이드

* feat: eslint, tsconfig 종속성, prettier 추가

* feat: husky, lint-staged 설치

* feat: husky, lint-staged 테스트

* chore: husky, lint-staged 테스트

* chore: husky, lint-staged 테스트 2

* fix: eslint config 수정

* chore: husky, lint-staged 테스트 3

* chore: husky, lint-staged 테스트 4

* chore: husky, lint-staged 테스트 5

* feat: .nvmrc 추가

* feat: vanilla extract 설치, config 수정

* chore: web 앱 type: module 설정 제거

* chore: vanilla extract 설치, next.config.js 수정

* [Chore]: 리뷰어 선정 시 슬랙 알림 workflow 적용 (#33)

* [Chore]: ui 패키지 초기 셋팅 (#34)

* feat(packages/theme): theme 패키지를 생성해요. (#36)

* [Chore]: build ci 추가 (#38)

* feat: pnpm workspace 추가 (#42)

* [Fix]: theme, ui 패키지의 vanilla-extract 빌드 설정 수정 (#45)

* fix(apps/web, packages/theme, packages/ui): theme, ui 패키지의 vanilla-extract 빌드 설정, css 관련 수정

* chore(packages/theme, packages/ui): build 스크립트 수정

* chore(packages/theme, packages/ui): exports 수정

* chore(packages/theme, packages/ui): exports 수정

* wip

* chore(packages/theme, packages/ui): 불필요 dependency 제거

* chore(packages/theme, packages/ui): 불필요 필드 제거

* fix: 공통 패키지 루트로 끌어올리기, 패키지 버전 의존성 적용

* fix: 테스트 컴포넌트 제거

* fix: 테스트 컴포넌트 제거

* chore(apps/web): 주석처리

* chore: 빌드 테스트

* chore: 테스트용 컴포넌트 제거

---------

Co-authored-by: kangnayeon <[email protected]>

* [Feat]: theme 적용을 위한 Provider 추가 (#47)

* [Feat] Spacing 컴포넌트 추가 (#49)

* [Feat] Icon 컴포넌트 추가 (#48)

* feat(packages/ui): Icon 컴포넌트 추가

* fix(packages/ui): 아이콘 속성 camelCase로 수정

* feat(packages/ui): svg 파일 import 스크립트, svgr 플러그인 설정 추가

* feat(packages/ui): Icon 컴포넌트

* fix(packages/theme): color 뎁스 낮추기

* [Feat] Spacing 컴포넌트 추가 (#49)

* fix: resolve conflicts

* fix(packages/theme): 컬러 토큰 변경에 따른 dark, theme 토큰 변경

* fix: resolve conflicts

* chore: 주석 제거

---------

Co-authored-by: minseong <[email protected]>

* [Fix] Icon 컴포넌트 수정 (#51)

* fix(packages/ui): Icon 컴포넌트 수정

* chore(packages/ui): 색상 스타일 로직 개선

* fix(packages/ui): IconProps의 color 타입을 string으로 수정해요

* [Fix] 컬러 시스템 내의 색상만 사용할 수 있도록 Icon 컴포넌트 수정 (#53)

* fix(packages/ui): Icon 컴포넌트 수정

* chore(packages/ui): 색상 스타일 로직 개선

* fix(packages/ui): IconProps의 color 타입을 string으로 수정해요

* fix(packages/ui, apps/web): 컬러 시스템 내의 색상만 사용할 수 있도록 Icon 컴포넌트 수정

* [Fix] Spacing 컴포넌트 수정 (#54)

* fix(packages/ui): Spacing 컴포넌트 수정

* chore: name import 하도록 수정

* chore: 배럴 파일 수정

* chore: empty file 삭제

* chore(packages/theme): 색상 추가 (#56)

* [Feat] Text 컴포넌트 추가 (#57)

* feat(packages/ui): Text 컴포넌트

* feat(packages/ui): 컴파운드 객체 추가

* chore(packages/ui): TypographyType theme에서 가져오도록 수정

* fix(packages/ui): TextCompoundType 선언 시 중복되는 구문 수정

* fix(packages/ui): Compound Text 컴포넌트 선언 시 중복되는 로직 수정

* feat(packages/ui): Text 컴포넌트 사용 시 대문자 사용하도록 수정

* [Feat] Toast 컴포넌트 추가 (#52)

* chore(packages/ui): ovarlay-kit 의존성 추가

* feat(packages/ui): Toast 컴포넌트 구현

* test(apps/web): Toast 컴포넌트 사용 예시 추가

* fix(packages/ui): 접근성 개선

* chore(packages/ui): lock 파일 업데이트

* chore(packages/themes): violet 색상 추가

* chore(packages/ui): success일 경우의 색상 변경

* fix(apps/web): Providers 컴포넌트 분리, OverlayProvider 이동

* [Feat] Badge 컴포넌트 구현 (#58)

* feat(packages/ui, apps/web): Badge 컴포넌트 구현

* fix(packages/ui, apps/web): Badge 컴포넌트 수정

* chore(packages/ui): named import 변경

* [Feat] Checkbox 컴포넌트 추가 (#60)

* feat(packages/ui): 누름 상태 관리를 위한 usePress 추가

* chore(packages/ui): 체크박스 아이콘 추가

* feat(packages/ui): 체크박스 컴포넌트 추가

* chore(apps/web): 사용 예시 추가

* fix(packages/ui): 키보드 접근성 수정

* [Feat] Label 컴포넌트 구현 (#61)

* feat(packages/ui): Label 컴포넌트 구현

* chore(packages/ui): Label 컴포넌트 예시

* [Feat] Button 컴포넌트 추가 (#59)

* feat(packages/ui): Button 컴포넌트

* fix(packages/ui): Icon color 속성 없을 시 currentColor 적용되도록 수정

* chore(packages/ui): Button 컴포넌트 export

* fix(packages/ui): Button 컴포넌트 스타일

* fix(packages/ui): Icon default size 100%로 변경

* fix(packages/ui): Button 컴포넌트의 leftIcon, rightIcon prop을 leftAddon, rightAddon으로 수정

* feat(packages/ui): twincle icon 추가

* fix(packages/ui): 기존 태그의 prop을 상속 받는 경우 ComponentPropsWithoutRef 사용하도록 수정

* [Feat] Breadcrumb 컴포넌트 추가 (#62)

* chore(packages/ui): @radix-ui/react-slot 설치

* feat(packages/ui): Breadcrumb 컴포넌트 구현

* test(apps/web): 사용 예시 추가

* [Feat] px -> rem 변환 (#64)

* fix: px 단위 rem으로 변환

* fix: body font-size 1.6rem으로 지정

* [Chore] Checkbox 컴포넌트의 label fontSize 변환 (#66)

* chore(packages/ui):  Checkbox 컴포넌트의 label fontSize 변환

* chore(packages/ui): className 빈 값 string 기본값 지정

* [Feat] LottieAnimation 컴포넌트 추가 (#63)

* feat(packages/ui): 로티 파일, 생성 스크립트 추가

* feat(packages/ui): LottieAnimation 컴포넌트 추가

* fix(packages/ui): LottieAnimation 따로 export 하도록 수정, 에셋 상대경로로 수정

* fix(packages/ui): 스크립트 오타 수정

* feat(packages/ui): 코드리뷰 반영

* fix: 빌드 에러 수정

* [Feat] TextField 컴포넌트 구현 (#65)

* chore(apps/web): react-hook-form 설치

* feat(packages/ui): isNill 함수 추가

* chore(packages/ui): isNill export

* feat(packages/ui): TextField 컴포넌트 구현

* test(apps/web): 예시 추가

* fix(packages/ui): 디자인 요구사항 수정

* [Feat] 아이콘, 색상 변경 사항 반영 (#72)

* feat(packages/theme): 아이콘 변경 사항 반영

* fix(packages/ui): 누락된 아이콘 추가

* [Feat] IconButton 컴포넌트 (#68)

* [Feat] Spinner 컴포넌트 추가 (#69)

* feat(packages/ui): Spinner 컴포넌트

* feat(packages/ui): Spinner span 태그로 감싸기

* fix(packages/ui): SpinnerColorType 추가

* [�Fix]: ThemeProvider 패키지 이동, 불필요 배럴 파일 정리 (#74)

* wip

* chore(apps/web): 파일 구조 변경

* chore(packages/theme, apps/web): 배럴파일 정리 및 provider 별도 export

* chore(packages/theme): provider 별도 export

* fix(packages/theme, packages/ui): ThemeProvider 이동

* remove(apps/web): 퍼블리싱 삭제 (별도 PR 예정)

* [Feat] RadioCards 컴포넌트 추가 (#73)

* feat(packages/ui): RadioCards 관리를 위한 context 추가

* feat(packages/ui): RadioCards 컴포넌트 구현 및 JSDoc 추가

* feat(packages/ui): RadioCards 사용 예시 추가

* fix(packages/ui): RadioCards 구조 변경

* test(packages/ui): RadioCards 예시 변경

* docs(packages/ui): JSDoc 업데이트

* fix(packages/ui): 키보드 접근성 개선

* [Feat] Modal 컴포넌트 추가 (#83)

* feat(packages/ui): PortalConsumer 컴포넌트

* feat(packages/ui): PortalConsumer 컴포넌트

* feat(packages/ui): Modal로의 포커스를 위한 FocusTrap 구현

* feat(packages/ui): Modal 컴포넌트 구현 및 JSDoc 작성

* test(apps/web): Modal 컴포넌트 사용 예시 추가

* fix(packages/ui): overlay-kit에서 이미 제공하고 있으므로 PortalConsumer 제거

* [Feat] 스켈레톤 컴포넌트 (#84)

* feat(packages/ui): 스켈레톤 컴포넌트

* feat: displayName 속성 추가

* feat: 리뷰 반영

* [Fix] ui 패키지 컴포넌트 사용 시 모든 컴포넌트가 암묵적으로 import 되는 현상 (#79)

* fix(packages/ui): 아이콘 생성 스크립트 확장자 변경

* feat(packages/ui) 컴포넌트 별 배럴 파일 생성

* fix: 공통 로직 임포트 경로 수정

* fix(packages/ui): esm 방식만 지원하도록 수정

* chore: 사용되지 않는 컴포넌트 제거

* chore: 사용되지 않는 아이콘 제거

* fix(packages/ui): 사용되지 않는 플러그인 제거

* fix: 빌드 에러

* fix: 빌드 에러

* fix: 빌드 에러 수정

* feat: svgr 라이브러리 제거, 아이콘 컴포넌트 생성 스크립트 추가

* fix: build error

* fix: icon 매핑 스크립트 수정

* feat(packages/ui): 컴포넌트 전체 export 추가

* [Feat] Chip 컴포넌트 추가 (#70)

* feat(packages/ui): chip 컴포넌트

* [Feat] TextField 컴포넌트 구현 (#65)

* chore(apps/web): react-hook-form 설치

* feat(packages/ui): isNill 함수 추가

* chore(packages/ui): isNill export

* feat(packages/ui): TextField 컴포넌트 구현

* test(apps/web): 예시 추가

* fix(packages/ui): 디자인 요구사항 수정

* [Feat] 아이콘, 색상 변경 사항 반영 (#72)

* feat(packages/theme): 아이콘 변경 사항 반영

* fix(packages/ui): 누락된 아이콘 추가

* feat(packages/ui): chip 컴포넌트

* feat(packages/ui): Chip에 사용되는 아이콘 추가

* fix(packages/ui): Text 컴포넌트 color prop 없을 때 inherit으로 지정, 기본 line height 값 지정

* fix(packages/ui): Icon 컴포넌트 color 상속 시 path 태그 외의 다른 태그들도 상속 받을 수 있도록 수정

* fix(packages/ui): Chip 컴포넌트 스타일 수정

* feat: x 아이콘 color 수정

* feat: onClose 추가

* fix: x 아이콘 호버링 시 cursor pointer로 지정

* feat: 리뷰 반영

* fix(packages/ui):  closable 버튼 보이지 않는 문제

* fix: 리뷰 반영

---------

Co-authored-by: MINSEONG KIM <[email protected]>

* [Refactor] Spinner 컴포넌트 css 방식으로 변경 (#92)

* fix:(packages/ui): Spinner 컴포넌트 css 방식으로 구현

* fix(packages/ui): Button 컴포넌트 스타일 수정, isLoading 상태 스피너 추가

* [Feat] useToast 추가, DynamicLottie 컴포넌트 추가 (#89)

* [Feat]: useModal 추가 (#91)

* chore(packages/ui): overlay-kit 설치

* feat(packages/ui): useModal 추가

* test(apps/web): useModal 사용 예시 추가

* fix(packages/ui): 옵셔널로 치환

* fix(packages/ui): 자잘한 수정

* fix(packages/ui): 자잘한 수정

* docs(packages/ui): JSDoc 추가

* test(apps/web): 사용 예시 추가

* chore(packages/ui): 코드 간소화

* fix(packages/ui): 프로미스를 반환할 수 있도록 수정

* fix(packages/ui): isNil수정, isNotNill 추가, export 수정

* fix(package/ui): nullish 체크

* fix(packages/ui): 모달 doubleCTA의 각각 버튼 공간이 절반 차지하도록 수정

* test(packages/ui): 예시 수정

* chore: lock 파일 업데이트

* [Feat] ImageManager TypeA 컴포넌트 추가 (#94)

* chore(apps/web): Provider -> provider로 변경 (네이밍 컨벤션 통일)

* feat(apps/web): ImageManager TypeA 컴포넌트 구현

* chore(apps/web): 대소문자 git 이슈 해결

* chore(apps/web): baseUrl 설정

* fix(apps/web): 자잘한 수정, 접근성 개선

* chore(apps/web): 키 상수화

* fix(apps/web): 유효성 검사 수정

* chore(apps/web): 경로 수정

* [Feat] 주제 설정 페이지 퍼블리싱 및 폼 연동 (#95)

* chore(apps/web): motion 추가

* chore(packages/ui): styles export 변경

* feat(packages/theme): 색상 추가

* feat(packages/theme): spacing 추가

* feat(apps/web): KeywordChip 컴포넌트 추가

* feat(apps/web): ImageManager 컴포넌트 추가

* feat(apps/web): 주제 설정 페이지 퍼블리싱

* refactor(apps/web): 컴포넌트 분리 및 자잘한 수정

* fix(apps/web): react-hook-form watch를 통한 조건부 렌더링

* feat(apps/web): react-hook-form을 통한 폼 관리

* fix(apps/web): ImageManager 컴포넌트 packages/ui로 이동 예정

* fix(apps/web): ImageManager TypeA css 수정

* fix(apps/web): GradientAnimatedTitle로 수정

* fix(apps/web): GradientAnimatedTitle로 수정

* feat(apps/web): isEmptyStringOrNil 유틸 추가

* fix(apps/web): ImageManager TypeA 제어형으로 사용 가능하도록 변경

* refactor(apps/web): 컴포넌트 분리

* chore(apps/web): px->rem 변경

* fix(app/web): defaultValues 수정

* fix(apps/web): css 수정

* fix(apps/web): placeholder 수정

* [Feat] ky, tanstack-query 설정, presigned-url 모듈, 뉴스 카테고리 api 연동 (#97)

* fix(packages/ui): onClick 누락 수정

* fix(packages/ui): onClick 누락 수정

* feat(apps/web): 필수 항목 입력 후 홈 BreadCrumb 클릭 시 모달

* feat(apps/web): tanstack-query 셋팅

* fix(apps/web): tanstack-query 셋팅 수정

* feat(apps/web): ky 셋팅

* fix(apps/web): KeywordChipGroup 컴포넌트 수정

* feat(apps/web): 뉴스 카테고리 api 연듕

* feat(apps/web): put, patch, delete 추가

* feat(apps/web): put, patch, delete 추가

* fix(apps/web): nullish 검증

* chore(.github/workflows): env 추가

* fix(apps/web): staleTime, gcTime 수정

* fix(apps/web): 자잘한 수정

* fix(apps/web): 토큰 string으로 관리

* chore(apps/web): shared로 폴더명 변경

* feat(apps/web): presigned-url 모듈 구현 및 연동

* [Feat] 주제 설정 페이지 api 연동, 디자인 추가 반영 (#100)

* fix(apps/web): MainBreadcrumbItem 이미지 수정

* fix(apps/web): suspense 래핑

* remove(apps/web): 불필요 코드 제거

* feat(apps/web): 스크롤 감지 훅 추가

* feat(apps/web): 반투명 NavBar 추가

* fix(apps/web): 스타일링 수정

* fix(apps/web): 스타일링 수정

* fix(apps/web): ImageManager TypeA가 File이 아닌 이미지의 url로 받도록 수정

* feat(apps/web): 공통 타입 분리

* feat(apps/web): 게시물 그룹 및 게시물 생성 API 연동

* feat(apps/web): ImageManager TypeA 최적화 및 UI만 그리도록 관심사 분리

* fix: Images 폴더명을 images로 수정

* fix(apps/web): 자잘한 수정

* fix(apps/web): 자잘한 수정

* fix(apps/web): 타입 개선

* fix(apps/web): ImageManager 단일로 관리

* [Feat] Accordion 컴포넌트 (#99)

* fix(packages/ui): Chip 컴포넌트 개별 export

* feat(packages/ui): Accordion 컴포넌트

* chore: Accordion 컴포넌트 예시 추가

* chore(packages/ui): displayName 추가

* fix: 코드리뷰 반영

* fix: resolve conflicts

* [Fix] 컴포넌트 스타일 수정 (#102)

* fix: 폴더명 Images를 images로 변경

* fix(apps/web): 간단한 레이아웃 수정

* fix(apps/web): NavBar 레이아웃 수정

* fix(packages/ui, apps/web): TextField 레이아웃 깨짐 수정

* fix(packages/ui): Checkbox width 수정

* docs(packages/ui): TextField JSDoc 수정

* [Feat]  결과 수정 - 상세 페이지 퍼블리싱 (#86)

* feat(apps/web): ContentItem 컴포넌트

* feat(apps/web): getMinutesAgo 유틸 함수 추가

* feat(apps/web): ContentItem 컴포넌트

* fix(packages/ui): Chip 컴포넌트 개별 export

* feat(packages/ui): Accordion 컴포넌트

* chore: Accordion 컴포넌트 예시 추가

* feat(apps/web): EditSidebar 추가

* feat(packages/ui): 아이콘 에셋  추가

* fix(apps/web): getMinutesAgo 함수 getTimesAgo 함수로 수정

* fix(packages/ui): IconButton 컴포넌트 props에서 type도 받도록 수정

* fix(apps/web): ContentItem 컴포넌트 디자인 수정 반영

* feat(apps/web): PostEditor 추가

* feat(apps/web): EditPromptField 추가

* feat(apps/web) EditPost 영역 추가

* feat(apps/web): ContentItem 컴포넌트

* chore: Accordion 컴포넌트 예시 추가

* fix: resolve conflicts

* fix: resolve conflicts

* fix: 빌드 에러

* fix: 빌드 에러

* fix(apps/web): TextField 수정 반영

* fix(packages/ui): Accordion 컴포넌트 스타일 수정

* [Feat] vercel 자동 배포 빌드 스크립트 (#105)

---------

Co-authored-by: MINSEONG KIM <[email protected]>
Co-authored-by: minseong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants