Skip to content

Commit

Permalink
[feat] label card component 구현
Browse files Browse the repository at this point in the history
- label card component 구현
  • Loading branch information
16010948 committed Nov 9, 2020
1 parent 9ddddb9 commit b25e528
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
27 changes: 27 additions & 0 deletions client/src/components/organisms/LabelCard/LabelCard.stories.tsx
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}
/>
);
};
48 changes: 48 additions & 0 deletions client/src/components/organisms/LabelCard/LabelCard.tsx
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;
1 change: 1 addition & 0 deletions client/src/components/organisms/LabelCard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './LabelCard';

0 comments on commit b25e528

Please sign in to comment.