@mohamed-karawia/library 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,8 +18,8 @@ var _excluded = ["data"];
18
18
  var ViewForms = function ViewForms(_ref) {
19
19
  var data = _ref.data,
20
20
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
21
- return /*#__PURE__*/_react.default.createElement(_ReusableList.default, {
22
- listTitle: "Submitted Form",
21
+ return /*#__PURE__*/_react.default.createElement(_ReusableList.default, Object.assign({
22
+ listTitle: "Submitted Forms",
23
23
  data: data,
24
24
  cardStyle: "card-style-9",
25
25
  type: "sectioned",
@@ -38,7 +38,7 @@ var ViewForms = function ViewForms(_ref) {
38
38
  dropdownItemHoverColor: '#FE1744'
39
39
  }
40
40
  }
41
- });
41
+ }, props));
42
42
  };
43
43
 
44
44
  ViewForms.defaultProps = {};
@@ -83,6 +83,10 @@ var Forms = function Forms(props) {
83
83
  forms = _useState2[0],
84
84
  setForms = _useState2[1];
85
85
 
86
+ var cardClicked = function cardClicked(index, cardProps) {
87
+ console.log(cardProps);
88
+ };
89
+
86
90
  return /*#__PURE__*/_react.default.createElement(_BaseMaterial.default, Object.assign({}, _styles.default.containerStyle, props), /*#__PURE__*/_react.default.createElement(_Navbar.default, null), /*#__PURE__*/_react.default.createElement(_Body.default, _styles.default.bodyStyle, /*#__PURE__*/_react.default.createElement(_Left.default, null, /*#__PURE__*/_react.default.createElement(_WidgetContainer.default, {
87
91
  widgetType: "logo",
88
92
  widgetProps: {
@@ -117,7 +121,8 @@ var Forms = function Forms(props) {
117
121
  discription: "Lorem ipsum dolor sit amet consectetur.",
118
122
  hideTitle: true
119
123
  }, /*#__PURE__*/_react.default.createElement(_ViewForms.default, {
120
- data: forms
124
+ data: forms,
125
+ cardClicked: cardClicked
121
126
  }))), /*#__PURE__*/_react.default.createElement(_Right.default, null)));
122
127
  };
123
128
 
@@ -79,6 +79,10 @@ var Events = function Events(props) {
79
79
  setEvents((0, _util.deleteFromArrayByIndex)(events, index));
80
80
  };
81
81
 
82
+ var cardClicked = function cardClicked(index, cardProps) {
83
+ console.log(cardProps);
84
+ };
85
+
82
86
  return /*#__PURE__*/_react.default.createElement(_BaseMaterial.default, Object.assign({}, _styles.default.containerStyle, props), /*#__PURE__*/_react.default.createElement(_Navbar.default, null), /*#__PURE__*/_react.default.createElement(_Body.default, _styles.default.bodyStyle, /*#__PURE__*/_react.default.createElement(_Left.default, null, /*#__PURE__*/_react.default.createElement(_WidgetContainer.default, {
83
87
  widgetType: "logo",
84
88
  widgetProps: {
@@ -118,6 +122,7 @@ var Events = function Events(props) {
118
122
  cardTitleFontSize: 15,
119
123
  onAddEvent: onAddEvent,
120
124
  cardIconClicked: cardIconClicked,
125
+ cardClicked: cardClicked,
121
126
  headerStyles: {
122
127
  padding: 10,
123
128
  headerBackground: '#FE1744',
@@ -79,6 +79,10 @@ var Notes = function Notes(props) {
79
79
  setNotes((0, _util.deleteFromArrayByIndex)(notes, index));
80
80
  };
81
81
 
82
+ var cardClicked = function cardClicked(index, cardProps) {
83
+ console.log(cardProps);
84
+ };
85
+
82
86
  return /*#__PURE__*/_react.default.createElement(_BaseMaterial.default, Object.assign({}, _styles.default.containerStyle, props), /*#__PURE__*/_react.default.createElement(_Navbar.default, null), /*#__PURE__*/_react.default.createElement(_Body.default, _styles.default.bodyStyle, /*#__PURE__*/_react.default.createElement(_Left.default, null, /*#__PURE__*/_react.default.createElement(_WidgetContainer.default, {
83
87
  widgetType: "logo",
84
88
  widgetProps: {
@@ -116,6 +120,7 @@ var Notes = function Notes(props) {
116
120
  onAddNote: onAddNote,
117
121
  cardIconClicked: cardIconClicked,
118
122
  notes: notes,
123
+ cardClicked: cardClicked,
119
124
  headerStyles: {
120
125
  padding: 10,
121
126
  headerBackground: '#FE1744',
@@ -45,7 +45,13 @@ var CardStyle11 = function CardStyle11(_ref) {
45
45
  props.iconClicked(action, props.index);
46
46
  };
47
47
 
48
- return /*#__PURE__*/_react.default.createElement(Card, props, /*#__PURE__*/_react.default.createElement(SvgWrapper, props, /*#__PURE__*/_react.default.createElement(_bi.BiNotepad, null)), /*#__PURE__*/_react.default.createElement(Content, props, /*#__PURE__*/_react.default.createElement(_globalCardStyles.Title, props, title), /*#__PURE__*/_react.default.createElement(Date, props, date)), props.cardControls && /*#__PURE__*/_react.default.createElement(_Controls.default, Object.assign({
48
+ var cardClicked = function cardClicked() {
49
+ props.cardClicked();
50
+ };
51
+
52
+ return /*#__PURE__*/_react.default.createElement(Card, Object.assign({
53
+ onClick: cardClicked
54
+ }, props), /*#__PURE__*/_react.default.createElement(SvgWrapper, props, /*#__PURE__*/_react.default.createElement(_bi.BiNotepad, null)), /*#__PURE__*/_react.default.createElement(Content, props, /*#__PURE__*/_react.default.createElement(_globalCardStyles.Title, props, title), /*#__PURE__*/_react.default.createElement(Date, props, date)), props.cardControls && /*#__PURE__*/_react.default.createElement(_Controls.default, Object.assign({
49
55
  controls: props.cardControls,
50
56
  show: showIcons,
51
57
  onIconClicked: iconClicked
@@ -37,7 +37,11 @@ var CardStyle9 = function CardStyle9(_ref) {
37
37
  alert(props.index);
38
38
  };
39
39
 
40
- return /*#__PURE__*/_react.default.createElement(Card, props, /*#__PURE__*/_react.default.createElement(ImgWrapper, props, /*#__PURE__*/_react.default.createElement(_globalCardStyles.Img, {
40
+ return /*#__PURE__*/_react.default.createElement(Card, Object.assign({
41
+ onClick: function onClick() {
42
+ return props.cardClicked();
43
+ }
44
+ }, props), /*#__PURE__*/_react.default.createElement(ImgWrapper, props, /*#__PURE__*/_react.default.createElement(_globalCardStyles.Img, {
41
45
  src: img
42
46
  })), /*#__PURE__*/_react.default.createElement(Content, props, /*#__PURE__*/_react.default.createElement(_globalCardStyles.Title, props, username), /*#__PURE__*/_react.default.createElement(Answered, null, "Questions Answered: ", answered), /*#__PURE__*/_react.default.createElement(Buttons, null, /*#__PURE__*/_react.default.createElement(Accept, {
43
47
  onClick: onAccept
@@ -39,8 +39,8 @@ var ReusableList = function ReusableList(_ref) {
39
39
  props.iconClicked(action);
40
40
  };
41
41
 
42
- var clicked = function clicked(index) {
43
- props.cardClicked(index);
42
+ var clicked = function clicked(index, cardProps) {
43
+ props.cardClicked(index, cardProps);
44
44
  };
45
45
 
46
46
  var cardIconClicked = function cardIconClicked(action, index) {
@@ -136,7 +136,7 @@ var getCardStyle = function getCardStyle(cardProps, cardType, customCardStyles,
136
136
  }, cardProps, customCardStyles, {
137
137
  cardControls: cardControls,
138
138
  cardClicked: function cardClicked() {
139
- return clicked(index);
139
+ return clicked(index, cardProps);
140
140
  },
141
141
  iconClicked: function iconClicked(action) {
142
142
  return cardIconClicked(action, index);
@@ -158,7 +158,7 @@ var getCardStyle = function getCardStyle(cardProps, cardType, customCardStyles,
158
158
  }, cardProps, customCardStyles, {
159
159
  cardControls: cardControls,
160
160
  cardClicked: function cardClicked() {
161
- return clicked(index);
161
+ return clicked(index, cardProps);
162
162
  },
163
163
  iconClicked: function iconClicked(action) {
164
164
  return cardIconClicked(action, index);
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ]
11
11
  ]
12
12
  },
13
- "version": "0.1.14",
13
+ "version": "0.1.15",
14
14
  "private": false,
15
15
  "dependencies": {
16
16
  "@babel/cli": "^7.16.7",
@@ -8,7 +8,7 @@ const ViewForms = ({
8
8
  }) => {
9
9
  return (
10
10
  <List
11
- listTitle="Submitted Form"
11
+ listTitle="Submitted Forms"
12
12
  data={data}
13
13
  cardStyle="card-style-9"
14
14
  type="sectioned"
@@ -27,6 +27,7 @@ const ViewForms = ({
27
27
  dropdownItemHoverColor: '#FE1744'
28
28
  },
29
29
  }}
30
+ {...props}
30
31
  />
31
32
  )
32
33
  }
@@ -69,6 +69,10 @@ const Forms = (props) => {
69
69
  },
70
70
  ])
71
71
 
72
+ const cardClicked = (index, cardProps) => {
73
+ console.log(cardProps)
74
+ }
75
+
72
76
  return (
73
77
  <BaseMaterial {...worldStyles.containerStyle} {...props}>
74
78
  <Navbar />
@@ -113,7 +117,9 @@ const Forms = (props) => {
113
117
  hideTitle
114
118
  >
115
119
  <ViewForms
116
- data={forms} />
120
+ data={forms}
121
+ cardClicked={cardClicked}
122
+ />
117
123
 
118
124
  </SpaceContainer>
119
125
 
@@ -45,6 +45,10 @@ const Events = (props) => {
45
45
  setEvents(deleteFromArrayByIndex(events, index))
46
46
  }
47
47
 
48
+ const cardClicked = (index, cardProps) => {
49
+ console.log(cardProps)
50
+ }
51
+
48
52
  return (
49
53
  <BaseMaterial {...worldStyles.containerStyle} {...props}>
50
54
  <Navbar />
@@ -94,6 +98,7 @@ const Events = (props) => {
94
98
  cardTitleFontSize={15}
95
99
  onAddEvent={onAddEvent}
96
100
  cardIconClicked={cardIconClicked}
101
+ cardClicked={cardClicked}
97
102
  headerStyles={{
98
103
  padding: 10,
99
104
  headerBackground: '#FE1744',
@@ -46,6 +46,10 @@ const Notes = (props) => {
46
46
  setNotes(deleteFromArrayByIndex(notes, index))
47
47
  }
48
48
 
49
+ const cardClicked = (index, cardProps) => {
50
+ console.log(cardProps)
51
+ }
52
+
49
53
  return (
50
54
  <BaseMaterial {...worldStyles.containerStyle} {...props}>
51
55
  <Navbar />
@@ -93,6 +97,7 @@ const Notes = (props) => {
93
97
  onAddNote={onAddNote}
94
98
  cardIconClicked={cardIconClicked}
95
99
  notes={notes}
100
+ cardClicked={cardClicked}
96
101
  headerStyles={{
97
102
  padding: 10,
98
103
  headerBackground: '#FE1744',
@@ -15,8 +15,13 @@ const CardStyle11 = ({ title, date, ...props }) => {
15
15
  props.iconClicked(action, props.index)
16
16
  }
17
17
 
18
+ const cardClicked = () => {
19
+ props.cardClicked()
20
+ }
21
+
18
22
  return (
19
23
  <Card
24
+ onClick={cardClicked}
20
25
  {...props}>
21
26
  <SvgWrapper {...props}>
22
27
  <BiNotepad />
@@ -18,7 +18,9 @@ const CardStyle9 = ({ username, answered, img, status, ...props }) => {
18
18
  }
19
19
 
20
20
  return (
21
- <Card {...props}>
21
+ <Card
22
+ onClick={() => props.cardClicked()}
23
+ {...props}>
22
24
  <ImgWrapper {...props}>
23
25
  <Img src={img} />
24
26
  </ImgWrapper>
@@ -14,8 +14,8 @@ const ReusableList = ({ data, cardStyle, customCardStyles, type, cardControls =
14
14
  props.iconClicked(action)
15
15
  }
16
16
 
17
- const clicked = (index) => {
18
- props.cardClicked(index)
17
+ const clicked = (index, cardProps) => {
18
+ props.cardClicked(index, cardProps)
19
19
  }
20
20
 
21
21
  const cardIconClicked = (action, index) => {
@@ -49,9 +49,9 @@ export const getCardStyle = (cardProps, cardType, customCardStyles, cardControls
49
49
  'card-style-6': (<CardStyle6 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index, cardProps)} iconClicked={(action) => cardIconClicked(action, index)} />),
50
50
  'card-style-7': (<CardStyle7 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index)} iconClicked={(action) => cardIconClicked(action, index)} />),
51
51
  'card-style-8': (<CardStyle8 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index)} iconClicked={(action) => cardIconClicked(action, index)} />),
52
- 'card-style-9': (<CardStyle9 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index)} iconClicked={(action) => cardIconClicked(action, index)} />),
52
+ 'card-style-9': (<CardStyle9 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index, cardProps)} iconClicked={(action) => cardIconClicked(action, index)} />),
53
53
  'card-style-10': (<CardStyle10 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index)} iconClicked={(action) => cardIconClicked(action, index)} />),
54
- 'card-style-11': (<CardStyle11 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index)} iconClicked={(action) => cardIconClicked(action, index)} />),
54
+ 'card-style-11': (<CardStyle11 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index, cardProps)} iconClicked={(action) => cardIconClicked(action, index)} />),
55
55
  }
56
56
  return cardTypes[cardType]
57
57
  };