trepur_components 0.1.24 → 0.1.25
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/dist/components/Nav/Nav.stories.js +96 -17
- package/dist/components/Nav/README.md +20 -0
- package/dist/components/Nav/index.js +130 -50
- package/dist/components/NavItem/NavItem.stories.js +150 -0
- package/dist/components/NavItem/README.md +36 -0
- package/dist/components/NavItem/index.js +77 -0
- package/dist/components/Profile/index.js +3 -2
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports._Nav = exports.NavWithSearchAndProfile = exports.NavWithSearch = exports.NavWithProfile = exports.NavAligned = void 0;
|
|
6
|
+
exports.default = exports._NavWithColors = exports._Nav = exports.NavWithSearchAndProfile = exports.NavWithSearch = exports.NavWithProfile = exports.NavAlignedWithSearchAndProfile = exports.NavAlignedWithSearch = exports.NavAlignedWithProfile = exports.NavAligned = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -35,9 +35,7 @@ const links = [{
|
|
|
35
35
|
var _default = {
|
|
36
36
|
title: 'Components/Nav',
|
|
37
37
|
argTypes: {},
|
|
38
|
-
decorators: [story => /*#__PURE__*/_react.default.createElement("div",
|
|
39
|
-
className: "p-4"
|
|
40
|
-
}, story())],
|
|
38
|
+
decorators: [story => /*#__PURE__*/_react.default.createElement("div", null, story())],
|
|
41
39
|
parameters: {
|
|
42
40
|
readme: {
|
|
43
41
|
sidebar: _README.default
|
|
@@ -50,20 +48,52 @@ const _Nav = args => {
|
|
|
50
48
|
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
51
49
|
links: links,
|
|
52
50
|
navPosition: "1",
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
logoImage: _logoWhite.default
|
|
51
|
+
logoImage: _logoWhite.default,
|
|
52
|
+
icon: _user.default,
|
|
53
|
+
navItemRounded: false
|
|
57
54
|
});
|
|
58
55
|
};
|
|
59
56
|
|
|
60
57
|
exports._Nav = _Nav;
|
|
61
58
|
|
|
59
|
+
const _NavWithColors = args => {
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
61
|
+
links: links,
|
|
62
|
+
navPosition: "1" //center
|
|
63
|
+
,
|
|
64
|
+
logoImage: _logoWhite.default,
|
|
65
|
+
icon: _user.default,
|
|
66
|
+
navItemBorderColor: "white",
|
|
67
|
+
navItemTextColor: "white",
|
|
68
|
+
navItemBgColor: "#38B6FF",
|
|
69
|
+
hoverNavItemBorderColor: "#38B6FF",
|
|
70
|
+
hoverNavItemTextColor: "#38B6FF",
|
|
71
|
+
hoverNavItemBgColor: "white",
|
|
72
|
+
bgColor: "#38B6FF",
|
|
73
|
+
navItemBordered: true,
|
|
74
|
+
navItemRounded: true,
|
|
75
|
+
showProfile: false,
|
|
76
|
+
showSearch: false,
|
|
77
|
+
alignNavAndLogo: true,
|
|
78
|
+
navItemLinkClassNames: "py-1",
|
|
79
|
+
mobileNavItemBordered: false,
|
|
80
|
+
mobileNavItemRounded: true,
|
|
81
|
+
mobileNavItemLinkClassNames: "",
|
|
82
|
+
mobileNavItemClassNames: "",
|
|
83
|
+
mobileNavButtonBgColor: "#38B6FF",
|
|
84
|
+
mobileNavButtonColor: "white",
|
|
85
|
+
hoverMobileNavButtonBgColor: "white",
|
|
86
|
+
hoverMobileNavButtonColor: "#38B6FF"
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports._NavWithColors = _NavWithColors;
|
|
91
|
+
|
|
62
92
|
const NavWithSearch = () => {
|
|
63
93
|
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
64
94
|
links: links,
|
|
65
95
|
navPosition: "1",
|
|
66
|
-
navClass: "bg-brand-primary
|
|
96
|
+
navClass: "bg-brand-primary",
|
|
67
97
|
navLinkClass: "px-2 py-2 rounded-lg flex-1 hover:text-white hover:bg-black",
|
|
68
98
|
logoClass: "py-4",
|
|
69
99
|
showSearch: true,
|
|
@@ -77,7 +107,7 @@ const NavWithProfile = () => {
|
|
|
77
107
|
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
78
108
|
links: links,
|
|
79
109
|
navPosition: "1",
|
|
80
|
-
navClass: "bg-brand-primary
|
|
110
|
+
navClass: "bg-brand-primary",
|
|
81
111
|
navLinkClass: "px-2 py-2 rounded-lg flex-1 hover:text-white hover:bg-black",
|
|
82
112
|
logoClass: "py-4",
|
|
83
113
|
showProfile: true,
|
|
@@ -92,12 +122,13 @@ const NavWithSearchAndProfile = () => {
|
|
|
92
122
|
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
93
123
|
links: links,
|
|
94
124
|
navPosition: "1",
|
|
95
|
-
navClass: "bg-brand-primary
|
|
125
|
+
navClass: "bg-brand-primary",
|
|
96
126
|
navLinkClass: "px-2 py-2 rounded-lg flex-1 hover:text-white hover:bg-black",
|
|
97
127
|
logoClass: "py-4",
|
|
98
128
|
showProfile: true,
|
|
99
129
|
showSearch: true,
|
|
100
|
-
logoImage: _logoWhite.default
|
|
130
|
+
logoImage: _logoWhite.default,
|
|
131
|
+
icon: _user.default
|
|
101
132
|
});
|
|
102
133
|
};
|
|
103
134
|
|
|
@@ -107,12 +138,60 @@ const NavAligned = () => {
|
|
|
107
138
|
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
108
139
|
links: links,
|
|
109
140
|
navPosition: "1",
|
|
110
|
-
navClass: "bg-brand-primary
|
|
111
|
-
navLinkClass: "
|
|
112
|
-
logoClass: "py-4",
|
|
141
|
+
navClass: "bg-brand-primary",
|
|
142
|
+
navLinkClass: "hover:text-white hover:bg-black",
|
|
113
143
|
alignNavAndLogo: true,
|
|
114
|
-
logoImage: _logoWhite.default
|
|
144
|
+
logoImage: _logoWhite.default,
|
|
145
|
+
icon: _user.default
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
exports.NavAligned = NavAligned;
|
|
150
|
+
|
|
151
|
+
const NavAlignedWithSearch = () => {
|
|
152
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
153
|
+
links: links,
|
|
154
|
+
navPosition: "1",
|
|
155
|
+
navClass: "bg-brand-primary",
|
|
156
|
+
navLinkClass: "hover:text-white hover:bg-black",
|
|
157
|
+
alignNavAndLogo: true,
|
|
158
|
+
logoImage: _logoWhite.default,
|
|
159
|
+
icon: _user.default,
|
|
160
|
+
showProfile: false,
|
|
161
|
+
showSearch: true
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
exports.NavAlignedWithSearch = NavAlignedWithSearch;
|
|
166
|
+
|
|
167
|
+
const NavAlignedWithProfile = () => {
|
|
168
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
169
|
+
links: links,
|
|
170
|
+
navPosition: "1",
|
|
171
|
+
navClass: "bg-brand-primary",
|
|
172
|
+
navLinkClass: "hover:text-white hover:bg-black",
|
|
173
|
+
alignNavAndLogo: true,
|
|
174
|
+
logoImage: _logoWhite.default,
|
|
175
|
+
icon: _user.default,
|
|
176
|
+
showProfile: true,
|
|
177
|
+
showSearch: false
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
exports.NavAlignedWithProfile = NavAlignedWithProfile;
|
|
182
|
+
|
|
183
|
+
const NavAlignedWithSearchAndProfile = () => {
|
|
184
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
185
|
+
links: links,
|
|
186
|
+
navPosition: "1",
|
|
187
|
+
navClass: "bg-brand-primary",
|
|
188
|
+
navLinkClass: "hover:text-white hover:bg-black",
|
|
189
|
+
alignNavAndLogo: true,
|
|
190
|
+
logoImage: _logoWhite.default,
|
|
191
|
+
icon: _user.default,
|
|
192
|
+
showProfile: true,
|
|
193
|
+
showSearch: true
|
|
115
194
|
});
|
|
116
195
|
};
|
|
117
196
|
|
|
118
|
-
exports.
|
|
197
|
+
exports.NavAlignedWithSearchAndProfile = NavAlignedWithSearchAndProfile;
|
|
@@ -23,3 +23,23 @@ A personalisable naviagtion bar, suitable for desktop and mobile
|
|
|
23
23
|
`showSearch={boolean} (default=null)`
|
|
24
24
|
`showProfile={boolean} (default=null)`
|
|
25
25
|
`icon={string} (default=null)`
|
|
26
|
+
`logoImage={string} (default=null)`
|
|
27
|
+
`navItemBorderColor={string} (default=null)`
|
|
28
|
+
`navItemTextColor={string} (default=null)`
|
|
29
|
+
`navItemBgColor={string} (default=null)`
|
|
30
|
+
`hoverNavItemBorderColor={string} (default=null)`
|
|
31
|
+
`hoverNavItemTextColor={string} (default=null)`
|
|
32
|
+
`hoverNavItemBgColor={string} (default=null)`
|
|
33
|
+
`bgColor={string} (default=null)`
|
|
34
|
+
`navItemBordered={string} (default=null)`
|
|
35
|
+
`navItemRounded={string} (default=null)`
|
|
36
|
+
`navItemClassNames={string} (default=null)`
|
|
37
|
+
`navItemLinkClassNames={string} (default=null)`
|
|
38
|
+
`mobileNavItemBordered={string} (default=null)`
|
|
39
|
+
`mobileNavItemRounded={string} (default=null)`
|
|
40
|
+
`mobileNavItemClassNames={string} (default=null)`
|
|
41
|
+
`mobileNavItemLinkClassNames={string} (default=null)`
|
|
42
|
+
`mobileNavButtonBgColor={string} (default=null)`
|
|
43
|
+
`mobileNavButtonColor={string} (default=null)`
|
|
44
|
+
`hoverMobileNavButtonBgColor={string} (default=null)`
|
|
45
|
+
`hoverMobileNavButtonColor={string} (default=null)`
|
|
@@ -13,6 +13,8 @@ var _index = _interopRequireDefault(require("../Profile/index"));
|
|
|
13
13
|
|
|
14
14
|
var _index2 = _interopRequireDefault(require("../Search/index"));
|
|
15
15
|
|
|
16
|
+
var _index3 = _interopRequireDefault(require("../NavItem/index"));
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -30,7 +32,26 @@ const Header = _ref => {
|
|
|
30
32
|
showSearch,
|
|
31
33
|
showProfile,
|
|
32
34
|
icon,
|
|
33
|
-
logoImage
|
|
35
|
+
logoImage,
|
|
36
|
+
navItemBorderColor,
|
|
37
|
+
navItemTextColor,
|
|
38
|
+
navItemBgColor,
|
|
39
|
+
hoverNavItemBorderColor,
|
|
40
|
+
hoverNavItemTextColor,
|
|
41
|
+
hoverNavItemBgColor,
|
|
42
|
+
bgColor,
|
|
43
|
+
navItemBordered,
|
|
44
|
+
navItemRounded,
|
|
45
|
+
navItemClassNames,
|
|
46
|
+
navItemLinkClassNames,
|
|
47
|
+
mobileNavItemBordered,
|
|
48
|
+
mobileNavItemRounded,
|
|
49
|
+
mobileNavItemClassNames,
|
|
50
|
+
mobileNavItemLinkClassNames,
|
|
51
|
+
mobileNavButtonBgColor,
|
|
52
|
+
mobileNavButtonColor,
|
|
53
|
+
hoverMobileNavButtonBgColor,
|
|
54
|
+
hoverMobileNavButtonColor
|
|
34
55
|
} = _ref;
|
|
35
56
|
const user = icon ? icon : '';
|
|
36
57
|
const [mobileMenuState, setmobileMenuState] = (0, _react.useState)(false);
|
|
@@ -47,14 +68,19 @@ const Header = _ref => {
|
|
|
47
68
|
name: 'PROFILE ITEM 4',
|
|
48
69
|
reference: '/'
|
|
49
70
|
}];
|
|
50
|
-
let
|
|
71
|
+
let backgroundColor = bgColor ? bgColor : 'grey';
|
|
72
|
+
let containsSearchOrProfile = showSearch ? showSearch : showProfile;
|
|
73
|
+
let flexType = containsSearchOrProfile ? 'flex-col w-full' : 'flex-1 ';
|
|
74
|
+
let combinedLogoClass = logoClass;
|
|
75
|
+
let navItemTopPadding = 'pt-2';
|
|
51
76
|
let combinedMobileLogoClass = logoClass + ' sm:hidden block flex-1 flex items-center justify-center sm:items-stretch ';
|
|
52
|
-
let linkContainerClass = 'flex-1 flex
|
|
77
|
+
let linkContainerClass = 'flex-1 flex ';
|
|
78
|
+
let logoHeight = 16;
|
|
53
79
|
|
|
54
|
-
if (alignNavAndLogo) {
|
|
55
|
-
combinedLogoClass
|
|
80
|
+
if (!alignNavAndLogo) {
|
|
81
|
+
combinedLogoClass += ' flex justify-center ';
|
|
56
82
|
} else {
|
|
57
|
-
|
|
83
|
+
navItemTopPadding = containsSearchOrProfile ? '' : 'pt-' + logoHeight / 4;
|
|
58
84
|
}
|
|
59
85
|
|
|
60
86
|
if (navPosition === '0') {
|
|
@@ -67,23 +93,48 @@ const Header = _ref => {
|
|
|
67
93
|
|
|
68
94
|
if (navPosition === '2') {
|
|
69
95
|
linkContainerClass += 'sm:justify-end';
|
|
70
|
-
}
|
|
96
|
+
} //---------- Styling ---------------
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const [styles, setStyles] = (0, _react.useState)({
|
|
100
|
+
'background-color': mobileNavButtonBgColor ? mobileNavButtonBgColor : 'white',
|
|
101
|
+
color: mobileNavButtonColor ? mobileNavButtonColor : 'black'
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const setHoverState = isHovering => {
|
|
105
|
+
if (isHovering) {
|
|
106
|
+
setStyles({
|
|
107
|
+
'background-color': hoverMobileNavButtonBgColor ? hoverMobileNavButtonBgColor : 'black',
|
|
108
|
+
color: hoverMobileNavButtonColor ? hoverMobileNavButtonColor : 'white'
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
setStyles({
|
|
112
|
+
'background-color': mobileNavButtonBgColor ? mobileNavButtonBgColor : 'white',
|
|
113
|
+
color: mobileNavButtonColor ? mobileNavButtonColor : 'black'
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}; //-----------------------------------
|
|
117
|
+
|
|
71
118
|
|
|
72
119
|
return /*#__PURE__*/_react.default.createElement("nav", {
|
|
120
|
+
style: {
|
|
121
|
+
'background-color': backgroundColor
|
|
122
|
+
},
|
|
73
123
|
id: "nav",
|
|
74
|
-
className: navClass
|
|
75
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
76
|
-
className: "px-4"
|
|
77
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
+
className: 'p-2 ' + navClass
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
126
|
id: "sm-nav",
|
|
79
127
|
className: "relative flex items-center justify-between h-16 sm:hidden"
|
|
80
128
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
81
129
|
id: "nav-collapse-btn-wrapper",
|
|
82
130
|
className: "absolute inset-y-0 left-0 flex items-center"
|
|
83
131
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
132
|
+
style: styles,
|
|
133
|
+
onMouseOver: () => setHoverState(true),
|
|
134
|
+
onMouseOut: () => setHoverState(false),
|
|
84
135
|
onClick: () => setmobileMenuState(!mobileMenuState),
|
|
85
136
|
type: "button",
|
|
86
|
-
className: "inline-flex items-center justify-center p-2 rounded-md
|
|
137
|
+
className: "inline-flex items-center justify-center p-2 rounded-md focus:ring-2 focus:ring-inset focus:ring-white",
|
|
87
138
|
"aria-controls": "mobile-menu",
|
|
88
139
|
"aria-expanded": "false"
|
|
89
140
|
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
@@ -112,67 +163,96 @@ const Header = _ref => {
|
|
|
112
163
|
src: logoImage,
|
|
113
164
|
alt: " Logo "
|
|
114
165
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
115
|
-
|
|
116
|
-
Name: "hidden sm:block pt-2 items-center justify-between sm:items-stretch text-center"
|
|
166
|
+
className: "hidden sm:block items-center justify-between sm:items-stretch text-center"
|
|
117
167
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
118
|
-
className:
|
|
168
|
+
className: alignNavAndLogo ? 'flex' : ''
|
|
119
169
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
120
170
|
id: "logo",
|
|
121
171
|
className: combinedLogoClass
|
|
122
172
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
123
|
-
className: "h-
|
|
173
|
+
className: "h-" + logoHeight,
|
|
124
174
|
src: logoImage,
|
|
125
175
|
alt: " Logo "
|
|
126
|
-
})),
|
|
127
|
-
className:
|
|
176
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
+
className: 'flex ' + flexType
|
|
178
|
+
}, containsSearchOrProfile && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
179
|
+
className: "flex float-right"
|
|
180
|
+
}, showSearch && /*#__PURE__*/_react.default.createElement(_index2.default, {
|
|
181
|
+
placeholder: "search"
|
|
128
182
|
}), showProfile && /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
129
183
|
profileLinks: profileLinks,
|
|
130
|
-
userImage: user
|
|
131
|
-
|
|
132
|
-
|
|
184
|
+
userImage: user,
|
|
185
|
+
classNames: "ml-2"
|
|
186
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
187
|
+
id: "nav-items-container",
|
|
133
188
|
className: linkContainerClass
|
|
134
189
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
135
190
|
id: "nav-block",
|
|
136
|
-
className: "hidden sm:inline-flex
|
|
191
|
+
className: "hidden sm:inline-flex"
|
|
137
192
|
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
138
193
|
id: "nav-list",
|
|
139
|
-
className:
|
|
194
|
+
className: 'flex ' + navItemTopPadding
|
|
140
195
|
}, links && links.map(link => {
|
|
141
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
196
|
+
return /*#__PURE__*/_react.default.createElement(_index3.default, {
|
|
197
|
+
name: link.name,
|
|
198
|
+
url: link.reference,
|
|
199
|
+
borderColor: navItemBorderColor,
|
|
200
|
+
textColor: navItemTextColor,
|
|
201
|
+
bgColor: navItemBgColor,
|
|
202
|
+
hoverBorderColor: hoverNavItemBorderColor,
|
|
203
|
+
hoverTextColor: hoverNavItemTextColor,
|
|
204
|
+
hoverBgColor: hoverNavItemBgColor,
|
|
205
|
+
bordered: navItemBordered,
|
|
206
|
+
rounded: navItemRounded,
|
|
207
|
+
classNames: navItemClassNames,
|
|
208
|
+
linkClassNames: navItemLinkClassNames
|
|
209
|
+
});
|
|
210
|
+
})))))))), mobileMenuState && /*#__PURE__*/_react.default.createElement("div", {
|
|
150
211
|
className: "sm:hidden",
|
|
151
212
|
id: "mobile-menu"
|
|
152
|
-
},
|
|
153
|
-
className: "ml-
|
|
213
|
+
}, showSearch && /*#__PURE__*/_react.default.createElement(_index2.default, {
|
|
214
|
+
className: "ml-4 py-4 flex flex-1",
|
|
215
|
+
placeholder: 'Search'
|
|
216
|
+
}), showProfile && /*#__PURE__*/_react.default.createElement("img", {
|
|
217
|
+
className: "ml-8 h-8 w-8 rounded-full",
|
|
154
218
|
src: user,
|
|
155
219
|
alt: ""
|
|
156
|
-
}), showSearch && /*#__PURE__*/_react.default.createElement(_index2.default, {
|
|
157
|
-
className: "flex flex-1"
|
|
158
220
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
159
221
|
className: "px-2 pt-2 pb-3 space-y-1"
|
|
160
222
|
}, links && links.map(link => {
|
|
161
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
223
|
+
return /*#__PURE__*/_react.default.createElement(_index3.default, {
|
|
224
|
+
name: link.name,
|
|
225
|
+
url: link.reference,
|
|
226
|
+
borderColor: navItemBorderColor,
|
|
227
|
+
textColor: navItemTextColor,
|
|
228
|
+
bgColor: navItemBgColor,
|
|
229
|
+
hoverBorderColor: hoverNavItemBorderColor,
|
|
230
|
+
hoverTextColor: hoverNavItemTextColor,
|
|
231
|
+
hoverBgColor: hoverNavItemBgColor,
|
|
232
|
+
bordered: mobileNavItemBordered,
|
|
233
|
+
rounded: mobileNavItemRounded,
|
|
234
|
+
classNames: mobileNavItemClassNames,
|
|
235
|
+
linkClassNames: mobileNavItemLinkClassNames
|
|
236
|
+
});
|
|
237
|
+
}), /*#__PURE__*/_react.default.createElement("hr", {
|
|
238
|
+
style: {
|
|
239
|
+
'color': navItemTextColor
|
|
240
|
+
}
|
|
167
241
|
}), showProfile && profileLinks && profileLinks.map(link => {
|
|
168
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
242
|
+
return /*#__PURE__*/_react.default.createElement(_index3.default, {
|
|
243
|
+
name: link.name,
|
|
244
|
+
url: link.reference,
|
|
245
|
+
borderColor: navItemBorderColor,
|
|
246
|
+
textColor: navItemTextColor,
|
|
247
|
+
bgColor: navItemBgColor,
|
|
248
|
+
hoverBorderColor: hoverNavItemBorderColor,
|
|
249
|
+
hoverTextColor: hoverNavItemTextColor,
|
|
250
|
+
hoverBgColor: hoverNavItemBgColor,
|
|
251
|
+
bordered: mobileNavItemBordered,
|
|
252
|
+
rounded: mobileNavItemRounded,
|
|
253
|
+
classNames: mobileNavItemClassNames,
|
|
254
|
+
linkClassNames: mobileNavItemLinkClassNames
|
|
255
|
+
});
|
|
176
256
|
}))));
|
|
177
257
|
};
|
|
178
258
|
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withStyles = exports.default = exports._NavItem = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _addonActions = require("@storybook/addon-actions");
|
|
11
|
+
|
|
12
|
+
var _README = _interopRequireDefault(require("./README.md"));
|
|
13
|
+
|
|
14
|
+
var _index = _interopRequireDefault(require("./index"));
|
|
15
|
+
|
|
16
|
+
require("../../../index.css");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
var _default = {
|
|
21
|
+
title: 'Components/NavItem',
|
|
22
|
+
argTypes: {
|
|
23
|
+
name: {
|
|
24
|
+
name: 'item Text',
|
|
25
|
+
control: {
|
|
26
|
+
type: 'text'
|
|
27
|
+
},
|
|
28
|
+
defaultValue: 'NavItem 1',
|
|
29
|
+
table: {
|
|
30
|
+
category: 'Standard',
|
|
31
|
+
subcategory: 'Content'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
url: {
|
|
35
|
+
name: 'url reference',
|
|
36
|
+
control: {
|
|
37
|
+
type: 'text'
|
|
38
|
+
},
|
|
39
|
+
defaultValue: '/',
|
|
40
|
+
table: {
|
|
41
|
+
category: 'Standard',
|
|
42
|
+
subcategory: 'Content'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
bgColor: {
|
|
46
|
+
name: 'Background Color',
|
|
47
|
+
control: {
|
|
48
|
+
type: 'color'
|
|
49
|
+
},
|
|
50
|
+
table: {
|
|
51
|
+
category: 'Standard',
|
|
52
|
+
subcategory: 'Colors'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
textColor: {
|
|
56
|
+
name: 'Text Color',
|
|
57
|
+
control: {
|
|
58
|
+
type: 'color'
|
|
59
|
+
},
|
|
60
|
+
table: {
|
|
61
|
+
category: 'Standard',
|
|
62
|
+
subcategory: 'Colors'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
borderColor: {
|
|
66
|
+
name: 'Border Color',
|
|
67
|
+
control: {
|
|
68
|
+
type: 'color'
|
|
69
|
+
},
|
|
70
|
+
table: {
|
|
71
|
+
category: 'Standard',
|
|
72
|
+
subcategory: 'Colors'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
hoverBgColor: {
|
|
76
|
+
name: 'Background Color',
|
|
77
|
+
control: {
|
|
78
|
+
type: 'color'
|
|
79
|
+
},
|
|
80
|
+
table: {
|
|
81
|
+
category: 'Hover',
|
|
82
|
+
subcategory: 'Colors'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
hoverTextColor: {
|
|
86
|
+
name: 'Text Color',
|
|
87
|
+
control: {
|
|
88
|
+
type: 'color'
|
|
89
|
+
},
|
|
90
|
+
table: {
|
|
91
|
+
category: 'Hover',
|
|
92
|
+
subcategory: 'Colors'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
hoverBorderColor: {
|
|
96
|
+
name: 'Border Color',
|
|
97
|
+
control: {
|
|
98
|
+
type: 'color'
|
|
99
|
+
},
|
|
100
|
+
table: {
|
|
101
|
+
category: 'Hover',
|
|
102
|
+
subcategory: 'Colors'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
decorators: [story => /*#__PURE__*/_react.default.createElement("div", {
|
|
107
|
+
className: "p-4"
|
|
108
|
+
}, story())],
|
|
109
|
+
parameters: {
|
|
110
|
+
readme: {
|
|
111
|
+
sidebar: _README.default
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
exports.default = _default;
|
|
116
|
+
|
|
117
|
+
const _NavItem = args => {
|
|
118
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
119
|
+
name: args.name,
|
|
120
|
+
url: args.url,
|
|
121
|
+
onClick: (0, _addonActions.action)('NavItem-click'),
|
|
122
|
+
bgColor: args.bgColor,
|
|
123
|
+
textColor: args.textColor,
|
|
124
|
+
borderColor: args.borderColor,
|
|
125
|
+
hoverTextColor: args.hoverTextColor,
|
|
126
|
+
hoverBgColor: args.hoverBgColor,
|
|
127
|
+
hoverBorderColor: args.hoverBorderColor,
|
|
128
|
+
bordered: true,
|
|
129
|
+
rounded: true,
|
|
130
|
+
linkClassNames: "py-1"
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
exports._NavItem = _NavItem;
|
|
135
|
+
|
|
136
|
+
const withStyles = args => {
|
|
137
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
138
|
+
name: args.name,
|
|
139
|
+
url: args.url,
|
|
140
|
+
onClick: (0, _addonActions.action)('NavItem-click'),
|
|
141
|
+
bgColor: args.bgColor,
|
|
142
|
+
textColor: args.textColor,
|
|
143
|
+
borderColor: args.borderColor,
|
|
144
|
+
hoverTextColor: args.hoverTextColor,
|
|
145
|
+
hoverBgColor: args.hoverBgColor,
|
|
146
|
+
hoverBorderColor: args.hoverBorderColor
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
exports.withStyles = withStyles;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
A basic button
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<Button
|
|
9
|
+
ctaText={args.text}
|
|
10
|
+
bgColor={args.bgColor}
|
|
11
|
+
textColor={args.textColor}
|
|
12
|
+
borderColor={args.borderColor}
|
|
13
|
+
hoverCtaText={args.hoverText}
|
|
14
|
+
hoverTextColor={args.hoverTextColor}
|
|
15
|
+
hoverBgColor={args.hoverBgColor}
|
|
16
|
+
hoverBorderColor={args.hoverBorderColor}
|
|
17
|
+
onClick={action('button-click')}
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
`ctaText={string} (default=null)`
|
|
23
|
+
`className={string} (default=null)`
|
|
24
|
+
`onClick={func} (default=null)`
|
|
25
|
+
`leftIcon={string} (default=null)`
|
|
26
|
+
`rightIcon={string} (default=null)`
|
|
27
|
+
`centerIcon={string} (default=null)`
|
|
28
|
+
`bgColor={string} (default=null)`
|
|
29
|
+
`textColor={string} (default=null)`
|
|
30
|
+
`borderColor={string} (default=null)`
|
|
31
|
+
`hoverBgColor={string} (default=null)`
|
|
32
|
+
`hoverTextColor={string} (default=null)`
|
|
33
|
+
`hoverBorderColor={string} (default=null)`
|
|
34
|
+
`hoverCtaText={string} (default=null)`
|
|
35
|
+
`url={string} (default=null)`
|
|
36
|
+
`buttonType={string} (default=null)`
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
const NavItem = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
classNames,
|
|
19
|
+
linkClassNames,
|
|
20
|
+
name,
|
|
21
|
+
url,
|
|
22
|
+
onClick,
|
|
23
|
+
borderColor,
|
|
24
|
+
textColor,
|
|
25
|
+
bgColor,
|
|
26
|
+
hoverBorderColor,
|
|
27
|
+
hoverTextColor,
|
|
28
|
+
hoverBgColor,
|
|
29
|
+
bordered,
|
|
30
|
+
rounded
|
|
31
|
+
} = _ref;
|
|
32
|
+
let linkClasses = linkClassNames ? linkClassNames : ''; //---------- Styling ---------------
|
|
33
|
+
|
|
34
|
+
const [styles, setStyles] = (0, _react.useState)({
|
|
35
|
+
'backgroundColor': bgColor ? bgColor : 'white',
|
|
36
|
+
color: textColor ? textColor : 'black',
|
|
37
|
+
'borderColor': borderColor ? borderColor : 'black'
|
|
38
|
+
});
|
|
39
|
+
const [hovering, setHovering] = (0, _react.useState)(false);
|
|
40
|
+
|
|
41
|
+
const setHoverState = isHovering => {
|
|
42
|
+
if (isHovering) {
|
|
43
|
+
setHovering(true);
|
|
44
|
+
setStyles({
|
|
45
|
+
'backgroundColor': hoverBgColor ? hoverBgColor : 'black',
|
|
46
|
+
color: hoverTextColor ? hoverTextColor : 'white',
|
|
47
|
+
'borderColor': hoverBorderColor ? hoverBorderColor : 'black'
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
setHovering(false);
|
|
51
|
+
setStyles({
|
|
52
|
+
'backgroundColor': bgColor ? bgColor : 'white',
|
|
53
|
+
color: textColor ? textColor : 'black',
|
|
54
|
+
'borderColor': borderColor ? borderColor : 'black'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}; //-----------------------------------
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
let borderClass = bordered ? ' border ' : '';
|
|
61
|
+
let round = rounded ? ' rounded-lg ' : '';
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
+
className: 'w-32 list-none ' + classNames
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
65
|
+
href: url
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement("li", {
|
|
67
|
+
style: styles,
|
|
68
|
+
onMouseOver: () => setHoverState(true),
|
|
69
|
+
onMouseOut: () => setHoverState(false),
|
|
70
|
+
key: name,
|
|
71
|
+
className: "px-4 mx-2 " + linkClasses + borderClass + round,
|
|
72
|
+
onClick: onClick
|
|
73
|
+
}, name)));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var _default = NavItem;
|
|
77
|
+
exports.default = _default;
|
|
@@ -18,14 +18,15 @@ const Profile = _ref => {
|
|
|
18
18
|
profileLinks,
|
|
19
19
|
alignRight,
|
|
20
20
|
alignLeft,
|
|
21
|
-
userImage
|
|
21
|
+
userImage,
|
|
22
|
+
classNames
|
|
22
23
|
} = _ref;
|
|
23
24
|
let profileAlignment = alignRight ? ' float-right ' : alignLeft ? ' float-left ' : '';
|
|
24
25
|
let dropdownAlignement = alignRight ? ' mt-16 -mr-16 ' : alignLeft ? ' mt-16 -ml-16 ' : '';
|
|
25
26
|
let dropdownTextAlignement = alignRight ? ' ' : alignLeft ? ' ' : 'text-center';
|
|
26
27
|
const [profileState, setProfileState] = (0, _react.useState)(false);
|
|
27
28
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
28
|
-
className:
|
|
29
|
+
className: 'text-center ' + classNames
|
|
29
30
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
30
31
|
className: "hidden sm:inline-flex inset-y-0 " + profileAlignment
|
|
31
32
|
}, /*#__PURE__*/_react.default.createElement("button", {
|