Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit fd09b30

Browse files
committed
add links
1 parent 20d50e1 commit fd09b30

File tree

2 files changed

+78
-18
lines changed

2 files changed

+78
-18
lines changed

src/primitives/Navbar/Navbar.stories.tsx

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22

3+
4+
35
import { DefaultLogo } from "@/assets";
46

7+
8+
59
import { Navbar } from "./Navbar";
10+
import { Button } from "../Button";
11+
12+
13+
// Adjust the path as needed
614

715
const meta = {
816
title: "Primitives/Navbar",
@@ -11,10 +19,19 @@ const meta = {
1119
text: "My Navbar",
1220
},
1321
argTypes: {
14-
logo1: {
22+
primaryLogo: {
23+
control: "text",
24+
},
25+
secondaryLogo: {
1526
control: "text",
1627
},
17-
logo2: {
28+
primaryLogoLink: {
29+
control: "text",
30+
},
31+
secondaryLogoLink: {
32+
control: "text",
33+
},
34+
textLink: {
1835
control: "text",
1936
},
2037
text: {
@@ -30,23 +47,38 @@ export default meta;
3047

3148
type Story = StoryObj<typeof Navbar>;
3249

33-
export const Default: Story = {};
50+
export const Default: Story = {
51+
args: {
52+
primaryLogoLink: "#",
53+
secondaryLogo: DefaultLogo,
54+
secondaryLogoLink: "#",
55+
textLink: "#",
56+
},
57+
};
3458

35-
export const WithSecondLogo: Story = {
59+
export const WithSecondaryLogo: Story = {
3660
args: {
37-
logo2: DefaultLogo,
61+
primaryLogoLink: "#",
62+
secondaryLogo: DefaultLogo,
63+
secondaryLogoLink: "#",
64+
textLink: "#",
3865
},
3966
};
4067

4168
export const WithCustomTextAndWithoutDivider: Story = {
4269
args: {
70+
primaryLogoLink: "#",
4371
text: "Custom Navbar",
72+
textLink: "#",
4473
showDivider: false,
4574
},
4675
};
4776

4877
export const WithChildren: Story = {
4978
args: {
50-
children: <button>Login</button>,
79+
secondaryLogo: DefaultLogo,
80+
secondaryLogoLink: "#",
81+
textLink: "#",
82+
children: <Button value="Connect Wallet"/>,
5183
},
52-
};
84+
};

src/primitives/Navbar/Navbar.tsx

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,63 @@ const navbarVariants = tv({
1010
slots: {
1111
base: "top-0 flex h-[64px] w-full shrink-0 flex-col items-center justify-center gap-2 p-[10px_80px]",
1212
container: "flex w-full items-center justify-between",
13-
left: "flex items-center gap-4",
13+
leftSection: "flex items-center gap-4",
1414
logo: "h-10",
1515
divider: "h-4 border-r border-grey-700",
1616
text: "text-lg font-semibold",
17-
right: "flex items-center",
17+
rightSection: "flex items-center",
1818
},
1919
});
2020

2121
export interface NavbarProps {
22-
logo1?: string;
23-
logo2?: string;
22+
primaryLogo?: string;
23+
secondaryLogo?: string;
2424
showDivider?: boolean;
2525
text: string;
26+
primaryLogoLink?: string;
27+
secondaryLogoLink?: string;
28+
textLink?: string;
2629
children?: React.ReactNode;
2730
}
2831

29-
export const Navbar = ({ logo1, logo2, showDivider = true, text, children }: NavbarProps) => {
30-
const { base, container, left, logo, divider, text: textStyle, right } = navbarVariants();
32+
export const Navbar = ({
33+
primaryLogo,
34+
secondaryLogo,
35+
showDivider = true,
36+
text,
37+
primaryLogoLink,
38+
secondaryLogoLink,
39+
textLink,
40+
children,
41+
}: NavbarProps) => {
42+
const {
43+
base,
44+
container,
45+
leftSection,
46+
logo,
47+
divider,
48+
text: textStyle,
49+
rightSection,
50+
} = navbarVariants();
3151

3252
return (
3353
<nav className={base()}>
3454
<div className={container()}>
35-
<div className={left()}>
36-
<img src={logo1 || defaultLogo} alt="Logo 1" className={logo()} />
55+
<div className={leftSection()}>
56+
<a href={primaryLogoLink || "#"}>
57+
<img src={primaryLogo || defaultLogo} alt="Primary Logo" className={logo()} />
58+
</a>
3759
{showDivider && <div className={divider()}></div>}
38-
{logo2 && <img src={logo2} alt="Logo 2" className={logo()} />}
39-
<span className={textStyle()}>{text}</span>
60+
{secondaryLogo && (
61+
<a href={secondaryLogoLink || "#"}>
62+
<img src={secondaryLogo} alt="Secondary Logo" className={logo()} />
63+
</a>
64+
)}
65+
<a href={textLink || "#"} className={textStyle()}>
66+
{text}
67+
</a>
4068
</div>
41-
<div className={right()}>{children}</div>
69+
<div className={rightSection()}>{children}</div>
4270
</div>
4371
</nav>
4472
);

0 commit comments

Comments
 (0)