-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from MovieReviewComment/feature/issue-162/imp…
…rove-userchip [#162] Improve UserChip
- Loading branch information
Showing
6 changed files
with
108 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use client'; | ||
|
||
import clsx from 'clsx'; | ||
import { ReactNode } from 'react'; | ||
|
||
// TODO: make it generic | ||
export default function ChipButton({ | ||
onClick, | ||
Text, | ||
Icon, | ||
rounded, | ||
type = 'button', | ||
width, | ||
}: { | ||
Text: ReactNode; | ||
Icon?: ReactNode; | ||
onClick?: () => void; | ||
rounded: 'full' | 'lg'; | ||
type?: 'button' | 'submit'; | ||
width: 'fit' | 'full'; | ||
}) { | ||
const roundClass = clsx({ 'rounded-lg': rounded === 'lg', 'rounded-full': rounded === 'full' }); | ||
const widthClass = clsx({ 'w-full': width === 'full', 'w-fit': width === 'fit' }); | ||
|
||
return ( | ||
<button | ||
className={clsx( | ||
'flex items-center space-x-1 px-2 py-1 hover:bg-gray-100', | ||
roundClass, | ||
widthClass | ||
)} | ||
onClick={onClick} | ||
type={type} | ||
> | ||
{Icon} | ||
{Text} | ||
</button> | ||
); | ||
} |
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
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,16 @@ | ||
import { useRouter } from 'next/navigation'; | ||
|
||
// TODO: consider to make it more generic by using useSearchParams | ||
export function useSearchMore(nickname: string) { | ||
const params = new URLSearchParams(); | ||
params.set('nickname', nickname); | ||
|
||
const createURL = (pathname: 'review' | 'comment') => `/${pathname}?${params.toString()}`; | ||
|
||
const router = useRouter(); | ||
|
||
const saerchMoreReview = () => router.push(createURL('review')); | ||
const saerchMoreComment = () => router.push(createURL('comment')); | ||
|
||
return { saerchMoreReview, saerchMoreComment }; | ||
} |