-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui-kit): Alert, Container 컴포넌트 추가 #43
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dedbfe2
feat(ui-kit): Icon 컴포넌트가 className을 받을 수 있도록 수정
evan-moon f75c7f2
Merge branch alpha of https://github.com/Lubycon/lubycon-ui-kit into …
evan-moon 984a2a6
feat(ui-kit): Column, Container 스타일 버그 수정
evan-moon 413a97e
feat(ui-kit): Alert 컴포넌트가 Div 속성을 상속받도록 변경
evan-moon efa6199
feat(ui-kit): Alert 스토리 업데이트
evan-moon a850108
feat(ui-kit): className을 template string이 아니라 classnames 함수로만 처리하도록 변경
evan-moon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
동욱님 modifier에 해당하는건 다 언더스코어가 아니라 --로 가는건가요 ? ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵넵 BEM에 따라서 Block은
__
으로, Modifier는--
으로 가야할 것 같습니다!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block -> Element를 말씀하신거죠 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 넵넵 맞습니다! 🙇♂️