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

πŸ”€ common 폴더 ꡬ쑰 λ³€κ²½ #6

Merged
merged 2 commits into from
Oct 22, 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
2 changes: 1 addition & 1 deletion src/app/(page)/music/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Header from '@/components/common/Header';
import Header from '@/components/common/molecules/Header';

export default function Music() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/app/(page)/signin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Logo from '@/components/common/Logo';
import Logo from '@/components/common/atoms/Logo';
import ButtonWrapper from '@/components/Signin/molecules/ButtonWrapper';
import InputWrapper from '@/components/Signin/molecules/InputWrapper';

Expand Down
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Header from '@/components/common/Header';
import Header from '@/components/common/molecules/Header';

export default function Home() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Signin/molecules/ButtonWrapper/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Button from '@/components/common/Button';
import Button from '@/components/common/atoms/Button';

const ButtonWrapper = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Signin/molecules/InputWrapper/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Lock, Person } from '@/assets/icons';
import TextField from '@/components/common/TextField';
import TextField from '@/components/common/atoms/TextField';

const InputWrapper = () => {
return (
Expand Down
49 changes: 0 additions & 49 deletions src/components/common/Header/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react';
import Button from '.';

const meta = {
title: 'Components/Common/Button',
title: 'Components/Common/atoms/Button',
component: Button,
tags: ['autodocs'],
argTypes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react';
import Logo from '.';

const meta = {
title: 'Components/Common/Logo',
title: 'Components/Common/atoms/Logo',
component: Logo,
tags: ['autodocs'],
} satisfies Meta<typeof Logo>;
Expand Down
33 changes: 33 additions & 0 deletions src/components/common/atoms/NavItem/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Link from 'next/link';
import React from 'react';

interface Props {
href: string;
icon: React.ComponentType<{ color: string }>;
text: string;
isActive: boolean;
}

const NavItem = ({ href, icon: Icon, text, isActive }: Props) => {
return (
<Link href={href}>
<div
className={`flex items-center gap-6 rounded-lg px-4 py-3 ${
isActive
? 'bg-primary-p20 text-primary-p10'
: 'text-natural-n30 bg-background-card'
}`}
>
<Icon color={isActive ? '#6F7AEC' : '#BBBBCC'} />
<p
className="text-h6"
style={{ color: isActive ? '#6F7AEC' : '#BBBBCC' }}
>
{text}
</p>
</div>
</Link>
);
};

export default NavItem;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react';
import TextField from './index';

const config: Meta<typeof TextField> = {
title: 'Components/Common/TextField',
title: 'Components/Common/atoms/TextField',
component: TextField,
args: { placeholder: 'Text' },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react';
import ToggleSwitch from '.';

const meta = {
title: 'Components/Common/ToggleSwitch',
title: 'Components/Common/atoms/ToggleSwitch',
component: ToggleSwitch,
tags: ['autodocs'],
argTypes: {},
Expand Down
38 changes: 38 additions & 0 deletions src/components/common/molecules/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
'use client';

import { usePathname } from 'next/navigation';
import React from 'react';
import Logo from '../../atoms/Logo';
import NavItem from '../../atoms/NavItem';
import { Book, Music } from '@/assets/svg';

const navItems = [
{ href: '/', icon: Book, text: 'μ˜ˆμ•½' },
{ href: '/music', icon: Music, text: 'μŒμ•…' },
];

const Header = () => {
const pathname = usePathname();

return (
<div className="h-screen max-w-[258px] bg-background-card px-6 py-9">
<Logo />
<div className="mt-9 flex h-full w-full flex-col gap-2">
{navItems.map((item) => {
const isActive = pathname === item.href;
return (
<NavItem
key={item.href}
href={item.href}
icon={item.icon}
text={item.text}
isActive={isActive}
/>
);
})}
</div>
</div>
);
};

export default Header;
7 changes: 4 additions & 3 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ const config: Config = {
h2: ['2rem', { lineHeight: '2.5rem', fontWeight: '700' }],
h3: ['1.375rem', { lineHeight: '1.125rem', fontWeight: '700' }],
h4: ['1rem', { lineHeight: '1.25rem', fontWeight: '700' }],
h5: ['1.125rem', { lineHeight: '1.4038rem', fontWeight: '500' }],
h5: ['1.125rem', { lineHeight: '1.4038rem', fontWeight: '700' }],
h6: ['1.125rem', { lineHeight: '22.4608px', fontWeight: '500' }],
body1: ['1rem', { lineHeight: '1.5rem', fontWeight: '500' }],
body2: ['0.875rem', { lineHeight: '1.125rem', fontWeight: '600' }],
body3: ['0.875rem', { lineHeight: '1.125rem', fontWeight: '500' }],
body2: ['0.875rem', { lineHeight: '1.0919rem', fontWeight: '600' }],
body3: ['0.875rem', { lineHeight: '17.4704px', fontWeight: '500' }],
},
spacing: {
'0': '0',
Expand Down
Loading