Skip to content

Commit

Permalink
feat: add NavBar
Browse files Browse the repository at this point in the history
  • Loading branch information
allyusd committed Nov 8, 2023
1 parent 8bde0eb commit 8a63c27
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 5 deletions.
20 changes: 20 additions & 0 deletions components/shared/Bars/NavBar/NavBar.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Meta, StoryObj } from "@storybook/react";

import NavBar from "./index";

const meta: Meta<typeof NavBar> = {
title: "Bars/NavBar",
component: NavBar,
tags: ["autodocs"],
argTypes: {},
};

export default meta;

type PlaygroudStory = StoryObj<typeof NavBar>;

export const Playgroud: PlaygroudStory = {
render: (args) => <NavBar {...args}></NavBar>,
};

Playgroud.args = {};
13 changes: 13 additions & 0 deletions components/shared/Bars/NavBar/NavBar.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { cleanup, render, screen } from "@testing-library/react";
import NavBar from "./NavBar";
import "@testing-library/jest-dom";
import React from "react";

describe("NavBar", () => {
afterEach(cleanup);

it("NavBar", () => {
render(<NavBar />);
expect(screen.getByText("遊戲微服務大平台")).toBeInTheDocument();
});
});
37 changes: 37 additions & 0 deletions components/shared/Bars/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { PropsWithChildren } from "react";
import Icon from "@/components/shared/Icon";

interface TagProps extends React.ComponentPropsWithoutRef<"div"> {}

const NavBar = ({}: PropsWithChildren<TagProps>) => {
return (
<div
className={
"flex items-center justify-between h-14 pl-2 pr-4 py-1 gradient-black"
}
>
<div id={"logo"} className={"flex px-2.5 items-center"}>
<div
id={"leading-icon"}
className={"flex flex-col w-12 h-12 p-2 items-center justify-center"}
>
<Icon name="logo" className="w-6 h-6" />
</div>
<div className={"ml-1 text-primary-100"}>遊戲微服務大平台</div>
</div>
<div id={"btn-group"} className={"flex"}>
<div className={"w-12 h-12 p-3"}>
<Icon name="chat" className="w-6 h-6 [&_*]:stroke-gray-500" />
</div>
<div className={"w-12 h-12 p-3 ml-3"}>
<Icon name="notification" className="w-6 h-6 [&_*]:stroke-gray-500" />
</div>
<div className={"w-12 h-12 p-3 ml-3"}>
<Icon name="player" className="w-6 h-6 [&_*]:stroke-gray-500" />
</div>
</div>
</div>
);
};

export default NavBar;
5 changes: 5 additions & 0 deletions components/shared/Bars/NavBar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import NarBar from "./NavBar";

export * from "./NavBar";

export default NarBar;
4 changes: 4 additions & 0 deletions components/shared/Icon/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import bounceRight from "./svgs/bounce-right.svg";
import brightCrown from "./svgs/bright-crown.svg";
import brightStar from "./svgs/bright-star.svg";
import cellar from "./svgs/cellar.svg";
import chat from "./svgs/chat.svg";
import chatLines from "./svgs/chat-lines.svg";
import chessRook from "./svgs/chess-rook.svg";
import collectbook from "./svgs/collectbook.svg";
Expand All @@ -43,6 +44,7 @@ import lens from "./svgs/lens.svg";
import navArrowLeft from "./svgs/nav-arrow-left.svg";
import navArrowRight from "./svgs/nav-arrow-right.svg";
import neighbourhood from "./svgs/neighbourhood.svg";
import notification from "./svgs/notification.svg";
import pageLeft from "./svgs/page-left.svg";
import pageRight from "./svgs/page-right.svg";
import planimetry from "./svgs/planimetry.svg";
Expand Down Expand Up @@ -83,6 +85,7 @@ const icons = {
brightCrown,
brightStar,
cellar,
chat,
chatLines,
chessRook,
collectbook,
Expand All @@ -106,6 +109,7 @@ const icons = {
navArrowLeft,
navArrowRight,
neighbourhood,
notification,
pageLeft,
pageRight,
planimetry,
Expand Down
3 changes: 3 additions & 0 deletions components/shared/Icon/icons/svgs/chat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions components/shared/Icon/icons/svgs/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions components/shared/Icon/icons/svgs/notification.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8a63c27

Please sign in to comment.