@ali-hajeh/purple-navbar 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +541 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +531 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles/navbar.css +563 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# @ali-hajeh/purple-navbar
|
|
2
|
+
|
|
3
|
+
A self-contained, composable navigation component with fixed purple-themed styles.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ali-hajeh/purple-navbar
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @ali-hajeh/purple-navbar
|
|
11
|
+
# or
|
|
12
|
+
yarn add @ali-hajeh/purple-navbar
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Navbar } from '@ali-hajeh/purple-navbar';
|
|
19
|
+
import '@ali-hajeh/purple-navbar/styles.css';
|
|
20
|
+
|
|
21
|
+
function App() {
|
|
22
|
+
return (
|
|
23
|
+
<Navbar
|
|
24
|
+
links={[
|
|
25
|
+
{
|
|
26
|
+
label: 'Protocols',
|
|
27
|
+
dropdown: [
|
|
28
|
+
{ label: 'Omnivaults', onClick: () => navigate('/') },
|
|
29
|
+
{ label: 'Agent', onClick: () => window.open('https://agent.noya.ai') },
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{ label: 'Space Race', onClick: () => navigate('/space-race') },
|
|
33
|
+
{ label: 'DeFi', comingSoon: true, tooltip: 'Coming soon' },
|
|
34
|
+
{
|
|
35
|
+
label: 'More',
|
|
36
|
+
dropdown: [
|
|
37
|
+
{ label: 'Docs', onClick: () => window.open('https://docs.noya.network') },
|
|
38
|
+
{ label: 'Contact Us', onClick: () => navigate('/contact-us') },
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
]}
|
|
42
|
+
actionButton={{
|
|
43
|
+
label: isConnected ? shortenAddress(address) : 'Connect Wallet',
|
|
44
|
+
onClick: isConnected ? openAccountModal : openConnectModal,
|
|
45
|
+
variant: isConnected ? 'connected' : 'primary',
|
|
46
|
+
}}
|
|
47
|
+
leftSlot={<NotificationsComponent />}
|
|
48
|
+
onLogoClick={() => navigate('/')}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Props
|
|
55
|
+
|
|
56
|
+
### Navbar
|
|
57
|
+
|
|
58
|
+
| Prop | Type | Description |
|
|
59
|
+
|------|------|-------------|
|
|
60
|
+
| `links` | `NavLinkItem[]` | Array of navigation links |
|
|
61
|
+
| `actionButton` | `ActionButtonProps` | Optional CTA button configuration |
|
|
62
|
+
| `leftSlot` | `ReactNode` | Content to render left of action button |
|
|
63
|
+
| `rightSlot` | `ReactNode` | Content to render right of action button |
|
|
64
|
+
| `onLogoClick` | `() => void` | Logo click handler |
|
|
65
|
+
| `onMobileMenuOpen` | `() => void` | Mobile drawer open callback |
|
|
66
|
+
| `mobileMenuOpen` | `boolean` | Controlled mode for drawer |
|
|
67
|
+
| `onMobileMenuClose` | `() => void` | Drawer close callback |
|
|
68
|
+
|
|
69
|
+
### NavLinkItem
|
|
70
|
+
|
|
71
|
+
| Prop | Type | Description |
|
|
72
|
+
|------|------|-------------|
|
|
73
|
+
| `label` | `string` | Link text |
|
|
74
|
+
| `onClick` | `() => void` | Click handler |
|
|
75
|
+
| `href` | `string` | Optional href for SEO |
|
|
76
|
+
| `comingSoon` | `boolean` | Shows "Soon" badge and disables click |
|
|
77
|
+
| `tooltip` | `string` | Tooltip text for coming soon items |
|
|
78
|
+
| `dropdown` | `DropdownItem[]` | Nested dropdown items |
|
|
79
|
+
|
|
80
|
+
### ActionButtonProps
|
|
81
|
+
|
|
82
|
+
| Prop | Type | Description |
|
|
83
|
+
|------|------|-------------|
|
|
84
|
+
| `label` | `string` | Button text |
|
|
85
|
+
| `onClick` | `() => void` | Click handler |
|
|
86
|
+
| `variant` | `'primary' \| 'connected'` | Button style variant |
|
|
87
|
+
|
|
88
|
+
## Features
|
|
89
|
+
|
|
90
|
+
- 🎨 Self-contained styles with unique `pn-` prefixed classes
|
|
91
|
+
- 📱 Responsive with mobile drawer
|
|
92
|
+
- ✨ Animated logo on hover
|
|
93
|
+
- 🎯 Configurable action handlers
|
|
94
|
+
- 🔌 Slot-based architecture for custom content
|
|
95
|
+
- 📦 Zero external dependencies (only React)
|
|
96
|
+
|
|
97
|
+
## Development
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Install dependencies
|
|
101
|
+
pnpm install
|
|
102
|
+
|
|
103
|
+
# Build the package
|
|
104
|
+
pnpm build
|
|
105
|
+
|
|
106
|
+
# Watch mode
|
|
107
|
+
pnpm dev
|
|
108
|
+
|
|
109
|
+
# Type check
|
|
110
|
+
pnpm typecheck
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT
|
|
116
|
+
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface DropdownItem {
|
|
4
|
+
label: string;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
interface NavLinkItem {
|
|
8
|
+
label: string;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
href?: string;
|
|
11
|
+
comingSoon?: boolean;
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
dropdown?: DropdownItem[];
|
|
14
|
+
}
|
|
15
|
+
interface ActionButtonProps {
|
|
16
|
+
label: string;
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
variant?: "primary" | "connected";
|
|
19
|
+
}
|
|
20
|
+
interface NavbarProps {
|
|
21
|
+
links: NavLinkItem[];
|
|
22
|
+
actionButton?: ActionButtonProps;
|
|
23
|
+
leftSlot?: React.ReactNode;
|
|
24
|
+
rightSlot?: React.ReactNode;
|
|
25
|
+
onLogoClick?: () => void;
|
|
26
|
+
onMobileMenuOpen?: () => void;
|
|
27
|
+
mobileMenuOpen?: boolean;
|
|
28
|
+
onMobileMenuClose?: () => void;
|
|
29
|
+
}
|
|
30
|
+
interface DrawerProps {
|
|
31
|
+
isOpen: boolean;
|
|
32
|
+
onClose: () => void;
|
|
33
|
+
links: NavLinkItem[];
|
|
34
|
+
actionButton?: ActionButtonProps;
|
|
35
|
+
onLogoClick?: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare const Navbar: React.FC<NavbarProps>;
|
|
39
|
+
|
|
40
|
+
interface NavbarLogoProps {
|
|
41
|
+
onClick?: () => void;
|
|
42
|
+
}
|
|
43
|
+
declare const NavbarLogo: React.FC<NavbarLogoProps>;
|
|
44
|
+
|
|
45
|
+
interface NavbarLinksProps {
|
|
46
|
+
links: NavLinkItem[];
|
|
47
|
+
}
|
|
48
|
+
declare const NavbarLinks: React.FC<NavbarLinksProps>;
|
|
49
|
+
|
|
50
|
+
interface NavbarDropdownProps {
|
|
51
|
+
items: DropdownItem[];
|
|
52
|
+
}
|
|
53
|
+
declare const NavbarDropdown: React.FC<NavbarDropdownProps>;
|
|
54
|
+
|
|
55
|
+
declare const NavbarActionButton: React.FC<ActionButtonProps>;
|
|
56
|
+
|
|
57
|
+
interface NavbarMobileToggleProps {
|
|
58
|
+
onClick?: () => void;
|
|
59
|
+
}
|
|
60
|
+
declare const NavbarMobileToggle: React.FC<NavbarMobileToggleProps>;
|
|
61
|
+
|
|
62
|
+
declare const NavbarDrawer: React.FC<DrawerProps>;
|
|
63
|
+
|
|
64
|
+
interface ExpandingTextProps {
|
|
65
|
+
text: string;
|
|
66
|
+
onClick?: () => void;
|
|
67
|
+
}
|
|
68
|
+
declare const ExpandingText: React.FC<ExpandingTextProps>;
|
|
69
|
+
|
|
70
|
+
type MobileOS = "Windows Phone" | "Android" | "iOS" | "unknown";
|
|
71
|
+
declare const getMobileOperatingSystem: () => MobileOS;
|
|
72
|
+
|
|
73
|
+
export { type ActionButtonProps, type DrawerProps, type DropdownItem, ExpandingText, type MobileOS, type NavLinkItem, Navbar, NavbarActionButton, NavbarDrawer, NavbarDropdown, NavbarLinks, NavbarLogo, NavbarMobileToggle, type NavbarProps, getMobileOperatingSystem };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface DropdownItem {
|
|
4
|
+
label: string;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
interface NavLinkItem {
|
|
8
|
+
label: string;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
href?: string;
|
|
11
|
+
comingSoon?: boolean;
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
dropdown?: DropdownItem[];
|
|
14
|
+
}
|
|
15
|
+
interface ActionButtonProps {
|
|
16
|
+
label: string;
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
variant?: "primary" | "connected";
|
|
19
|
+
}
|
|
20
|
+
interface NavbarProps {
|
|
21
|
+
links: NavLinkItem[];
|
|
22
|
+
actionButton?: ActionButtonProps;
|
|
23
|
+
leftSlot?: React.ReactNode;
|
|
24
|
+
rightSlot?: React.ReactNode;
|
|
25
|
+
onLogoClick?: () => void;
|
|
26
|
+
onMobileMenuOpen?: () => void;
|
|
27
|
+
mobileMenuOpen?: boolean;
|
|
28
|
+
onMobileMenuClose?: () => void;
|
|
29
|
+
}
|
|
30
|
+
interface DrawerProps {
|
|
31
|
+
isOpen: boolean;
|
|
32
|
+
onClose: () => void;
|
|
33
|
+
links: NavLinkItem[];
|
|
34
|
+
actionButton?: ActionButtonProps;
|
|
35
|
+
onLogoClick?: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare const Navbar: React.FC<NavbarProps>;
|
|
39
|
+
|
|
40
|
+
interface NavbarLogoProps {
|
|
41
|
+
onClick?: () => void;
|
|
42
|
+
}
|
|
43
|
+
declare const NavbarLogo: React.FC<NavbarLogoProps>;
|
|
44
|
+
|
|
45
|
+
interface NavbarLinksProps {
|
|
46
|
+
links: NavLinkItem[];
|
|
47
|
+
}
|
|
48
|
+
declare const NavbarLinks: React.FC<NavbarLinksProps>;
|
|
49
|
+
|
|
50
|
+
interface NavbarDropdownProps {
|
|
51
|
+
items: DropdownItem[];
|
|
52
|
+
}
|
|
53
|
+
declare const NavbarDropdown: React.FC<NavbarDropdownProps>;
|
|
54
|
+
|
|
55
|
+
declare const NavbarActionButton: React.FC<ActionButtonProps>;
|
|
56
|
+
|
|
57
|
+
interface NavbarMobileToggleProps {
|
|
58
|
+
onClick?: () => void;
|
|
59
|
+
}
|
|
60
|
+
declare const NavbarMobileToggle: React.FC<NavbarMobileToggleProps>;
|
|
61
|
+
|
|
62
|
+
declare const NavbarDrawer: React.FC<DrawerProps>;
|
|
63
|
+
|
|
64
|
+
interface ExpandingTextProps {
|
|
65
|
+
text: string;
|
|
66
|
+
onClick?: () => void;
|
|
67
|
+
}
|
|
68
|
+
declare const ExpandingText: React.FC<ExpandingTextProps>;
|
|
69
|
+
|
|
70
|
+
type MobileOS = "Windows Phone" | "Android" | "iOS" | "unknown";
|
|
71
|
+
declare const getMobileOperatingSystem: () => MobileOS;
|
|
72
|
+
|
|
73
|
+
export { type ActionButtonProps, type DrawerProps, type DropdownItem, ExpandingText, type MobileOS, type NavLinkItem, Navbar, NavbarActionButton, NavbarDrawer, NavbarDropdown, NavbarLinks, NavbarLogo, NavbarMobileToggle, type NavbarProps, getMobileOperatingSystem };
|