trepur_components 0.1.21 → 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.
Binary file
Binary file
@@ -60,9 +60,9 @@ const Button = _ref => {
60
60
 
61
61
 
62
62
  const [styles, setStyles] = (0, _react.useState)({
63
- 'background-color': bgColor ? bgColor : 'white',
63
+ 'backgroundColor': bgColor ? bgColor : 'white',
64
64
  color: textColor ? textColor : 'black',
65
- 'border-color': borderColor ? borderColor : 'black'
65
+ 'borderColor': borderColor ? borderColor : 'black'
66
66
  });
67
67
  const [hovering, setHovering] = (0, _react.useState)(false);
68
68
 
@@ -70,16 +70,16 @@ const Button = _ref => {
70
70
  if (isHovering) {
71
71
  setHovering(true);
72
72
  setStyles({
73
- 'background-color': hoverBgColor ? hoverBgColor : 'black',
73
+ 'backgroundColor': hoverBgColor ? hoverBgColor : 'black',
74
74
  color: hoverTextColor ? hoverTextColor : 'white',
75
- 'border-color': hoverBorderColor ? hoverBorderColor : 'black'
75
+ 'borderColor': hoverBorderColor ? hoverBorderColor : 'black'
76
76
  });
77
77
  } else {
78
78
  setHovering(false);
79
79
  setStyles({
80
- 'background-color': bgColor ? bgColor : 'white',
80
+ 'backgroundColor': bgColor ? bgColor : 'white',
81
81
  color: textColor ? textColor : 'black',
82
- 'border-color': borderColor ? borderColor : 'black'
82
+ 'borderColor': borderColor ? borderColor : 'black'
83
83
  });
84
84
  }
85
85
  }; //-----------------------------------
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports._Card = exports.ImageCard = exports.CardWithText = exports.CardWithSlideButton = exports.CardWithImageBelowTitle = exports.CardWithImage = exports.CardWithButton = exports.CardTitleRight = exports.CardTitleLeft = exports.CardTitleBold = exports.CardRounded = void 0;
6
+ exports.lotsOfCards = exports.default = exports._Card = exports.ImageCard = exports.CardWithText = exports.CardWithSlideButton = exports.CardWithImageBelowTitle = exports.CardWithImage = exports.CardWithButton = exports.CardTitleRight = exports.CardTitleLeft = exports.CardTitleBold = exports.CardRounded = void 0;
7
7
 
8
8
  require("core-js/modules/es.symbol.description.js");
9
9
 
@@ -273,6 +273,40 @@ const CardRounded = args => {
273
273
 
274
274
  exports.CardRounded = CardRounded;
275
275
 
276
+ const lotsOfCards = args => {
277
+ const options = ['300', '400', '500'];
278
+ let cards = [];
279
+ let width, height;
280
+
281
+ for (let i = 0; i < 8; i++) {
282
+ width = options[Math.floor(Math.random() * (2 + 0))];
283
+ height = options[Math.floor(Math.random() * (2 + 0))];
284
+ cards.push( /*#__PURE__*/_react.default.createElement(_index.default, {
285
+ id: 'card_' + i,
286
+ classNames: "m-2",
287
+ title: args.title,
288
+ titleClass: "text-center font-bold",
289
+ subTitle: args.subTitle,
290
+ extraText: args.extraText,
291
+ description: args.description,
292
+ image: 'https://picsum.photos/' + width + '/' + height,
293
+ hasCta: args.hasCta,
294
+ ctaText: args.ctaText,
295
+ imageBelowTitle: args.imageBelowTitle,
296
+ rounded: true,
297
+ bordered: true,
298
+ buttonType: "internal",
299
+ url: "/?path=/story/components-card--lots-of-cards"
300
+ }));
301
+ }
302
+
303
+ return /*#__PURE__*/_react.default.createElement("div", {
304
+ className: "grid grid-cols-4 grid-flow-row"
305
+ }, cards);
306
+ };
307
+
308
+ exports.lotsOfCards = lotsOfCards;
309
+
276
310
  const ImageCard = args => {
277
311
  return /*#__PURE__*/_react.default.createElement(_index.default, {
278
312
  image: "https://picsum.photos/500/300",
@@ -53,14 +53,18 @@ const Card = _ref => {
53
53
  let titleClasses = titlePosition + titleFont;
54
54
  let imageWrapperClass = imageBelowTitle ? ' order-2 ' : '';
55
55
  let classes = classNames ? classNames : '';
56
- let imageClassList = imageBelowTitle ? '' : roundedImage;
56
+ let imageClassList = ' w-full ';
57
+ imageClassList += imageBelowTitle && imageBelowTitle ? '' : roundedImage;
57
58
  classList += border + classes;
58
59
  imageWrapperClass += roundedImage;
59
60
  classList += roundedCard;
60
61
  imageClassList += imageClass;
61
62
  return /*#__PURE__*/_react.default.createElement("div", {
63
+ key: id,
62
64
  id: id,
63
65
  className: classList
66
+ }, /*#__PURE__*/_react.default.createElement("div", {
67
+ className: "card-content flex-1"
64
68
  }, image && /*#__PURE__*/_react.default.createElement("div", {
65
69
  className: imageWrapperClass && imageWrapperClass
66
70
  }, /*#__PURE__*/_react.default.createElement("img", {
@@ -79,7 +83,7 @@ const Card = _ref => {
79
83
  className: descriptionClass && descriptionClass
80
84
  }, description), extraText && /*#__PURE__*/_react.default.createElement("h2", {
81
85
  className: extraTextClass && extraTextClass
82
- }, extraText)), hasCta && /*#__PURE__*/_react.default.createElement("div", {
86
+ }, extraText))), hasCta && /*#__PURE__*/_react.default.createElement("div", {
83
87
  className: btnClass
84
88
  }, buttonStyle === 'slide' ? /*#__PURE__*/_react.default.createElement(_index2.default, {
85
89
  className: "w-full",
@@ -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
 
@@ -15,6 +15,8 @@ require("../../../index.css");
15
15
 
16
16
  var _user = _interopRequireDefault(require("../../Assets/Images/user.jpeg"));
17
17
 
18
+ var _logoWhite = _interopRequireDefault(require("../../Assets/Images/logoWhite.png"));
19
+
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
22
  const links = [{
@@ -33,9 +35,7 @@ const links = [{
33
35
  var _default = {
34
36
  title: 'Components/Nav',
35
37
  argTypes: {},
36
- decorators: [story => /*#__PURE__*/_react.default.createElement("div", {
37
- className: "p-4"
38
- }, story())],
38
+ decorators: [story => /*#__PURE__*/_react.default.createElement("div", null, story())],
39
39
  parameters: {
40
40
  readme: {
41
41
  sidebar: _README.default
@@ -48,22 +48,56 @@ const _Nav = args => {
48
48
  return /*#__PURE__*/_react.default.createElement(_index.default, {
49
49
  links: links,
50
50
  navPosition: "1",
51
- navClass: "bg-brand-light-grey pb-4 pt-2",
52
- navLinkClass: "px-2 py-2 rounded-lg flex-1 hover:text-white hover:bg-black",
53
- logoClass: "py-4"
51
+ logoImage: _logoWhite.default,
52
+ icon: _user.default,
53
+ navItemRounded: false
54
54
  });
55
55
  };
56
56
 
57
57
  exports._Nav = _Nav;
58
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
+
59
92
  const NavWithSearch = () => {
60
93
  return /*#__PURE__*/_react.default.createElement(_index.default, {
61
94
  links: links,
62
95
  navPosition: "1",
63
- navClass: "bg-brand-light-grey pb-4 pt-2",
96
+ navClass: "bg-brand-primary",
64
97
  navLinkClass: "px-2 py-2 rounded-lg flex-1 hover:text-white hover:bg-black",
65
98
  logoClass: "py-4",
66
- showSearch: true
99
+ showSearch: true,
100
+ logoImage: _logoWhite.default
67
101
  });
68
102
  };
69
103
 
@@ -73,11 +107,12 @@ const NavWithProfile = () => {
73
107
  return /*#__PURE__*/_react.default.createElement(_index.default, {
74
108
  links: links,
75
109
  navPosition: "1",
76
- navClass: "bg-brand-light-grey pb-4 pt-2",
110
+ navClass: "bg-brand-primary",
77
111
  navLinkClass: "px-2 py-2 rounded-lg flex-1 hover:text-white hover:bg-black",
78
112
  logoClass: "py-4",
79
113
  showProfile: true,
80
- icon: _user.default
114
+ icon: _user.default,
115
+ logoImage: _logoWhite.default
81
116
  });
82
117
  };
83
118
 
@@ -87,11 +122,13 @@ const NavWithSearchAndProfile = () => {
87
122
  return /*#__PURE__*/_react.default.createElement(_index.default, {
88
123
  links: links,
89
124
  navPosition: "1",
90
- navClass: "bg-brand-light-grey pb-4 pt-2",
125
+ navClass: "bg-brand-primary",
91
126
  navLinkClass: "px-2 py-2 rounded-lg flex-1 hover:text-white hover:bg-black",
92
127
  logoClass: "py-4",
93
128
  showProfile: true,
94
- showSearch: true
129
+ showSearch: true,
130
+ logoImage: _logoWhite.default,
131
+ icon: _user.default
95
132
  });
96
133
  };
97
134
 
@@ -101,11 +138,60 @@ const NavAligned = () => {
101
138
  return /*#__PURE__*/_react.default.createElement(_index.default, {
102
139
  links: links,
103
140
  navPosition: "1",
104
- navClass: "bg-brand-light-grey pb-4 pt-2",
105
- navLinkClass: "px-2 py-2 rounded-lg flex-1 hover:text-white hover:bg-black",
106
- logoClass: "py-4",
107
- alignNavAndLogo: true
141
+ navClass: "bg-brand-primary",
142
+ navLinkClass: "hover:text-white hover:bg-black",
143
+ alignNavAndLogo: true,
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
108
194
  });
109
195
  };
110
196
 
111
- exports.NavAligned = NavAligned;
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); }
@@ -29,7 +31,27 @@ const Header = _ref => {
29
31
  logoClass,
30
32
  showSearch,
31
33
  showProfile,
32
- icon
34
+ icon,
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
33
55
  } = _ref;
34
56
  const user = icon ? icon : '';
35
57
  const [mobileMenuState, setmobileMenuState] = (0, _react.useState)(false);
@@ -46,14 +68,19 @@ const Header = _ref => {
46
68
  name: 'PROFILE ITEM 4',
47
69
  reference: '/'
48
70
  }];
49
- let combinedLogoClass = logoClass + ' hidden sm:inline-flex flex-1 flex items-center justify-center sm:items-stretch ';
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';
50
76
  let combinedMobileLogoClass = logoClass + ' sm:hidden block flex-1 flex items-center justify-center sm:items-stretch ';
51
- let linkContainerClass = 'flex-1 flex items-center justify-center sm:items-stretch ';
77
+ let linkContainerClass = 'flex-1 flex ';
78
+ let logoHeight = 16;
52
79
 
53
- if (alignNavAndLogo) {
54
- combinedLogoClass = ' hidden sm:inline-flex pl-16 pt-16 absolute inset-y-0 h-8 left-0 flex items-center';
80
+ if (!alignNavAndLogo) {
81
+ combinedLogoClass += ' flex justify-center ';
55
82
  } else {
56
- combinedLogoClass += ' flex-1';
83
+ navItemTopPadding = containsSearchOrProfile ? '' : 'pt-' + logoHeight / 4;
57
84
  }
58
85
 
59
86
  if (navPosition === '0') {
@@ -66,23 +93,48 @@ const Header = _ref => {
66
93
 
67
94
  if (navPosition === '2') {
68
95
  linkContainerClass += 'sm:justify-end';
69
- }
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
+
70
118
 
71
119
  return /*#__PURE__*/_react.default.createElement("nav", {
120
+ style: {
121
+ 'background-color': backgroundColor
122
+ },
72
123
  id: "nav",
73
- className: navClass
74
- }, /*#__PURE__*/_react.default.createElement("div", {
75
- className: "px-4"
76
- }, /*#__PURE__*/_react.default.createElement("div", {
124
+ className: 'p-2 ' + navClass
125
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
77
126
  id: "sm-nav",
78
127
  className: "relative flex items-center justify-between h-16 sm:hidden"
79
128
  }, /*#__PURE__*/_react.default.createElement("div", {
80
129
  id: "nav-collapse-btn-wrapper",
81
130
  className: "absolute inset-y-0 left-0 flex items-center"
82
131
  }, /*#__PURE__*/_react.default.createElement("button", {
132
+ style: styles,
133
+ onMouseOver: () => setHoverState(true),
134
+ onMouseOut: () => setHoverState(false),
83
135
  onClick: () => setmobileMenuState(!mobileMenuState),
84
136
  type: "button",
85
- className: "inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-black hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white",
137
+ className: "inline-flex items-center justify-center p-2 rounded-md focus:ring-2 focus:ring-inset focus:ring-white",
86
138
  "aria-controls": "mobile-menu",
87
139
  "aria-expanded": "false"
88
140
  }, /*#__PURE__*/_react.default.createElement("svg", {
@@ -107,71 +159,100 @@ const Header = _ref => {
107
159
  id: "logo",
108
160
  className: combinedMobileLogoClass
109
161
  }, /*#__PURE__*/_react.default.createElement("img", {
110
- className: "h-8 w-auto",
111
- src: "logo.png",
162
+ className: "h-16 w-auto",
163
+ src: logoImage,
112
164
  alt: " Logo "
113
165
  }))), /*#__PURE__*/_react.default.createElement("div", {
114
- clas: true,
115
- 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"
116
167
  }, /*#__PURE__*/_react.default.createElement("div", {
117
- className: "flex"
168
+ className: alignNavAndLogo ? 'flex' : ''
118
169
  }, /*#__PURE__*/_react.default.createElement("div", {
119
170
  id: "logo",
120
171
  className: combinedLogoClass
121
172
  }, /*#__PURE__*/_react.default.createElement("img", {
122
- className: "h-8 w-auto",
123
- src: "logo.png",
173
+ className: "h-" + logoHeight,
174
+ src: logoImage,
124
175
  alt: " Logo "
125
- })), showSearch && /*#__PURE__*/_react.default.createElement(_index2.default, {
126
- className: "hidden sm:inline-flex pl-4 pt-8 h-8 flex items-center"
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"
127
182
  }), showProfile && /*#__PURE__*/_react.default.createElement(_index.default, {
128
183
  profileLinks: profileLinks,
129
- userImage: user
130
- })), /*#__PURE__*/_react.default.createElement("div", {
131
- id: "nav-container",
184
+ userImage: user,
185
+ classNames: "ml-2"
186
+ }))), /*#__PURE__*/_react.default.createElement("div", {
187
+ id: "nav-items-container",
132
188
  className: linkContainerClass
133
189
  }, /*#__PURE__*/_react.default.createElement("div", {
134
190
  id: "nav-block",
135
- className: "hidden sm:inline-flex sm:ml-6"
191
+ className: "hidden sm:inline-flex"
136
192
  }, /*#__PURE__*/_react.default.createElement("ul", {
137
193
  id: "nav-list",
138
- className: "list-none mx-auto flex flex-1"
194
+ className: 'flex ' + navItemTopPadding
139
195
  }, links && links.map(link => {
140
- return /*#__PURE__*/_react.default.createElement("li", {
141
- key: link.name,
142
- className: "flex px-4",
143
- onClick: link.onClick
144
- }, /*#__PURE__*/_react.default.createElement("a", {
145
- className: navLinkClass,
146
- href: link.reference
147
- }, link.name));
148
- })))))), mobileMenuState && /*#__PURE__*/_react.default.createElement("div", {
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", {
149
211
  className: "sm:hidden",
150
212
  id: "mobile-menu"
151
- }, showProfile && /*#__PURE__*/_react.default.createElement("img", {
152
- className: "ml-3 h-8 w-8 rounded-full",
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",
153
218
  src: user,
154
219
  alt: ""
155
- }), showSearch && /*#__PURE__*/_react.default.createElement(_index2.default, {
156
- className: "flex flex-1"
157
220
  }), /*#__PURE__*/_react.default.createElement("div", {
158
221
  className: "px-2 pt-2 pb-3 space-y-1"
159
222
  }, links && links.map(link => {
160
- return /*#__PURE__*/_react.default.createElement("a", {
161
- key: link.name,
162
- href: link.reference,
163
- className: "text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium",
164
- "aria-current": "page"
165
- }, link.name);
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
+ }
166
241
  }), showProfile && profileLinks && profileLinks.map(link => {
167
- return /*#__PURE__*/_react.default.createElement("a", {
168
- key: link.name,
169
- href: link.reference,
170
- className: "text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium",
171
- role: "menuitem",
172
- tabindex: "-1",
173
- id: "user-menu-item-0"
174
- }, link.name);
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
+ });
175
256
  }))));
176
257
  };
177
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: "text-center"
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", {
package/dist/index.js CHANGED
@@ -51,12 +51,6 @@ Object.defineProperty(exports, "CardImageLinkList", {
51
51
  return _CardImageLinkList.default;
52
52
  }
53
53
  });
54
- Object.defineProperty(exports, "CardList", {
55
- enumerable: true,
56
- get: function get() {
57
- return _CardList.default;
58
- }
59
- });
60
54
  Object.defineProperty(exports, "Icon", {
61
55
  enumerable: true,
62
56
  get: function get() {
@@ -104,8 +98,6 @@ var _CardImageLink = _interopRequireDefault(require("./components/CardImageLink"
104
98
 
105
99
  var _CardImageLinkList = _interopRequireDefault(require("./components/CardImageLinkList"));
106
100
 
107
- var _CardList = _interopRequireDefault(require("./components/CardList"));
108
-
109
101
  var _Icon = _interopRequireDefault(require("./components/Icon"));
110
102
 
111
103
  var _Jumbotron = _interopRequireDefault(require("./components/Jumbotron"));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "trepur_components",
3
3
  "description": "component lib",
4
4
  "author": "trepur_ttenneb",
5
- "version": "0.1.21",
5
+ "version": "0.1.25",
6
6
  "private": false,
7
7
  "keywords": [
8
8
  "react",
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports._Cardlist = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _README = _interopRequireDefault(require("./README.md"));
11
-
12
- var _index = _interopRequireDefault(require("./index"));
13
-
14
- var _index2 = _interopRequireDefault(require("../Card/index"));
15
-
16
- require("../../../index.css");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- let cards = [];
21
-
22
- for (let i = 0; i < 8; i++) {
23
- cards.push( /*#__PURE__*/_react.default.createElement(_index2.default, {
24
- id: "cardId",
25
- title: "card Title",
26
- titleClass: "text-center font-bold",
27
- subTitle: "card subtitle",
28
- extraText: "card extra text",
29
- description: "card description",
30
- image: "https://picsum.photos/500/300",
31
- hasCta: true,
32
- ctaText: "button 1",
33
- rounded: true,
34
- bordered: true
35
- }));
36
- }
37
-
38
- var _default = {
39
- title: 'Components/CardList',
40
- argTypes: {},
41
- decorators: [story => /*#__PURE__*/_react.default.createElement("div", {
42
- className: "p-4"
43
- }, story())],
44
- parameters: {
45
- readme: {
46
- sidebar: _README.default
47
- }
48
- }
49
- };
50
- exports.default = _default;
51
-
52
- const _Cardlist = () => {
53
- return /*#__PURE__*/_react.default.createElement(_index.default, {
54
- list: cards
55
- });
56
- };
57
-
58
- exports._Cardlist = _Cardlist;
@@ -1,29 +0,0 @@
1
- # Card List
2
-
3
- A list of cards
4
-
5
- ## Example
6
-
7
- ```
8
- const list = [
9
- <Card
10
- id='card'
11
- title='This is a title'
12
- titleClass='font-bold'
13
- subTitle='This is a subtitle'
14
- description='This is a description, it can be really long if you want it to be. The text will wrap onto a new line if it exceeds the width of the card'
15
- />,
16
- <Card
17
- id='card'
18
- title='This is a title'
19
- titleClass='font-bold'
20
- subTitle='This is a subtitle'
21
- description='This is a description, it can be really long if you want it to be. The text will wrap onto a new line if it exceeds the width of the card'
22
- />
23
- ]
24
-
25
- <CardList list={list}></CardList>
26
- ```
27
-
28
- ## Parameters
29
- `links={array} (default=null)`
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- require("core-js/modules/es.symbol.description.js");
9
-
10
- var _react = _interopRequireDefault(require("react"));
11
-
12
- var _index = _interopRequireDefault(require("../Card/index"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- const CardList = _ref => {
17
- let {
18
- list
19
- } = _ref;
20
- return /*#__PURE__*/_react.default.createElement("div", {
21
- className: "flex"
22
- }, list && list.map(item => {
23
- return /*#__PURE__*/_react.default.createElement(_index.default, {
24
- id: "card",
25
- title: item.title,
26
- classNames: "mx-2",
27
- titleClass: "text-center font-bold",
28
- subTitle: item.subTitle,
29
- extraText: item.extraText,
30
- description: item.description,
31
- image: "https://picsum.photos/500/300",
32
- hasCta: item.hasCta,
33
- ctaText: item.ctaText,
34
- imageBelowTitle: item.imageBelowTitle,
35
- rounded: item.rounded,
36
- bordered: item.bordered
37
- });
38
- }));
39
- };
40
-
41
- var _default = CardList;
42
- exports.default = _default;