-
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 #7 from wafflestudio/feat/common
Feat/common
- Loading branch information
Showing
32 changed files
with
695 additions
and
85 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,47 @@ | ||
import React from 'react'; | ||
|
||
type ButtonProps = { | ||
theme?: 'gray' | 'green' | 'red'; | ||
size?: 'small' | 'large'; | ||
} & React.ButtonHTMLAttributes<HTMLButtonElement>; | ||
|
||
const Button: React.FC<ButtonProps> = ({ | ||
children, | ||
theme = 'gray', // 기본값 gray | ||
size = 'small', // 기본값 small | ||
className = '', | ||
disabled, | ||
...props | ||
}) => { | ||
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]', | ||
large: | ||
'h-[34px] px-[16px] py-[8px] text-[15px] rounded-[6px] leading-[13.13px]', | ||
}; | ||
|
||
return ( | ||
<button | ||
className={`${baseStyles} ${sizeStyles[size]} ${ | ||
disabled ? disabledStyles : buttonTheme[theme] | ||
} ${className}`} | ||
disabled={disabled} | ||
{...props} | ||
> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
|
||
const Divider = ({ | ||
className = '', | ||
...props | ||
}: React.HTMLAttributes<HTMLDivElement>) => { | ||
return ( | ||
<div | ||
className={`h-[1px] w-full bg-borderGray ${className}`} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export default Divider; |
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,27 @@ | ||
import React, { ReactElement } from 'react'; | ||
|
||
const IconButton = ({ | ||
className = '', | ||
children, | ||
disabled = false, | ||
...props | ||
}: React.ButtonHTMLAttributes<HTMLButtonElement>) => { | ||
return ( | ||
<button | ||
{...props} | ||
disabled={disabled} | ||
className={`flex h-[36px] w-[36px] items-center justify-center rounded-[6px] bg-white p-[8px] transition-colors hover:bg-[#EBE6E0] disabled:cursor-default disabled:bg-backgroundWhite ${ | ||
disabled ? 'text-borderGray' : 'text-textGray2' | ||
} ${className}`} | ||
> | ||
{React.isValidElement(children) | ||
? React.cloneElement(children as ReactElement, { | ||
className: | ||
`${(children as ReactElement).props.className || ''} fill-inherit`.trim(), | ||
}) | ||
: children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default IconButton; |
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,15 @@ | ||
import React from 'react'; | ||
|
||
const Input = ({ | ||
className = '', | ||
...props | ||
}: React.InputHTMLAttributes<HTMLInputElement>) => { | ||
return ( | ||
<input | ||
{...props} | ||
className={`box-border h-[29px] w-full rounded-[4px] border border-borderGray bg-backgroundWhite px-2 text-sm font-normal text-titleBlack placeholder-textGray1 outline-none focus:border-[1.5px] focus:border-pointColor ${className}`} | ||
/> | ||
); | ||
}; | ||
|
||
export default Input; |
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,15 @@ | ||
import React from 'react'; | ||
|
||
const SearchBar = ({ | ||
className = '', | ||
...props | ||
}: React.InputHTMLAttributes<HTMLInputElement>) => { | ||
return ( | ||
<input | ||
{...props} | ||
className={`h-[38px] w-full rounded-[20px] border border-textGray1 bg-backgroundGray px-4 font-pmedium text-titleBlack placeholder-textGray1 outline-none ${className}`} | ||
/> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
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,19 @@ | ||
import ADD_ICON from '@/assets/icons/add-icon.svg?react'; | ||
import BACKWARD_ICON from '@/assets/icons/backward-icon.svg?react'; | ||
import CROP_ICON from '@/assets/icons/crop-icon.svg?react'; | ||
import DELETE_ICON from '@/assets/icons/delete-icon.svg?react'; | ||
import EDIT_ICON from '@/assets/icons/edit-icon.svg?react'; | ||
import HISTORY_ICON from '@/assets/icons/history-icon.svg?react'; | ||
import LIST_ICON from '@/assets/icons/list-icon.svg?react'; | ||
import TREE_ICON from '@/assets/icons/tree-icon.svg?react'; | ||
|
||
export const Icons = { | ||
Add: <ADD_ICON />, | ||
Backward: <BACKWARD_ICON />, | ||
Crop: <CROP_ICON />, | ||
Delete: <DELETE_ICON />, | ||
Edit: <EDIT_ICON />, | ||
History: <HISTORY_ICON />, | ||
List: <LIST_ICON />, | ||
Tree: <TREE_ICON />, | ||
}; |
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
Oops, something went wrong.