-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: 로그인 Link 컴포넌트 추가 * fix: kakao login base url 상수파일에서 import하도록 수정
- Loading branch information
Showing
6 changed files
with
48 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
import Link from 'next/link'; | ||
|
||
import { KAKAO_LOGIN_URL } from '@/constants'; | ||
|
||
import BottomActionButton from '@/components/common/BottomActionButton'; | ||
import LoginLink from '@/components/common/LoginLink'; | ||
|
||
const LoginBottomActionButton = () => ( | ||
<Link href={KAKAO_LOGIN_URL}> | ||
<LoginLink> | ||
<BottomActionButton>로그인 및 회원가입</BottomActionButton> | ||
</Link> | ||
</LoginLink> | ||
); | ||
|
||
export default LoginBottomActionButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use client'; | ||
|
||
import type { ComponentPropsWithRef, PropsWithChildren } from 'react'; | ||
import Link from 'next/link'; | ||
import { usePathname } from 'next/navigation'; | ||
|
||
import { SEARCH_PARAMS_KEYS } from '@/constants/key'; | ||
import { KAKAO_LOGIN_BASE_URL } from '@/constants/url'; | ||
import { createQueryString } from '@/utils/url'; | ||
|
||
type LoginLinkProps = Omit<ComponentPropsWithRef<typeof Link>, 'href'>; | ||
|
||
const LoginLink = ({ | ||
children, | ||
replace = true, | ||
...props | ||
}: PropsWithChildren<LoginLinkProps>) => { | ||
const pathname = usePathname(); | ||
const search = createQueryString({ | ||
...(pathname && { [SEARCH_PARAMS_KEYS.REDIRECT_PATHNAME]: pathname }), | ||
}); | ||
|
||
return ( | ||
<Link | ||
href={`${KAKAO_LOGIN_BASE_URL}${search}`} | ||
replace={replace} | ||
{...props} | ||
> | ||
{children} | ||
</Link> | ||
); | ||
}; | ||
|
||
export default LoginLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters