-
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.
- label card component 구현
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
client/src/components/organisms/LabelCard/LabelCard.stories.tsx
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, { useState } from 'react'; | ||
import { text, color } from '@storybook/addon-knobs'; | ||
import PlainText from '@components/atoms/PlainText'; | ||
import LabelCard from './LabelCard'; | ||
|
||
export default { | ||
component: LabelCard, | ||
title: 'Organisms/LabelCard', | ||
}; | ||
export const Default = () => { | ||
const title = text('title', 'Bug'); | ||
const bgColor = color('background color', 'rgba(163,10,10,100)'); | ||
const hexColor = bgColor | ||
.slice(5, -1) | ||
.split(',') | ||
.map((v) => Number(v).toString(16).padStart(2, '0')) | ||
.join('') | ||
.slice(0, 6); | ||
const description = text('description', 'api develop'); | ||
return ( | ||
<LabelCard | ||
title={title} | ||
bgColor={`#${hexColor}`} | ||
description={description} | ||
/> | ||
); | ||
}; |
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,48 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import styled from '@themes/styled'; | ||
import LabelTag from '@components/atoms/LabelTag'; | ||
import Button from '@components/atoms/Button'; | ||
import PlainText from '@components/atoms/PlainText'; | ||
|
||
interface Props { | ||
title: string; | ||
bgColor: string; | ||
description?: string; | ||
} | ||
|
||
const StyledLabelCard = styled.div` | ||
display: flex; | ||
align-items: center; | ||
& > * { | ||
flex: 1; | ||
} | ||
& > div:last-child { | ||
text-align: right; | ||
} | ||
`; | ||
|
||
const LabelCard: FunctionComponent<Props> = ({ | ||
title, | ||
bgColor, | ||
description = '', | ||
}) => { | ||
return ( | ||
<StyledLabelCard> | ||
<div> | ||
<LabelTag text={title} bgColor={bgColor} /> | ||
</div> | ||
<div> | ||
<PlainText value={description} /> | ||
</div> | ||
<div> | ||
<Button type="transparent"> | ||
<PlainText value="Edit" /> | ||
</Button> | ||
<PlainText value="Delete" /> | ||
</div> | ||
</StyledLabelCard> | ||
); | ||
}; | ||
|
||
export default LabelCard; |
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 @@ | ||
export { default } from './LabelCard'; |