Skip to content

Commit

Permalink
Merge pull request #8 from wafflestudio/feat/common
Browse files Browse the repository at this point in the history
Feat/common
  • Loading branch information
jwchoi-kr authored Feb 3, 2025
2 parents 5937977 + 64e074e commit 55e9a1f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 4 deletions.
31 changes: 31 additions & 0 deletions src/components/InfoCard/InfoDetail.tsx
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;
35 changes: 35 additions & 0 deletions src/components/InfoCard/Tag.tsx
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;
7 changes: 3 additions & 4 deletions src/components/common/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ import React from 'react';
type ButtonProps = {
theme?: 'gray' | 'green' | 'red';
size?: 'small' | 'large';
className?: string;
} & React.ButtonHTMLAttributes<HTMLButtonElement>;

const Button: React.FC<ButtonProps> = ({
const Button = ({
children,
theme = 'gray', // 기본값 gray
size = 'small', // 기본값 small
className = '',
disabled,
...props
}) => {
}: ButtonProps) => {
const baseStyles = 'transition-all font-pmedium';
const disabledStyles = 'bg-backgroundGray text-textGray1';

// theme에 따른 스타일 설정
const buttonTheme = {
gray: 'bg-textGray1 text-backgroundWhite hover:bg-textGray2',
green: 'bg-pointColor text-titleBlack hover:bg-backgroundGreen',
red: 'bg-[#E7564C] text-backgroundWhite hover:bg-[#D04338]',
};

// size에 따른 스타일 설정
const sizeStyles = {
small:
'h-[21px] px-[6px] py-[4px] text-[11px] rounded-[30px] leading-[13.13px]',
Expand Down

0 comments on commit 55e9a1f

Please sign in to comment.