Skip to content
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

현재 모임 상태 태그구현 #142

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/common/theme/theme.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface Typography {
Medium: SerializedStyles;
small: SerializedStyles;
Tiny: SerializedStyles;
tag: SerializedStyles;
}

export interface Layout {
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/common/theme/typography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ const typography: Typography = {
font-weight: 800;
line-height: 1.2rem;
`,
tag: css`
font-family: Pretendard;
font-size: 1.2rem;
font-style: normal;
font-weight: 600;
line-height: 130%;
`,
Comment on lines +168 to +174
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

figma 디자인 시스템 typography에는 아직 tag에 대한 것은 적용되어 있지 않은 것 같아요!
@ksk0605 테바에게 공유가 되어야 할 것 같아요~
이번 케이스와 같이 개발을 하면서 필요할 것 같은 규칙이 있다면 추가하고 공유해드리면 될까요?

};

export default typography;
43 changes: 43 additions & 0 deletions frontend/src/components/Tag/Tag.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import type { Meta, StoryObj } from '@storybook/react';
import Tag from './Tag';

const meta = {
component: Tag,
title: 'Components/Tag',
} satisfies Meta<typeof Tag>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
children: '모집중',
color: 'green',
},
render: (args) => <Tag {...args} />,
};

export const RecruitingTag: Story = {
args: {
children: '모집중',
color: 'green',
},
render: (args) => <Tag {...args} />,
};

export const RecruitingCanceledTag: Story = {
args: {
children: '모집취소',
color: 'red',
},
render: (args) => <Tag {...args} />,
};

export const RecruitingCompletedTag: Story = {
args: {
children: '모집완료',
color: 'grey',
},
render: (args) => <Tag {...args} />,
};
27 changes: 27 additions & 0 deletions frontend/src/components/Tag/Tag.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { css, Theme } from '@emotion/react';

interface TagBoxProps {
theme: Theme;
color: 'red' | 'green' | 'grey';
}
export const tagBox = (props: TagBoxProps) => {
const { theme, color } = props;
return css`
${theme.typography.tag}
display: inline-flex;
gap: 1rem;
align-items: center;
justify-content: center;

padding: 0.2rem 0.6rem;

color: ${theme.colorPalette.white[100]};

background-color: ${color === 'red'
? theme.colorPalette.red[400]
: color === 'green'
? theme.colorPalette.green[200]
: theme.colorPalette.grey[400]};
border-radius: 1rem;
`;
};
15 changes: 15 additions & 0 deletions frontend/src/components/Tag/Tag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as S from '@_components/Tag/Tag.style';

import { HTMLProps, ReactNode } from 'react';
import { useTheme } from '@emotion/react';

interface TagProps extends HTMLProps<HTMLDivElement> {
color: 'red' | 'green' | 'grey';
children: ReactNode;
}

export default function Tag(props: TagProps) {
const theme = useTheme();
const { children, color } = props;
return <div css={S.tagBox({ theme, color })}>{children}</div>;
}
Loading