-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui-kit): Alert, Container 컴포넌트 추가 (#43)
* feat(ui-kit): Icon 컴포넌트가 className을 받을 수 있도록 수정 * feat(ui-kit): Column, Container 스타일 버그 수정 * feat(ui-kit): Alert 컴포넌트가 Div 속성을 상속받도록 변경 * feat(ui-kit): Alert 스토리 업데이트 * feat(ui-kit): className을 template string이 아니라 classnames 함수로만 처리하도록 변경
- Loading branch information
Showing
21 changed files
with
301 additions
and
81 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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import '../src/sass/index.scss'; | ||
import React from 'react'; | ||
import { LubyconUIKitProvider } from '../src/components'; | ||
import { LubyconUIKitProvider, Container } from '../src/components'; | ||
|
||
export const decorators = [(Story => ( | ||
<LubyconUIKitProvider> | ||
<Story /> | ||
<Container> | ||
<Story /> | ||
</Container> | ||
</LubyconUIKitProvider> | ||
))]; |
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,71 @@ | ||
import React, { forwardRef, HTMLAttributes } from 'react'; | ||
import { colors, SemanticColor } from 'src/constants/colors'; | ||
import classnames from 'classnames'; | ||
import Text from '../Text'; | ||
import Icon from '../Icon'; | ||
import { informationCircle, closeCircle, alertCircle, checkmarkCircle } from 'ionicons/icons'; | ||
import { Combine } from 'src/types/utils'; | ||
|
||
interface AlertIcon { | ||
icon: string; | ||
color: string; | ||
} | ||
const alertIconMap: { | ||
[key in SemanticColor]: AlertIcon; | ||
} = { | ||
negative: { | ||
icon: closeCircle, | ||
color: colors.red50, | ||
}, | ||
notice: { | ||
icon: alertCircle, | ||
color: colors.yellow50, | ||
}, | ||
informative: { | ||
icon: informationCircle, | ||
color: colors.blue50, | ||
}, | ||
positive: { | ||
icon: checkmarkCircle, | ||
color: colors.green50, | ||
}, | ||
}; | ||
|
||
type AlertProps = Combine< | ||
{ | ||
type?: SemanticColor; | ||
title?: string; | ||
}, | ||
HTMLAttributes<HTMLDivElement> | ||
>; | ||
|
||
const Alert = forwardRef<HTMLDivElement, AlertProps>(function Alert( | ||
{ type = 'informative', title, children, className, ...props }, | ||
ref | ||
) { | ||
const { icon: iconName, color: iconColor } = alertIconMap[type]; | ||
|
||
return ( | ||
<div | ||
ref={ref} | ||
className={classnames('lubycon-alert', `lubycon-alert--type-${type}`, className)} | ||
{...props} | ||
> | ||
<Icon | ||
className="lubycon-alert__icon" | ||
icon={iconName} | ||
type="filled" | ||
size={19} | ||
color={iconColor} | ||
></Icon> | ||
{title ? ( | ||
<Text fontWeight="bold" className="lubycon-alert__title"> | ||
{title} | ||
</Text> | ||
) : null} | ||
<Text className="lubycon-alert__description">{children}</Text> | ||
</div> | ||
); | ||
}); | ||
|
||
export default Alert; |
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,9 +1,27 @@ | ||
import React, { HTMLAttributes } from 'react'; | ||
|
||
import classnames from 'classnames'; | ||
interface ContainerProps extends HTMLAttributes<HTMLDivElement> { | ||
size: 'fluid' | 'sm' | 'md' | 'lg' | 'xl'; | ||
fluid?: boolean; | ||
} | ||
|
||
export default function Container({ ...props }: ContainerProps): JSX.Element { | ||
return <div>{props.children}</div>; | ||
export default function Container({ | ||
children, | ||
fluid = false, | ||
className, | ||
...props | ||
}: ContainerProps): JSX.Element { | ||
return ( | ||
<div | ||
className={classnames( | ||
'lubycon-container', | ||
{ | ||
'lubycon-container--fluid': fluid === true, | ||
}, | ||
className | ||
)} | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
); | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export const DEFAULT_ELEMENT = 'div' as const; | ||
|
||
type ColumnNumberSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; | ||
export type ColumnSize = boolean | 'auto' | ColumnNumberSize; | ||
export type ColumnSize = 'auto' | ColumnNumberSize; | ||
export type ColumnResponsive = 'xl' | 'lg' | 'md' | 'sm' | 'xs'; |
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,29 @@ | ||
$alert-horizental-padding: 14px; | ||
|
||
.lubycon-alert { | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: center; | ||
border-radius: 4px; | ||
padding: 10px $alert-horizental-padding; | ||
|
||
&--type-negative { | ||
background-color: get-color('red40'); | ||
} | ||
&--type-notice { | ||
background-color: get-color('yellow40'); | ||
} | ||
&--type-informative { | ||
background-color: get-color('blue40'); | ||
} | ||
&--type-positive { | ||
background-color: get-color('green40'); | ||
} | ||
|
||
&__title { | ||
margin-right: 8px; | ||
} | ||
&__icon { | ||
margin-right: $alert-horizental-padding; | ||
} | ||
} |
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,11 @@ | ||
.lubycon-container { | ||
width: 100%; | ||
max-width: none; | ||
margin: 0 auto; | ||
&--fluid { | ||
max-width: auto; | ||
} | ||
@include media-breakpoint(sm) { | ||
max-width: 1200px; | ||
} | ||
} |
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.