gatsby-core-theme 44.4.28 → 44.4.29

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [44.4.29](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.4.28...v44.4.29) (2025-08-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added extra validation to comments ([278c60e](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/278c60e1c3d37750e607b02633c6d6fdd3d06117))
7
+ * added npmrc to gitignore ([e31dbc6](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/e31dbc6dbb18fdaf96af53b1f90938d79c2e7498))
8
+
1
9
  ## [44.4.28](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.4.27...v44.4.28) (2025-07-30)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.4.28",
3
+ "version": "44.4.29",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -113,7 +113,7 @@
113
113
  line-height: 1.8rem;
114
114
  text-transform: capitalize;
115
115
  margin-left: .8rem;
116
- padding: 0 1.6rem;
116
+ padding: 0.8rem 1.6rem;
117
117
  }
118
118
 
119
119
  .replySection{
@@ -11,7 +11,14 @@ import LeaveCommentForm from '../leave-comment-form';
11
11
  import useTranslate from '~hooks/useTranslate/useTranslate';
12
12
  import styles from './comment.module.scss';
13
13
 
14
- const Comment = ({ pageContext, comment, authors, isReply, userInteractions }) => {
14
+ const Comment = ({
15
+ pageContext,
16
+ comment,
17
+ authors,
18
+ isReply,
19
+ userInteractions,
20
+ showVotes = true
21
+ }) => {
15
22
  const commentName = comment?.author_id ? authors?.[comment?.author_id]?.name : comment.author_name;
16
23
  const commentJobTitle = comment?.author_id ? authors?.[comment?.author_id]?.author_title : undefined;
17
24
  const date = new Date(comment.updated_at);
@@ -82,32 +89,36 @@ const Comment = ({ pageContext, comment, authors, isReply, userInteractions }) =
82
89
  <p>{comment.comment}</p>
83
90
  </div>
84
91
  <div className={styles.commentActions}>
85
- <button
86
- onClick={async () => {
87
- await handleVote(true, comment.comment_id)
88
- setLikes((prev) => prev + 1)
89
- }}
90
- aria-label='Like Button'
91
- type='button'
92
- className={`${styles.buttonGroup} ${styles.left} ${currentUserInteractions.current?.find(v => v.startsWith(`${comment.comment_id}:`))?.split(': ')[1] === 'vote_down' && styles.disabled || ''}`}
93
- disabled={currentUserInteractions.current?.find(v => v.startsWith(`${comment.comment_id}:`))}
94
- >
95
- <LazyImage className={styles.buttonGroupIcon} src='/images/like.svg' />
96
- <span>{likes}</span>
97
- </button>
98
- <button
99
- onClick={async () => {
100
- await handleVote(false, comment.comment_id)
101
- setDislikes((prev) => prev + 1)
102
- }}
103
- aria-label='Dislike Button'
104
- type='button'
105
- className={`${styles.buttonGroup} ${styles.right} ${currentUserInteractions.current?.find(v => v.startsWith(`${comment.comment_id}:`))?.split(': ')[1] === 'vote_up' && styles.disabled || ''}`}
106
- disabled={currentUserInteractions.current?.find(v => v.startsWith(`${comment.comment_id}:`))}
107
- >
108
- <LazyImage className={styles.buttonGroupIcon} src='/images/dislike.svg' />
109
- <span>{dislikes}</span>
110
- </button>
92
+ {showVotes && (
93
+ <>
94
+ <button
95
+ onClick={async () => {
96
+ await handleVote(true, comment.comment_id)
97
+ setLikes((prev) => prev + 1)
98
+ }}
99
+ aria-label='Like Button'
100
+ type='button'
101
+ className={`${styles.buttonGroup} ${styles.left} ${currentUserInteractions.current?.find(v => v.startsWith(`${comment.comment_id}:`))?.split(': ')[1] === 'vote_down' && styles.disabled || ''}`}
102
+ disabled={currentUserInteractions.current?.find(v => v.startsWith(`${comment.comment_id}:`))}
103
+ >
104
+ <LazyImage className={styles.buttonGroupIcon} src='/images/like.svg' />
105
+ <span>{likes}</span>
106
+ </button>
107
+ <button
108
+ onClick={async () => {
109
+ await handleVote(false, comment.comment_id)
110
+ setDislikes((prev) => prev + 1)
111
+ }}
112
+ aria-label='Dislike Button'
113
+ type='button'
114
+ className={`${styles.buttonGroup} ${styles.right} ${currentUserInteractions.current?.find(v => v.startsWith(`${comment.comment_id}:`))?.split(': ')[1] === 'vote_up' && styles.disabled || ''}`}
115
+ disabled={currentUserInteractions.current?.find(v => v.startsWith(`${comment.comment_id}:`))}
116
+ >
117
+ <LazyImage className={styles.buttonGroupIcon} src='/images/dislike.svg' />
118
+ <span>{dislikes}</span>
119
+ </button>
120
+ </>
121
+ )}
111
122
  {!isReply && (
112
123
  <button aria-label='Reply Button' onClick={() => setReply(!reply)} type='button' className={styles.replyButton}>
113
124
  {reply ? useTranslate('cancel_reply_button', 'Cancel Reply') : useTranslate('reply_button', 'Reply')}
@@ -134,7 +145,8 @@ Comment.propTypes = {
134
145
  }),
135
146
  authors: PropTypes.shape({}),
136
147
  isReply: PropTypes.bool,
137
- userInteractions: PropTypes.arrayOf(PropTypes.string)
148
+ userInteractions: PropTypes.arrayOf(PropTypes.string),
149
+ showVotes: PropTypes.bool
138
150
  };
139
151
 
140
152
  export default Comment;
@@ -4,6 +4,8 @@
4
4
  .textareaGroup {
5
5
  @include flex-direction(column);
6
6
 
7
+ position: relative;
8
+
7
9
  > div {
8
10
  @include flex-align(center, flex-start);
9
11
 
@@ -134,4 +136,23 @@ input:checked + .slider::before {
134
136
 
135
137
  .switchLabel{
136
138
  margin-left: 5.5rem;
139
+ }
140
+
141
+ .errorMsg {
142
+ font-size: 1.2rem;
143
+ color: #DD4B39;
144
+ font-weight: 400;
145
+ line-height: 1.8rem;
146
+ margin-right: auto;
147
+ margin-top: .4rem;
148
+ }
149
+
150
+ .lengthWarning{
151
+ position: absolute;
152
+ bottom: 3.5rem;
153
+ right: 1.5rem;
154
+ font-size: 1.2rem;
155
+ color: #DD4B39;
156
+ font-weight: 400;
157
+ line-height: 1.8rem;
137
158
  }
@@ -13,7 +13,8 @@ import useTranslate from '~hooks/useTranslate/useTranslate';
13
13
  const getField = (field, handleChange, elements, state) => {
14
14
  const { type, id, translationKey, label, placeholder, icon = null, ...props } = field;
15
15
  const [rating, setRating] = useState(3);
16
-
16
+ const { errorMsg, ...restProps } = props;
17
+
17
18
  switch (type) {
18
19
  case "textarea":
19
20
  return (
@@ -25,7 +26,7 @@ const getField = (field, handleChange, elements, state) => {
25
26
  placeholder?.translationKey,
26
27
  placeholder?.label
27
28
  )}
28
- {...props}
29
+ {...restProps}
29
30
  value={elements[id]}
30
31
  onChange={(e) => handleChange(e.target.name, e.target.value)}
31
32
  className={`${
@@ -35,6 +36,10 @@ const getField = (field, handleChange, elements, state) => {
35
36
  {field.maxLength && (
36
37
  <span>{`${elements[id].length}/${field.maxLength}`}</span>
37
38
  )}
39
+ {field.minlength && (
40
+ <span className={styles.lengthWarning}>{`Minimum ${field.minlength} words`}</span>
41
+ )}
42
+ {field.errorMsg && <span className={styles.errorMsg}>{field.errorMsg}</span>}
38
43
  </div>
39
44
  );
40
45
  case "checkbox":
@@ -194,7 +199,7 @@ const getField = (field, handleChange, elements, state) => {
194
199
  placeholder?.translationKey,
195
200
  placeholder?.label
196
201
  )}
197
- {...props}
202
+ {...restProps}
198
203
  value={elements[id]}
199
204
  onChange={(e) => handleChange(e.target.name, e.target.value)}
200
205
  className={`${styles.inputBox || ""} ${
@@ -208,9 +213,13 @@ const getField = (field, handleChange, elements, state) => {
208
213
  <div className={styles.inputGroup || ""}>
209
214
  {icon}
210
215
  {inputElement}
216
+ {field.errorMsg && <span className={styles.errorMsg}>{field.errorMsg}</span>}
211
217
  </div>
212
218
  ) : (
213
- inputElement
219
+ <>
220
+ {inputElement}
221
+ {field.errorMsg && <span className={styles.errorMsg}>{field.errorMsg}</span>}
222
+ </>
214
223
  );
215
224
  }
216
225
  }
@@ -232,11 +232,35 @@
232
232
  display: grid;
233
233
  grid-template-columns: 1fr 1fr;
234
234
 
235
+ div > input ~ span, div > textarea ~ span{
236
+ display: none;
237
+ }
238
+
235
239
  input:user-invalid{
236
240
  border: .15rem solid var(--comment-input-error, #DD4B39);
237
241
  }
238
242
 
239
- input:not(:placeholder-shown):invalid{
243
+ textarea:user-invalid{
244
+ border: .15rem solid var(--comment-input-error, #DD4B39);
245
+ }
246
+
247
+ input:user-invalid ~ span{
248
+ display: block;
249
+ }
250
+
251
+ textarea:user-invalid ~ span{
252
+ display: block;
253
+ }
254
+
255
+ input:not(:placeholder-shown):invalid ~ span{
256
+ display: block;
257
+ }
258
+
259
+ textarea:not(:placeholder-shown):invalid ~ span{
260
+ display: block;
261
+ }
262
+
263
+ input:not(:placeholder-shown):invalid, textarea:not(:placeholder-shown):invalid{
240
264
  border: .15rem solid var(--comment-input-error, #DD4B39);
241
265
  }
242
266
 
@@ -119,6 +119,7 @@ export const commentForm = {
119
119
  translationKey: 'name_placeholder',
120
120
  },
121
121
  twoCol: true,
122
+ errorMsg: "Please enter your name."
122
123
  },
123
124
  {
124
125
  label: 'Email Address',
@@ -131,6 +132,7 @@ export const commentForm = {
131
132
  },
132
133
  translationKey: 'email_label',
133
134
  twoCol: true,
135
+ errorMsg: "Please enter a valid email address."
134
136
  },
135
137
  {
136
138
  label: 'Leave a comment',
@@ -143,6 +145,8 @@ export const commentForm = {
143
145
  translationKey: 'textarea_label',
144
146
  twoCol: false,
145
147
  required: true,
148
+ minlength: 15,
149
+ errorMsg: "Please enter a comment."
146
150
  },
147
151
  {
148
152
  id: 'post_anonymously',
@@ -205,6 +209,7 @@ export const replyForm = {
205
209
  translationKey: 'name_placeholder',
206
210
  },
207
211
  twoCol: true,
212
+ errorMsg: "Please enter your name."
208
213
  },
209
214
  {
210
215
  label: 'Email Address',
@@ -217,6 +222,7 @@ export const replyForm = {
217
222
  },
218
223
  translationKey: 'email_label',
219
224
  twoCol: true,
225
+ errorMsg: "Please enter a valid email address."
220
226
  },
221
227
  {
222
228
  label: 'Leave a comment',
@@ -229,6 +235,8 @@ export const replyForm = {
229
235
  translationKey: 'textarea_label',
230
236
  twoCol: false,
231
237
  required: true,
238
+ minlength: 15,
239
+ errorMsg: "Please enter a comment."
232
240
  },
233
241
  {
234
242
  id: `post_anonymously_${Math.floor(Math.random() * 1000000)}`,