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

[FE] 팀 피드 일정 알림 컴포넌트 UI 구현 #205

Merged
merged 3 commits into from
Jul 28, 2023
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
26 changes: 26 additions & 0 deletions frontend/src/components/Notification/Notification.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Meta, StoryObj } from '@storybook/react';

import Notification from '~/components/Notification/Notification';

const meta = {
title: 'Feed/Notification',
component: Notification,
tags: ['autodocs'],
} satisfies Meta<typeof Notification>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
content: "'범죄심리학 발표자료..' 일정이 수정되었습니다.",
},
};

export const Small: Story = {
args: {
content: "'범죄심리학 발표자료..' 일정이 수정되었습니다.",
size: 'sm',
},
};
16 changes: 16 additions & 0 deletions frontend/src/components/Notification/Notification.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { styled } from 'styled-components';
import type { NotificationProps } from '~/components/Notification/Notification';

export const Wrapper = styled.div<Pick<NotificationProps, 'color' | 'size'>>`
display: flex;
justify-content: center;
align-items: center;

width: 100%;
height: ${({ size }) => (size === 'md' ? 50 : 42)}px;

background-color: ${({ color }) => color};
border-radius: 20px;

filter: brightness(1.7);
`;
24 changes: 24 additions & 0 deletions frontend/src/components/Notification/Notification.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Text from '~/components/common/Text/Text';
import * as S from './Notification.styled';
import type { NotificationSize, TextSize } from '~/types/size';

export interface NotificationProps {
color?: string;
size?: NotificationSize;
content: string;
}

const Notification = (props: NotificationProps) => {
const { color = '#516FFF', content, size = 'md' } = props;
const textSize: Extract<TextSize, 'md' | 'xl'> = size === 'md' ? 'xl' : 'md';

return (
<S.Wrapper color={color} size={size}>
<Text size={textSize} weight="bold">
{content}
</Text>
</S.Wrapper>
);
};

export default Notification;
2 changes: 2 additions & 0 deletions frontend/src/types/size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export type ButtonSize = Extract<Size, 'sm' | 'md' | 'lg'>;
export type TextSize = Size;

export type DateCellSize = Extract<Size, 'sm' | 'md' | 'lg'>;

export type NotificationSize = Extract<Size, 'sm' | 'md'>;