@performant-software/semantic-components 1.0.6-beta.3 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@performant-software/semantic-components",
3
- "version": "1.0.6-beta.3",
3
+ "version": "1.0.6",
4
4
  "description": "A package of shared components based on the Semantic UI Framework.",
5
5
  "license": "MIT",
6
6
  "main": "./build/index.js",
@@ -12,7 +12,7 @@
12
12
  "build": "webpack --mode production && flow-copy-source -v src types"
13
13
  },
14
14
  "dependencies": {
15
- "@performant-software/shared-components": "^1.0.6-beta.3",
15
+ "@performant-software/shared-components": "^1.0.6",
16
16
  "@react-google-maps/api": "^2.8.1",
17
17
  "axios": "^0.26.1",
18
18
  "citeproc": "^2.4.62",
@@ -19,6 +19,9 @@ import Draggable from './Draggable';
19
19
  import './HorizontalCards.css';
20
20
 
21
21
  type Props = {
22
+ cardClassName?: string,
23
+ cardsClassName?: string,
24
+ className?: string,
22
25
  inlineImage?: boolean,
23
26
  items: Array<any>,
24
27
  onClick?: (item: any, index: number) => void,
@@ -48,6 +51,25 @@ const HorizontalCards = (props: Props) => {
48
51
  flex: `0 0 ${(pageWidth / props.perPage) - marginWidth}px`
49
52
  }), [pageWidth, marginWidth, props.perPage]);
50
53
 
54
+ /**
55
+ * Helper function to concatenate class names.
56
+ *
57
+ * @type {function(*, *=): string}
58
+ */
59
+ const getClassName = useCallback((className, defaultClassName = null) => {
60
+ const classNames = [];
61
+
62
+ if (defaultClassName) {
63
+ classNames.push(defaultClassName);
64
+ }
65
+
66
+ if (className) {
67
+ classNames.push(className);
68
+ }
69
+
70
+ return classNames.join(' ');
71
+ }, []);
72
+
51
73
  /**
52
74
  * Initializes the page width and scroll pages on the sate.
53
75
  *
@@ -142,6 +164,7 @@ const HorizontalCards = (props: Props) => {
142
164
  const renderCard = (item, index) => {
143
165
  let card = (
144
166
  <Card
167
+ className={getClassName(props.cardClassName)}
145
168
  link
146
169
  onClick={props.onClick && props.onClick.bind(this, item, index)}
147
170
  style={cardStyle}
@@ -229,12 +252,14 @@ const HorizontalCards = (props: Props) => {
229
252
 
230
253
  return (
231
254
  <div
232
- className='horizontal-cards'
255
+ className={getClassName(props.className, 'horizontal-cards')}
233
256
  >
234
257
  <Ref
235
258
  innerRef={ref}
236
259
  >
237
- <Card.Group>
260
+ <Card.Group
261
+ className={getClassName(props.cardsClassName)}
262
+ >
238
263
  { _.map(props.items, renderCard.bind(this)) }
239
264
  </Card.Group>
240
265
  </Ref>
@@ -19,6 +19,9 @@ import Draggable from './Draggable';
19
19
  import './HorizontalCards.css';
20
20
 
21
21
  type Props = {
22
+ cardClassName?: string,
23
+ cardsClassName?: string,
24
+ className?: string,
22
25
  inlineImage?: boolean,
23
26
  items: Array<any>,
24
27
  onClick?: (item: any, index: number) => void,
@@ -48,6 +51,25 @@ const HorizontalCards = (props: Props) => {
48
51
  flex: `0 0 ${(pageWidth / props.perPage) - marginWidth}px`
49
52
  }), [pageWidth, marginWidth, props.perPage]);
50
53
 
54
+ /**
55
+ * Helper function to concatenate class names.
56
+ *
57
+ * @type {function(*, *=): string}
58
+ */
59
+ const getClassName = useCallback((className, defaultClassName = null) => {
60
+ const classNames = [];
61
+
62
+ if (defaultClassName) {
63
+ classNames.push(defaultClassName);
64
+ }
65
+
66
+ if (className) {
67
+ classNames.push(className);
68
+ }
69
+
70
+ return classNames.join(' ');
71
+ }, []);
72
+
51
73
  /**
52
74
  * Initializes the page width and scroll pages on the sate.
53
75
  *
@@ -142,6 +164,7 @@ const HorizontalCards = (props: Props) => {
142
164
  const renderCard = (item, index) => {
143
165
  let card = (
144
166
  <Card
167
+ className={getClassName(props.cardClassName)}
145
168
  link
146
169
  onClick={props.onClick && props.onClick.bind(this, item, index)}
147
170
  style={cardStyle}
@@ -229,12 +252,14 @@ const HorizontalCards = (props: Props) => {
229
252
 
230
253
  return (
231
254
  <div
232
- className='horizontal-cards'
255
+ className={getClassName(props.className, 'horizontal-cards')}
233
256
  >
234
257
  <Ref
235
258
  innerRef={ref}
236
259
  >
237
- <Card.Group>
260
+ <Card.Group
261
+ className={getClassName(props.cardsClassName)}
262
+ >
238
263
  { _.map(props.items, renderCard.bind(this)) }
239
264
  </Card.Group>
240
265
  </Ref>