-
Notifications
You must be signed in to change notification settings - Fork 0
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 #8 from wafflestudio/feat/common
Feat/common
- Loading branch information
Showing
3 changed files
with
69 additions
and
4 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,31 @@ | ||
type InfoDetailProps = { | ||
title: string; | ||
content: string | string[]; | ||
}; | ||
|
||
const InfoDetail = ({ title, content }: InfoDetailProps) => { | ||
return ( | ||
<div className="flex flex-col"> | ||
<div className="mb-3.5 font-psemibold text-[15px]">{title}</div>{' '} | ||
{/* title 아래 마진 14px */} | ||
{Array.isArray(content) ? ( | ||
<div className="flex flex-col gap-2.5"> | ||
{' '} | ||
{/* content 사이 gap 10px */} | ||
{content.map((item, index) => ( | ||
<div | ||
key={index} | ||
className="font-pmedium text-sm font-normal" | ||
> | ||
{item} | ||
</div> | ||
))} | ||
</div> | ||
) : ( | ||
<div className="font-pmedium text-sm font-normal">{content}</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default InfoDetail; |
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,35 @@ | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
type TagProps = { | ||
label: string; | ||
isPosition?: boolean; | ||
linkTo?: string; | ||
}; | ||
|
||
const Tag = ({ label, isPosition = false, linkTo }: TagProps) => { | ||
const navigate = useNavigate(); | ||
|
||
const baseStyles = | ||
'h-[26px] inline-block cursor-pointer rounded-md px-3 py-[5px] font-pmedium leading-[16.71px] transition-colors'; | ||
|
||
const colorStyles = isPosition | ||
? 'bg-black text-white' | ||
: 'bg-pointColor text-black hover:bg-backgroundGreen'; | ||
|
||
const handleClick = () => { | ||
if (linkTo) { | ||
navigate(linkTo); | ||
} | ||
}; | ||
|
||
return ( | ||
<div | ||
className={`${baseStyles} ${colorStyles} ${isPosition ? 'pointer-events-none' : ''}`} | ||
onClick={handleClick} | ||
> | ||
{label} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Tag; |
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