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/#16] 공통 네브바 제작 #37

Merged
merged 4 commits into from
Feb 4, 2025
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
41 changes: 41 additions & 0 deletions src/assets/svg/ic-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions src/components/ReceiptEdit/ReceiptEdit.module.css
sikkzz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.ReceiptEdit {
padding-left: 1.25rem;
padding-right: 1.25rem;
padding-bottom: 2.5rem;
height: calc(100vh - 2.75rem);
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
justify-content: space-between;
background: var(--color-bg-gradient);
}
.ReceiptEdit::before {
content: "";
background: url("/src/assets/svg/img-graphic-main.svg") center no-repeat;
background-size: 100% 16.375rem;
filter: blur(4.625rem);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 0;
}

.Top {
z-index: 1;
}
.Top .TitleBox {
display: flex;
justify-content: center;
margin-top: 2.5rem;
}

.InfoList {
display: flex;
flex-direction: column;
gap: 0.875rem;
margin-top: 1.5rem;
}

.InfoItem {
display: flex;
flex-direction: column;
gap: 0.5rem;
}

.Bottom {
display: flex;
align-items: center;
gap: 0.875rem;
z-index: 1;
}
5 changes: 0 additions & 5 deletions src/components/common/Navbar.module.scss

This file was deleted.

7 changes: 0 additions & 7 deletions src/components/common/Navbar.tsx

This file was deleted.

17 changes: 17 additions & 0 deletions src/components/common/Navbar/Navbar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.Navbar {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 2.75rem;
padding: 0.75rem 1.25rem;
background-color: var(--color-white);

button {
display: flex;
}
}

.RightButton {
margin-left: auto;
}
62 changes: 62 additions & 0 deletions src/components/common/Navbar/Navbar.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { MemoryRouter } from "react-router-dom";

import Navbar from "@/components/common/Navbar/Navbar";
import Icon from "@/components/ui/Icon/Icon";
import Text from "@/components/ui/Text/Text";

import type { Meta, StoryObj } from "@storybook/react";

const meta: Meta = {
title: "Components/Navbar",
decorators: [
(Story) => (
<MemoryRouter>
<div style={{ width: 350, border: "1px solid #ccc" }}>
<Story />
</div>
</MemoryRouter>
),
],
};

export default meta;

type Story = StoryObj;

export const HomeNavbar: Story = {
name: "HomeNavbar",
render: () => (
<Navbar>
<Navbar.LeftButton>
<Icon name="logo" />
</Navbar.LeftButton>
<Navbar.RightButton>
<Text variant="bodySm" color="secondary">
앱 공유하기
</Text>
</Navbar.RightButton>
</Navbar>
),
};

export const ArrowNavbar: Story = {
name: "ArrowNavbar",
render: () => (
<Navbar>
<Navbar.LeftButton>
<Icon name="leftArrow" />
</Navbar.LeftButton>
</Navbar>
),
};

export const CloseNavbar: Story = {
name: "CloseNavbar",
render: () => (
<Navbar>
<Navbar.RightButton>
<Icon name="close" />
</Navbar.RightButton>
</Navbar>
),
};
35 changes: 35 additions & 0 deletions src/components/common/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { ButtonHTMLAttributes, PropsWithChildren } from "react";

import classNames from "classnames";

import styles from "@/components/common/Navbar/Navbar.module.scss";

const Navbar = ({ children }: PropsWithChildren) => {
return <div className={styles.Navbar}>{children}</div>;
};

Navbar.LeftButton = ({
children,
className,
...props
}: ButtonHTMLAttributes<HTMLButtonElement>) => {
return (
<button {...props} className={className}>
{children}
</button>
);
};

Navbar.RightButton = ({
children,
className,
...props
}: ButtonHTMLAttributes<HTMLButtonElement>) => {
return (
<button className={classNames(styles.RightButton, className)} {...props}>
{children}
</button>
);
};

export default Navbar;
5 changes: 4 additions & 1 deletion src/components/ui/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import CloseIcon from "@/assets/svg/ic-close.svg?react";
import EmptyCircleIcon from "@/assets/svg/ic-empty-circle.svg?react";
import GalleryIcon from "@/assets/svg/ic-gallery.svg?react";
import LeftArrowIcon from "@/assets/svg/ic-left-arrow.svg?react";
import LogoIcon from "@/assets/svg/ic-logo.svg?react";
import PasteIcon from "@/assets/svg/ic-paste.svg?react";
import PlusIcon from "@/assets/svg/ic-plus.svg?react";

Expand All @@ -15,7 +16,8 @@ export type IconNameType =
| "paste"
| "plus"
| "checkCircle"
| "emptyCircle";
| "emptyCircle"
| "logo";

export interface IconProps {
name: IconNameType;
Expand All @@ -30,6 +32,7 @@ export const ICONS = {
plus: PlusIcon,
checkCircle: CheckCircleIcon,
emptyCircle: EmptyCircleIcon,
logo: LogoIcon,
};

// 추후 사이즈, 컬러등 추가 가능
Expand Down
24 changes: 22 additions & 2 deletions src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
import Navbar from "@/components/common/Navbar";
import { useNavigate } from "react-router-dom";

import Navbar from "@/components/common/Navbar/Navbar";
import Home from "@/components/Home/Home";
import Icon from "@/components/ui/Icon/Icon";
import Text from "@/components/ui/Text/Text";

const HomePage = () => {
const navigate = useNavigate();

const handleLogoClick = () => {
navigate("/");
};

return (
<>
<Navbar />
<Navbar>
<Navbar.LeftButton onClick={handleLogoClick}>
<Icon name="logo" />
</Navbar.LeftButton>
<Navbar.RightButton>
<Text variant="bodySm" color="secondary">
앱 공유하기
</Text>
</Navbar.RightButton>
</Navbar>

<Home />
</>
);
Expand Down
10 changes: 8 additions & 2 deletions src/pages/ReceiptEditPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import Navbar from "@/components/common/Navbar";
import Navbar from "@/components/common/Navbar/Navbar";
import ReceiptEdit from "@/components/ReceiptEdit/ReceiptEdit";
import Icon from "@/components/ui/Icon/Icon";

const ReceiptEditPage = () => {
return (
<>
<Navbar />
<Navbar>
<Navbar.LeftButton>
<Icon name="leftArrow" />
</Navbar.LeftButton>
</Navbar>

<ReceiptEdit />
</>
);
Expand Down
10 changes: 8 additions & 2 deletions src/pages/RecognitionFailPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import Navbar from "@/components/common/Navbar";
import Navbar from "@/components/common/Navbar/Navbar";
import RecognitionFail from "@/components/RecognitionFail/RecognitionFail";
import Icon from "@/components/ui/Icon/Icon";

const RecognitionFailPage = () => {
return (
<>
<Navbar />
<Navbar>
<Navbar.RightButton>
<Icon name="close" />
</Navbar.RightButton>
</Navbar>

<RecognitionFail />
</>
);
Expand Down
9 changes: 7 additions & 2 deletions src/pages/SelectStylePage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import Navbar from "@/components/common/Navbar";
import Navbar from "@/components/common/Navbar/Navbar";
import SelectStyle from "@/components/SelectStyle/SelectStyle";
import Icon from "@/components/ui/Icon/Icon";

const SelectStylePage = () => {
return (
<>
<Navbar />
<Navbar>
<Navbar.LeftButton>
<Icon name="leftArrow" />
</Navbar.LeftButton>
</Navbar>
<SelectStyle />
</>
);
Expand Down
9 changes: 7 additions & 2 deletions src/pages/SelectTagPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import Navbar from "@/components/common/Navbar";
import Navbar from "@/components/common/Navbar/Navbar";
import SelectTag from "@/components/SelectTag/SelectTag";
import Icon from "@/components/ui/Icon/Icon";

const SelectTagPage = () => {
return (
<>
<Navbar />
<Navbar>
<Navbar.LeftButton>
<Icon name="leftArrow" />
</Navbar.LeftButton>
</Navbar>
<SelectTag />
</>
);
Expand Down