-
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.
Browse files
Browse the repository at this point in the history
* refactor: Button 컴포넌트 Emotion 다형성 컴포넌트 방식으로 변경 및 속성 추가 * refactor: TabLayout 420px 변경 대응 * refactor: Badge 컴포넌트 children 타입 number 추가 * refactor: Header maxWidth 420px 로 변경 * refactor: navigation maxWidth 420px로 변경 * refactor: ImageView 컴포넌트 추가 Image가 예약어인 관계로 ImageView로 네이밍을 한다. * refactor: BottomSheet 420px 대응 및 내부 요소에 따라 높이 자동 조절토록 변경 * feat: Profile 관련 누락된 SVG 컴포넌트 추가 * storybook: SVG Profile Storybook 추가 * refactor: Badge 컴포넌트 children을 ReactNode 타입으로 확장 * storybook: ImageView 컴포넌트 스토리북 추가 * chore: 0.4.6 버저닝 업데이트 * storybook: Button 컴포넌트 수정사항 대응 * refactor: default image SVG 컴포넌트 대신 PNG 파일로 export 하여 ImageView 컴포넌트와 활용하여 사용 * chore: 0.4.7 버전 배포 * chore: 0.4.8 버전 배포 잘못된 default image 수정하여 재배포
- Loading branch information
1 parent
08e9c19
commit e155759
Showing
25 changed files
with
576 additions
and
795 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
This file was deleted.
Oops, something went wrong.
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.
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 |
---|---|---|
@@ -1,49 +1,48 @@ | ||
import styled from '@emotion/styled'; | ||
import { | ||
ComponentPropsWithoutRef, | ||
ReactNode, | ||
ElementType, | ||
MouseEventHandler, | ||
} from 'react'; | ||
|
||
type Props<T extends ElementType> = { | ||
children: ReactNode; | ||
as?: T; | ||
onClick?: MouseEventHandler<HTMLButtonElement>; | ||
isGrayOut?: boolean; | ||
} & ComponentPropsWithoutRef<T>; | ||
|
||
const Button = <T extends ElementType>({ | ||
as, | ||
onClick = () => {}, | ||
isGrayOut = false, | ||
children, | ||
...attributes | ||
}: Props<T>) => { | ||
const tag = as || 'button'; | ||
import { convertCSS } from '../..'; | ||
|
||
return ( | ||
<Wrapper as={tag} onClick={onClick} isGrayOut={isGrayOut} {...attributes}> | ||
{children} | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
export default Button; | ||
export interface Props { | ||
width?: number | string; | ||
height?: number | string; | ||
minWidth?: number | string; | ||
minHeight?: number | string; | ||
maxWidth?: number | string; | ||
maxHeight?: number | string; | ||
padding?: string; | ||
paddingTop?: number | string; | ||
paddingRight?: number | string; | ||
paddingBottom?: number | string; | ||
paddingLeft?: number | string; | ||
isGrayOut?: boolean; | ||
} | ||
|
||
const Wrapper = styled.button<{ isGrayOut: boolean }>` | ||
const Button = styled.button<Props>` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
border: none; | ||
border-radius: 6px; | ||
cursor: pointer; | ||
width: ${({ width }) => (width ? convertCSS(width) : '100%')}; | ||
height: ${({ height }) => height && convertCSS(height)}; | ||
min-width: ${({ minWidth }) => minWidth && convertCSS(minWidth)}; | ||
min-height: ${({ minHeight }) => minHeight && convertCSS(minHeight)}; | ||
max-width: ${({ maxWidth }) => maxWidth && convertCSS(maxWidth)}; | ||
max-height: ${({ maxHeight }) => maxHeight && convertCSS(maxHeight)}; | ||
background-color: ${({ isGrayOut, theme }) => | ||
isGrayOut ? theme.color.bg1 : theme.color.c1}; | ||
color: ${({ isGrayOut, theme }) => | ||
isGrayOut ? theme.color.b : theme.color.w1}; | ||
border: none; | ||
border-radius: 6px; | ||
font-size: ${({ theme }) => theme.font.suit16sb.fontSize}px; | ||
font-weight: ${({ theme }) => theme.font.suit16sb.fontWeight}; | ||
width: 100%; | ||
padding: 17px 28px; | ||
cursor: pointer; | ||
padding: ${({ padding }) => (padding ? padding : '17px 28px')}; | ||
padding-top: ${({ paddingTop }) => paddingTop && convertCSS(paddingTop)}; | ||
padding-right: ${({ paddingRight }) => | ||
paddingRight && convertCSS(paddingRight)}; | ||
padding-bottom: ${({ paddingBottom }) => | ||
paddingBottom && convertCSS(paddingBottom)}; | ||
padding-left: ${({ paddingLeft }) => paddingLeft && convertCSS(paddingLeft)}; | ||
`; | ||
|
||
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
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,58 @@ | ||
import styled from '@emotion/styled'; | ||
import { ImgHTMLAttributes, SyntheticEvent } from 'react'; | ||
|
||
import { convertCSS } from '../..'; | ||
|
||
interface Props extends ImgHTMLAttributes<HTMLImageElement> { | ||
width?: number | string; | ||
height?: number | string; | ||
maxWidth?: number | string; | ||
maxHeight?: number | string; | ||
objectFit?: string; | ||
borderRadius?: number | string; | ||
ratio?: string; | ||
defaultSrc?: string; | ||
} | ||
const ImageView = ({ | ||
src, | ||
alt, | ||
width = '100%', | ||
height = '100%', | ||
maxWidth, | ||
maxHeight, | ||
objectFit = 'cover', | ||
borderRadius, | ||
ratio, | ||
defaultSrc, | ||
}: Props) => { | ||
return ( | ||
<StyledImage | ||
src={src} | ||
alt={alt} | ||
width={width} | ||
height={height} | ||
maxWidth={maxWidth} | ||
maxHeight={maxHeight} | ||
objectFit={objectFit} | ||
borderRadius={borderRadius} | ||
ratio={ratio} | ||
onError={(e: SyntheticEvent<HTMLImageElement, Event>) => { | ||
if (defaultSrc) e.currentTarget.src = defaultSrc; | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
const StyledImage = styled.img<Props>` | ||
display: block; | ||
width: ${({ width }) => width && convertCSS(width)}; | ||
height: ${({ height }) => height && convertCSS(height)}; | ||
max-width: ${({ maxWidth }) => maxWidth && convertCSS(maxWidth)}; | ||
max-height: ${({ maxHeight }) => maxHeight && convertCSS(maxHeight)}; | ||
object-fit: ${({ objectFit }) => objectFit}; | ||
border-radius: ${({ borderRadius }) => | ||
borderRadius && convertCSS(borderRadius)}; | ||
aspect-ratio: ${({ ratio }) => ratio}; | ||
`; | ||
|
||
export default ImageView; |
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
Oops, something went wrong.