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

[FE] feat : 리뷰 생성 중 UI 구현 #1064

Merged
merged 5 commits into from
Jan 30, 2025
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
1 change: 1 addition & 0 deletions frontend/src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './highlight/components';
export * from './login';
export * from './reviewURL';
export * from './skeleton';
export * from './loading';
13 changes: 13 additions & 0 deletions frontend/src/components/loading/BlinkLoader/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

import { EssentialPropsWithChildren } from '@/types';

import * as S from './style';

interface BlinkLoaderProps extends EssentialPropsWithChildren, S.LoaderProps {}

const BlinkLoader = ({ children, $animationDurationTime }: BlinkLoaderProps) => {
return <S.Loader $animationDurationTime={$animationDurationTime}>{children}</S.Loader>;
Comment on lines +7 to +10
Copy link
Contributor

Choose a reason for hiding this comment

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

컴포넌트에서 받는 Props명은 $를 안 붙이고, style props명에만 $를 붙이기로 했던 것 같아요. 확정지었는지 기억이 확실치 않아서 코멘트 남겨요😅

Copy link
Contributor

Choose a reason for hiding this comment

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

children으로 더 많은 요소들이 올 수 있게 확장되어 다양하게 사용될 수 있을 것 같아요👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

컴포넌트에서 받는 Props명은 $를 안 붙이고, style props명에만 $를 붙이기로 했던 것 같아요. 확정지었는지 기억이 확실치 않아서 코멘트 남겨요😅

그런 논의가 있었는지 저도 잘 기억이 나지 않네요. 다만, 저번에 진행한 회원용 공통 UI 작업에서 스타일 컴포넌트의 props를 확장 받아서 사용하는 코드들이 있었고 스타일 Props의 별다를 props를 받는게 아니라서 스타일 컴포넌트 props를 확장받는 것으로 했어요.

만약 이 부분에 대한 코드 컨벤션 필요가 느껴진다면, 프론트 회의에서 논의해보죠

};

export default BlinkLoader;
15 changes: 15 additions & 0 deletions frontend/src/components/loading/BlinkLoader/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import styled from '@emotion/styled';

export interface LoaderProps {
$animationDurationTime?: string;
}

export const Loader = styled.div<LoaderProps>`
animation: l1 ${(props) => props.$animationDurationTime ?? '1s'} linear infinite alternate;

@keyframes l1 {
to {
opacity: 0;
}
}
`;
1 change: 1 addition & 0 deletions frontend/src/components/loading/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as BlinkLoader } from './BlinkLoader';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataForReviewRequestCode } from '@/apis/group';
import { Button } from '@/components';
import { Button, BlinkLoader } from '@/components';
import { HOM_EVENT_NAME } from '@/constants';
import { debounce, trackEventInAmplitude } from '@/utils';

Expand Down Expand Up @@ -42,7 +42,7 @@ const URLGeneratorButton = ({
onClick={handleURLCreationButtonClick}
disabled={!isFormValid && !mutation.isPending}
>
{mutation.isPending ? '리뷰 링크 생성 중...' : '리뷰 링크 생성하기'}
{mutation.isPending ? <BlinkLoader>리뷰 링크 생성 중...</BlinkLoader> : '리뷰 링크 생성하기'}
</Button>
);
};
Expand Down
Loading