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

feat : Logo 컴포넌트 생성 및 메인페이지 상단 로고, 알림버튼 개발 #186

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
9 changes: 9 additions & 0 deletions public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/components/Common/LogoContainer/Logo.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { Meta, StoryObj } from '@storybook/react';

import { Logo } from './Logo';

const meta: Meta<typeof Logo> = {
component: Logo,
title: 'atoms/Logo',
tags: ['autodocs'],
argTypes: {}
};
export default meta;

type Story = StoryObj<typeof Logo>;

export const Default: Story = {
args: {}
};
9 changes: 9 additions & 0 deletions src/components/Common/LogoContainer/Logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type LogoProps = {
h?: number;
};

export const Logo = ({ h = 24 }: LogoProps) => {
const height = `h-[${h}px]`;

return <img className={`${height}`} src="/logo.svg" alt="" />;
};
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import type { Meta, StoryObj } from '@storybook/react';
import { MemoryRouter } from 'react-router-dom';
import { NotificationBadge } from './NotificationBadge';

const meta: Meta<typeof NotificationBadge> = {
component: NotificationBadge,
title: 'atoms/NotificationBadge',
tags: ['autodocs'],
argTypes: {},
decorators: [
(Story) => (
<MemoryRouter>
<Story />
</MemoryRouter>
)
]
argTypes: {}
};
export default meta;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';

interface NotificationBadgeProps {
badgeType: 'basic' | 'dday';
Expand All @@ -10,8 +9,6 @@ export const NotificationBadge = ({
badgeType,
count
}: NotificationBadgeProps) => {
const navigate = useNavigate();

const MAX_COUNT = 99;
const BaseStyle =
'inline-flex items-center justify-center text-center align-text-middle';
Expand Down Expand Up @@ -57,10 +54,7 @@ export const NotificationBadge = ({
};

return (
<div
onClick={() => navigate('/notification')}
className={`${BaseStyle} ${styleMap[badgeType]}`}
>
<div className={`${BaseStyle} ${styleMap[badgeType]}`}>
{renderContent(badgeType, count)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';

import { MemoryRouter } from 'react-router-dom';
import { TopButtonContainer } from './TopButtonContainer';

const meta: Meta<typeof TopButtonContainer> = {
Expand All @@ -10,10 +10,18 @@ const meta: Meta<typeof TopButtonContainer> = {
parameters: {
docs: {
description: {
component: 'homePage에서 상단에 위치하는 버튼 입니다.'
component:
'homePage에서 상단에 위치하는 로고와 알람함 이동 버튼 입니다.'
}
}
}
},
decorators: [
(Story) => (
<MemoryRouter>
<Story />
</MemoryRouter>
)
]
};
export default meta;

Expand Down
13 changes: 11 additions & 2 deletions src/components/HomePage/TopButtonContainer/TopButtonContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { NavLink } from 'react-router-dom';
import { Logo } from '../../Common/LogoContainer/Logo';
import { IoIosNotifications } from 'react-icons/io';

export const TopButtonContainer = () => {
return (
<div className="flex justify-between">
<button className="btn-base w-[44px] h-[44px]">1</button>
<button className="btn-base w-[44px] h-[44px]">2</button>
<NavLink to={'/'}>
<Logo h={34} />
</NavLink>

<NavLink to={'/notification'} className="size-[34px]">
<IoIosNotifications className="size-full text-[#22B8EF]" />
</NavLink>
</div>
);
};
Loading