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: 소셜 연동 로그인 버튼 및 로그인 요청 모달 #1022

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions frontend/src/assets/githubWhiteLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions frontend/src/components/common/GithubLoginButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import GithubWhiteLogoIcon from '@/assets/githubWhiteLogo.svg';
import { LoginButtonStyleProps } from '@/components/common/LoginButton';
import { LoginButton } from '@/components/index';

interface GithubLoginButtonProps extends LoginButtonStyleProps {
handleClick: () => void;
}

const GithubLoginButton = ({ handleClick, $logoStyle, $style }: GithubLoginButtonProps) => {
return (
<LoginButton
platform="깃허브"
engPlatform="github"
handleClick={handleClick}
logoSrc={GithubWhiteLogoIcon}
$logoStyle={$logoStyle}
$style={$style}
></LoginButton>
);
};

export default GithubLoginButton;
43 changes: 43 additions & 0 deletions frontend/src/components/common/LoginButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Button } from '@/components/index';
import { calculateParticle } from '@/utils';

import * as S from './styles';

interface LoginButtonProps extends LoginButtonStyleProps {
platform: string;
engPlatform?: string;
logoSrc: string;
handleClick: () => void;
}

export interface LoginButtonStyleProps {
$logoStyle?: React.CSSProperties;
$style?: React.CSSProperties;
}

const LoginButton = ({
platform,
engPlatform,
logoSrc,
handleClick,
$logoStyle,
$style,
}: LoginButtonProps) => {
return (
<Button onClick={handleClick} styleType="primary" style={$style}>
<S.ButtonLabelContainer>
<S.LogoImg src={logoSrc} alt={`${platform} 로고`} $logoStyle={$logoStyle} />
<span>
{engPlatform || platform}
{calculateParticle({
target: platform,
particles: { withFinalConsonant: '으로', withoutFinalConsonant: '로' },
})}{' '}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

로그인하기 앞에 띄어쓰기를 하는 방법으로 구현할 수 있지만 공백이 명시적으로 있다는 것을 표현하기 위해 {' '} 를 사용했습니다.

로그인하기
</span>
</S.ButtonLabelContainer>
</Button>
);
};

export default LoginButton;
16 changes: 16 additions & 0 deletions frontend/src/components/common/LoginButton/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import styled from '@emotion/styled';

import { LoginButtonStyleProps } from './index';

export const ButtonLabelContainer = styled.div`
display: flex;
gap: 0.8rem;
align-items: center;
`;

export const LogoImg = styled.img<Omit<LoginButtonStyleProps, '$style' >>`
width: 3.2rem;
height: 3.2rem;

${({ $logoStyle }) => $logoStyle && { ...$logoStyle }};
`;
2 changes: 2 additions & 0 deletions frontend/src/components/common/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export { default as Toast } from './Toast';

export { default as OptionSwitch } from './OptionSwitch';
export { default as ReviewEmptySection } from './ReviewEmptySection';
export { default as GithubLoginButton } from './GithubLoginButton';
export { default as LoginButton } from './LoginButton';
export * from './modals';
1 change: 1 addition & 0 deletions frontend/src/components/common/modals/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as ConfirmModal } from './ConfirmModal';
export { default as AlertModal } from './AlertModal';
export { default as ErrorAlertModal } from './ErrorAlertModal';
export { default as ContentModal } from './ContentModal';
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ContentModal, GithubLoginButton } from '@/components';

import * as S from './styles';

type LoginRequestTitleType = 'loginIntent' | 'membershipCheck';

interface LoginRequestModalProps {
titleType: LoginRequestTitleType;
closeModal: () => void;
}

const LoginRequestModal = ({ titleType, closeModal }: LoginRequestModalProps) => {
const getTitleLabel = (titleType: LoginRequestTitleType) => {
if (titleType === 'loginIntent') return '로그인하시겠어요?';
if (titleType === 'membershipCheck') return '회원이신가요?';
};

return (
<ContentModal title={getTitleLabel(titleType)} handleClose={closeModal} isClosableOnBackground={true} $style={{}}>
<S.LoginRequestModal>
<S.LoginRequestLabel>로그인 후 간편하게 받은 리뷰를 확인하세요!</S.LoginRequestLabel>
<GithubLoginButton
handleClick={() => {}}
$logoStyle={{ height: '3rem' }}
$style={{ fontSize: '1.3rem', height: '4rem', width: '100%' }}
/>
</S.LoginRequestModal>
</ContentModal>
);
};

export default LoginRequestModal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import styled from '@emotion/styled';

export const LoginRequestModal = styled.div`
display: flex;
flex-direction: column;
`;

export const LoginRequestLabel = styled.p`
margin-bottom: 1rem;
font-size: 1.4rem;
`;
Loading