@coorpacademy/components 11.32.42 → 11.32.43

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.
Files changed (93) hide show
  1. package/es/atom/select-icon/index.d.ts +17 -0
  2. package/es/atom/select-icon/index.d.ts.map +1 -0
  3. package/es/atom/select-icon/index.js +93 -0
  4. package/es/atom/select-icon/index.js.map +1 -0
  5. package/es/atom/select-icon/style.css +73 -0
  6. package/es/molecule/certification-card/index.d.ts.map +1 -1
  7. package/es/molecule/certification-card/index.js +4 -2
  8. package/es/molecule/certification-card/index.js.map +1 -1
  9. package/es/molecule/certification-card/style.css +23 -7
  10. package/es/molecule/progress-wrapper/index.js +1 -1
  11. package/es/molecule/progress-wrapper/index.js.map +1 -1
  12. package/es/molecule/progress-wrapper/style.css +1 -0
  13. package/es/template/certification-detail/index.d.ts +1 -1
  14. package/es/template/certification-detail/index.d.ts.map +1 -1
  15. package/es/template/certification-detail/index.js +16 -5
  16. package/es/template/certification-detail/index.js.map +1 -1
  17. package/es/template/certification-detail/style.css +0 -1
  18. package/es/template/certifications/index.d.ts.map +1 -1
  19. package/es/template/certifications/index.js +3 -1
  20. package/es/template/certifications/index.js.map +1 -1
  21. package/es/template/certifications/style.css +8 -1
  22. package/es/template/playlist-detail/index.d.ts.map +1 -1
  23. package/es/template/playlist-detail/index.js +15 -4
  24. package/es/template/playlist-detail/index.js.map +1 -1
  25. package/es/template/playlist-detail/style.css +0 -1
  26. package/es/template/skill-detail/index.d.ts.map +1 -1
  27. package/es/template/skill-detail/index.js +15 -3
  28. package/es/template/skill-detail/index.js.map +1 -1
  29. package/es/variables/colors.d.ts +1 -0
  30. package/es/variables/colors.d.ts.map +1 -1
  31. package/es/variables/colors.js +1 -0
  32. package/es/variables/colors.js.map +1 -1
  33. package/lib/atom/select-icon/index.d.ts +17 -0
  34. package/lib/atom/select-icon/index.d.ts.map +1 -0
  35. package/lib/atom/select-icon/index.js +111 -0
  36. package/lib/atom/select-icon/index.js.map +1 -0
  37. package/lib/atom/select-icon/style.css +73 -0
  38. package/lib/molecule/certification-card/index.d.ts.map +1 -1
  39. package/lib/molecule/certification-card/index.js +4 -2
  40. package/lib/molecule/certification-card/index.js.map +1 -1
  41. package/lib/molecule/certification-card/style.css +23 -7
  42. package/lib/molecule/progress-wrapper/index.js +1 -1
  43. package/lib/molecule/progress-wrapper/index.js.map +1 -1
  44. package/lib/molecule/progress-wrapper/style.css +1 -0
  45. package/lib/template/certification-detail/index.d.ts +1 -1
  46. package/lib/template/certification-detail/index.d.ts.map +1 -1
  47. package/lib/template/certification-detail/index.js +15 -5
  48. package/lib/template/certification-detail/index.js.map +1 -1
  49. package/lib/template/certification-detail/style.css +0 -1
  50. package/lib/template/certifications/index.d.ts.map +1 -1
  51. package/lib/template/certifications/index.js +3 -1
  52. package/lib/template/certifications/index.js.map +1 -1
  53. package/lib/template/certifications/style.css +8 -1
  54. package/lib/template/playlist-detail/index.d.ts.map +1 -1
  55. package/lib/template/playlist-detail/index.js +14 -4
  56. package/lib/template/playlist-detail/index.js.map +1 -1
  57. package/lib/template/playlist-detail/style.css +0 -1
  58. package/lib/template/skill-detail/index.d.ts.map +1 -1
  59. package/lib/template/skill-detail/index.js +14 -2
  60. package/lib/template/skill-detail/index.js.map +1 -1
  61. package/lib/variables/colors.d.ts +1 -0
  62. package/lib/variables/colors.d.ts.map +1 -1
  63. package/lib/variables/colors.js +1 -0
  64. package/lib/variables/colors.js.map +1 -1
  65. package/locales/bs/global.json +2 -0
  66. package/locales/cs/global.json +2 -0
  67. package/locales/de/global.json +2 -0
  68. package/locales/en/global.json +2 -0
  69. package/locales/es/global.json +2 -0
  70. package/locales/et/global.json +2 -0
  71. package/locales/fi/global.json +2 -0
  72. package/locales/fr/global.json +2 -0
  73. package/locales/hr/global.json +2 -0
  74. package/locales/hu/global.json +2 -0
  75. package/locales/hy/global.json +2 -0
  76. package/locales/it/global.json +2 -0
  77. package/locales/ja/global.json +2 -0
  78. package/locales/ko/global.json +2 -0
  79. package/locales/nl/global.json +2 -0
  80. package/locales/pl/global.json +2 -0
  81. package/locales/pt/global.json +2 -0
  82. package/locales/ro/global.json +2 -0
  83. package/locales/ru/global.json +2 -0
  84. package/locales/sk/global.json +2 -0
  85. package/locales/sl/global.json +2 -0
  86. package/locales/sv/global.json +2 -0
  87. package/locales/tl/global.json +2 -0
  88. package/locales/tr/global.json +2 -0
  89. package/locales/uk/global.json +2 -0
  90. package/locales/vi/global.json +2 -0
  91. package/locales/zh/global.json +2 -0
  92. package/locales/zh_TW/global.json +2 -0
  93. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/playlist-detail/index.js"],"names":[],"mappings":";AAkBA,uEAyEC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/playlist-detail/index.js"],"names":[],"mappings":";AAgBA,uEAqFC"}
@@ -1,5 +1,5 @@
1
1
  import _isNil from "lodash/fp/isNil";
2
- import React, { useCallback, useState } from 'react';
2
+ import React, { useCallback, useState, useEffect, useRef } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import classnames from 'classnames';
5
5
  import Markdown from 'markdown-to-jsx';
@@ -13,7 +13,6 @@ import AllCourses from '../skill-detail/all-courses';
13
13
  import PlaylistDetailCover from '../../molecule/playlist-detail-cover';
14
14
  import { ContinueLearningButton } from '../skill-detail';
15
15
  import style from './style.css';
16
- const DESCRIPTION_BREAKPOINT = 382;
17
16
 
18
17
  const PlaylistDetail = (props, context) => {
19
18
  const {
@@ -28,13 +27,25 @@ const PlaylistDetail = (props, context) => {
28
27
  onBackClick,
29
28
  onContinueLearningClick
30
29
  } = props;
30
+ const descriptionRef = useRef(null);
31
31
  const {
32
32
  translate
33
33
  } = context;
34
+ const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);
34
35
  const [showMore, setShowMore] = useState(false);
35
36
  const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);
37
+ useEffect(() => {
38
+ if (descriptionRef.current) {
39
+ const {
40
+ clientHeight = 0,
41
+ scrollHeight = 0
42
+ } = descriptionRef.current;
43
+ setIsDescriptionTruncated(scrollHeight > clientHeight);
44
+ }
45
+ }, [description]);
36
46
  const Description = useCallback(() => {
37
47
  return /*#__PURE__*/React.createElement("div", {
48
+ ref: descriptionRef,
38
49
  className: classnames(style.description, !showMore && style.truncate)
39
50
  }, /*#__PURE__*/React.createElement(Markdown, null, description));
40
51
  }, [showMore, description]);
@@ -46,7 +57,7 @@ const PlaylistDetail = (props, context) => {
46
57
  }, !_isNil(onBackClick) ? /*#__PURE__*/React.createElement(ButtonLinkIcon, {
47
58
  faIcon: "arrow-left",
48
59
  "data-name": "back-button",
49
- "aria-label": "Back",
60
+ "aria-label": translate('back'),
50
61
  onClick: onBackClick,
51
62
  className: style.backButton,
52
63
  tooltipPlacement: "right"
@@ -60,7 +71,7 @@ const PlaylistDetail = (props, context) => {
60
71
  label: translate('playlist')
61
72
  }), /*#__PURE__*/React.createElement("div", {
62
73
  className: style.title
63
- }, title), description ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Description, null), description.length >= DESCRIPTION_BREAKPOINT ? /*#__PURE__*/React.createElement("div", {
74
+ }, title), description ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Description, null), isDescriptionTruncated ? /*#__PURE__*/React.createElement("div", {
64
75
  className: style.showMoreWrapper,
65
76
  onClick: handleShowMore
66
77
  }, translate(showMore ? 'Show less' : 'Show more'), /*#__PURE__*/React.createElement(Icon, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useState","PropTypes","classnames","Markdown","Provider","Tag","Select","SelectOptionPropTypes","ButtonLinkIcon","Icon","CardsGrid","AllCourses","PlaylistDetailCover","ContinueLearningButton","style","DESCRIPTION_BREAKPOINT","PlaylistDetail","props","context","title","coverImages","playlistRef","description","ongoingCoursesAvailable","playlistCourses","filters","sorting","onBackClick","onContinueLearningClick","translate","showMore","setShowMore","handleShowMore","Description","truncate","backgroundContainer","container","backButton","ctaContainer","coverWrapper","length","showMoreWrapper","faSize","wrapperSize","continueLearningButton","contextTypes","skin","childContextTypes","propTypes","string","isRequired","images","bool","shape","onChange","func","options","arrayOf"],"sources":["../../../src/template/playlist-detail/index.js"],"sourcesContent":["import React, {useCallback, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Tag from '../../atom/tag';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport AllCourses from '../skill-detail/all-courses';\nimport PlaylistDetailCover from '../../molecule/playlist-detail-cover';\nimport {ContinueLearningButton} from '../skill-detail';\nimport style from './style.css';\n\nconst DESCRIPTION_BREAKPOINT = 382;\n\nconst PlaylistDetail = (props, context) => {\n const {\n title,\n coverImages,\n playlistRef,\n description,\n ongoingCoursesAvailable,\n playlistCourses,\n filters,\n sorting,\n onBackClick,\n onContinueLearningClick\n } = props;\n const {translate} = context;\n\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n const Description = useCallback(() => {\n return (\n <div className={classnames(style.description, !showMore && style.truncate)}>\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={playlistRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label=\"Back\"\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div className={style.coverWrapper}>\n <PlaylistDetailCover images={coverImages} />\n </div>\n <div>\n <Tag label={translate('playlist')} />\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {description.length >= DESCRIPTION_BREAKPOINT ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {translate(showMore ? 'Show less' : 'Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{faSize: 14, wrapperSize: 16}}\n />\n </div>\n ) : null}\n </>\n ) : null}\n <div className={style.continueLearningButton}>\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n </div>\n <AllCourses content={playlistCourses} filters={filters} sorting={sorting} />\n </div>\n </div>\n );\n};\n\nPlaylistDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nPlaylistDetail.propTypes = {\n title: PropTypes.string.isRequired,\n coverImages: PlaylistDetailCover.propTypes.images,\n playlistRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n ongoingCoursesAvailable: PropTypes.bool,\n playlistCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func\n};\n\nexport default PlaylistDetail;\n"],"mappings":";AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,QAA2C,OAA3C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,SAAP,MAAsB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9B,WAAW,EAAER,mBAAmB,CAACoC,SAApB,CAA8BG,MAFlB;EAGzB9B,WAAW,EAAEpB,SAAS,CAACgD,MAAV,CAAiBC,UAHL;EAIzB5B,WAAW,EAAErB,SAAS,CAACgD,MAJE;EAKzB1B,uBAAuB,EAAEtB,SAAS,CAACmD,IALV;EAMzB5B,eAAe,EAAEvB,SAAS,CAACoD,KAAV,CAAgB3C,SAAS,CAACsC,SAA1B,CANQ;EAOzBvB,OAAO,EAAExB,SAAS,CAACoD,KAAV,CAAgB;IACvBC,QAAQ,EAAErD,SAAS,CAACsD,IADG;IAEvBC,OAAO,EAAEvD,SAAS,CAACwD,OAAV,CAAkBxD,SAAS,CAACoD,KAAV,CAAgB9C,qBAAhB,CAAlB;EAFc,CAAhB,CAPgB;EAWzBmB,OAAO,EAAEzB,SAAS,CAACoD,KAAV,CAAgB/C,MAAM,CAAC0C,SAAvB,CAXgB;EAYzBrB,WAAW,EAAE1B,SAAS,CAACsD,IAZE;EAazB3B,uBAAuB,EAAE3B,SAAS,CAACsD;AAbV,CAA3B;AAgBA,eAAevC,cAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useState","useEffect","useRef","PropTypes","classnames","Markdown","Provider","Tag","Select","SelectOptionPropTypes","ButtonLinkIcon","Icon","CardsGrid","AllCourses","PlaylistDetailCover","ContinueLearningButton","style","PlaylistDetail","props","context","title","coverImages","playlistRef","description","ongoingCoursesAvailable","playlistCourses","filters","sorting","onBackClick","onContinueLearningClick","descriptionRef","translate","isDescriptionTruncated","setIsDescriptionTruncated","showMore","setShowMore","handleShowMore","current","clientHeight","scrollHeight","Description","truncate","backgroundContainer","container","backButton","ctaContainer","coverWrapper","showMoreWrapper","faSize","wrapperSize","continueLearningButton","contextTypes","skin","childContextTypes","propTypes","string","isRequired","images","bool","shape","onChange","func","options","arrayOf"],"sources":["../../../src/template/playlist-detail/index.js"],"sourcesContent":["import React, {useCallback, useState, useEffect, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Tag from '../../atom/tag';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport AllCourses from '../skill-detail/all-courses';\nimport PlaylistDetailCover from '../../molecule/playlist-detail-cover';\nimport {ContinueLearningButton} from '../skill-detail';\nimport style from './style.css';\n\nconst PlaylistDetail = (props, context) => {\n const {\n title,\n coverImages,\n playlistRef,\n description,\n ongoingCoursesAvailable,\n playlistCourses,\n filters,\n sorting,\n onBackClick,\n onContinueLearningClick\n } = props;\n const descriptionRef = useRef(null);\n const {translate} = context;\n\n const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n useEffect(() => {\n if (descriptionRef.current) {\n const {clientHeight = 0, scrollHeight = 0} = descriptionRef.current;\n setIsDescriptionTruncated(scrollHeight > clientHeight);\n }\n }, [description]);\n\n const Description = useCallback(() => {\n return (\n <div\n ref={descriptionRef}\n className={classnames(style.description, !showMore && style.truncate)}\n >\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={playlistRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label={translate('back')}\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div className={style.coverWrapper}>\n <PlaylistDetailCover images={coverImages} />\n </div>\n <div>\n <Tag label={translate('playlist')} />\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {isDescriptionTruncated ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {translate(showMore ? 'Show less' : 'Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{faSize: 14, wrapperSize: 16}}\n />\n </div>\n ) : null}\n </>\n ) : null}\n <div className={style.continueLearningButton}>\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n </div>\n <AllCourses content={playlistCourses} filters={filters} sorting={sorting} />\n </div>\n </div>\n );\n};\n\nPlaylistDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nPlaylistDetail.propTypes = {\n title: PropTypes.string.isRequired,\n coverImages: PlaylistDetailCover.propTypes.images,\n playlistRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n ongoingCoursesAvailable: PropTypes.bool,\n playlistCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func\n};\n\nexport default PlaylistDetail;\n"],"mappings":";AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,SAAtC,EAAiDC,MAAjD,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,UAAP,MAAuB,6BAAvB;AACA,OAAOC,mBAAP,MAAgC,sCAAhC;AACA,SAAQC,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AAjE,EAxCF,CADF,CADF;AA8CD,CArFD;;AAuFAV,cAAc,CAACkC,YAAf,GAA8B;EAC5BC,IAAI,EAAE9C,QAAQ,CAAC+C,iBAAT,CAA2BD,IADL;EAE5BrB,SAAS,EAAEzB,QAAQ,CAAC+C,iBAAT,CAA2BtB;AAFV,CAA9B;AAKAd,cAAc,CAACqC,SAAf,2CAA2B;EACzBlC,KAAK,EAAEjB,SAAS,CAACoD,MAAV,CAAiBC,UADC;EAEzBnC,WAAW,EAAEP,mBAAmB,CAACwC,SAApB,CAA8BG,MAFlB;EAGzBnC,WAAW,EAAEnB,SAAS,CAACoD,MAAV,CAAiBC,UAHL;EAIzBjC,WAAW,EAAEpB,SAAS,CAACoD,MAJE;EAKzB/B,uBAAuB,EAAErB,SAAS,CAACuD,IALV;EAMzBjC,eAAe,EAAEtB,SAAS,CAACwD,KAAV,CAAgB/C,SAAS,CAAC0C,SAA1B,CANQ;EAOzB5B,OAAO,EAAEvB,SAAS,CAACwD,KAAV,CAAgB;IACvBC,QAAQ,EAAEzD,SAAS,CAAC0D,IADG;IAEvBC,OAAO,EAAE3D,SAAS,CAAC4D,OAAV,CAAkB5D,SAAS,CAACwD,KAAV,CAAgBlD,qBAAhB,CAAlB;EAFc,CAAhB,CAPgB;EAWzBkB,OAAO,EAAExB,SAAS,CAACwD,KAAV,CAAgBnD,MAAM,CAAC8C,SAAvB,CAXgB;EAYzB1B,WAAW,EAAEzB,SAAS,CAAC0D,IAZE;EAazBhC,uBAAuB,EAAE1B,SAAS,CAAC0D;AAbV,CAA3B;AAgBA,eAAe5C,cAAf"}
@@ -41,7 +41,6 @@
41
41
 
42
42
  .ctaContainer {
43
43
  display: flex;
44
- align-items: center;
45
44
  width: 100%;
46
45
  gap: 40px;
47
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/index.js"],"names":[],"mappings":"AAeO,8EA+BN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYD,oEAwIC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/index.js"],"names":[],"mappings":"AAeO,8EA+BN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYD,oEAoJC"}
@@ -1,6 +1,6 @@
1
1
  import _isNil from "lodash/fp/isNil";
2
2
  import _get from "lodash/fp/get";
3
- import React, { useCallback, useState } from 'react';
3
+ import React, { useCallback, useState, useRef, useEffect } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { convert } from 'css-color-function';
6
6
  import classnames from 'classnames';
@@ -72,6 +72,7 @@ const SkillDetail = (props, context) => {
72
72
  onReviewClick,
73
73
  onContinueLearningClick
74
74
  } = props;
75
+ const descriptionRef = useRef(null);
75
76
  const {
76
77
  score = 0,
77
78
  questionsToReview
@@ -79,10 +80,21 @@ const SkillDetail = (props, context) => {
79
80
  const {
80
81
  translate
81
82
  } = context;
83
+ const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);
82
84
  const [showMore, setShowMore] = useState(false);
83
85
  const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);
86
+ useEffect(() => {
87
+ if (descriptionRef.current) {
88
+ const {
89
+ clientHeight = 0,
90
+ scrollHeight = 0
91
+ } = descriptionRef.current;
92
+ setIsDescriptionTruncated(scrollHeight > clientHeight);
93
+ }
94
+ }, [description]);
84
95
  const Description = useCallback(() => {
85
96
  return /*#__PURE__*/React.createElement("div", {
97
+ ref: descriptionRef,
86
98
  className: classnames(style.description, !showMore && style.truncate)
87
99
  }, /*#__PURE__*/React.createElement(Markdown, null, description));
88
100
  }, [showMore, description]);
@@ -110,7 +122,7 @@ const SkillDetail = (props, context) => {
110
122
  }, !_isNil(onBackClick) ? /*#__PURE__*/React.createElement(ButtonLinkIcon, {
111
123
  faIcon: "arrow-left",
112
124
  "data-name": "back-button",
113
- "aria-label": "Back",
125
+ "aria-label": translate('back'),
114
126
  onClick: onBackClick,
115
127
  className: style.backButton,
116
128
  tooltipPlacement: "right"
@@ -127,7 +139,7 @@ const SkillDetail = (props, context) => {
127
139
  }
128
140
  }), translate('skill_focus')) : null, /*#__PURE__*/React.createElement("div", {
129
141
  className: style.title
130
- }, title), description ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Description, null), description.length >= 226 ? /*#__PURE__*/React.createElement("div", {
142
+ }, title), description ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Description, null), isDescriptionTruncated ? /*#__PURE__*/React.createElement("div", {
131
143
  className: style.showMoreWrapper,
132
144
  onClick: handleShowMore
133
145
  }, showMore ? translate('Show less') : translate('Show more'), /*#__PURE__*/React.createElement(Icon, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useState","PropTypes","convert","classnames","Markdown","Provider","Select","SelectOptionPropTypes","ButtonLink","ButtonLinkIcon","Icon","CardsGrid","style","AllCourses","ContinueLearningButton","props","context","ongoingCoursesAvailable","onClick","skin","translate","primarySkinColor","width","borderRadius","backgroundColor","position","faIcon","name","color","size","contextTypes","childContextTypes","propTypes","bool","func","SkillDetail","title","skillRef","description","metrics","focused","availableForReview","totalCourses","skillIncludedCourses","filters","sorting","onBackClick","onReviewClick","onContinueLearningClick","score","questionsToReview","showMore","setShowMore","handleShowMore","Description","truncate","ProgressBar","undefined","progressBarColor","inlineProgressValueStyle","progressBarWrapper","progress","backgroundContainer","container","backButton","ctaContainer","skillFocusBadge","faSize","wrapperSize","length","showMoreWrapper","ctaWrapper","skillInformation","skillInformationNumber","progressContainer","progressInformationNumber","toFixed","string","isRequired","shape","number","onChange","options","arrayOf"],"sources":["../../../src/template/skill-detail/index.js"],"sourcesContent":["import React, {useCallback, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {convert} from 'css-color-function';\nimport classnames from 'classnames';\nimport {get, isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport style from './style.css';\nimport AllCourses from './all-courses';\n\nexport const ContinueLearningButton = (props, context) => {\n const {ongoingCoursesAvailable, onClick} = props;\n const {skin, translate} = context;\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div>\n <ButtonLink\n label={\n ongoingCoursesAvailable ? translate('continue_learning') : translate('start_learning')\n }\n type=\"primary\"\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px',\n backgroundColor: primarySkinColor\n }}\n hoverBackgroundColor={convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`)}\n hoverColor=\"#FFFFFF\"\n icon={{\n position: 'left',\n faIcon: {\n name: 'play',\n color: '#FFFFFF',\n size: 16\n }\n }}\n onClick={onClick}\n />\n </div>\n );\n};\n\nContinueLearningButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContinueLearningButton.propTypes = {\n ongoingCoursesAvailable: PropTypes.bool,\n onClick: PropTypes.func\n};\n\nconst SkillDetail = (props, context) => {\n const {\n title,\n skillRef,\n description,\n metrics = {},\n focused,\n availableForReview,\n ongoingCoursesAvailable,\n totalCourses,\n skillIncludedCourses,\n filters,\n sorting,\n onBackClick,\n onReviewClick,\n onContinueLearningClick\n } = props;\n const {score = 0, questionsToReview} = metrics;\n const {translate} = context;\n\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n const Description = useCallback(() => {\n return (\n <div className={classnames(style.description, !showMore && style.truncate)}>\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n const ProgressBar = useCallback(() => {\n if (score === undefined) return null;\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${score}%`\n };\n\n return (\n <div className={style.progressBarWrapper}>\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n role=\"progressbar\"\n />\n </div>\n );\n }, [score]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={skillRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label=\"Back\"\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div>\n {focused ? (\n <div className={style.skillFocusBadge}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 10,\n wrapperSize: 16\n }}\n />\n {translate('skill_focus')}\n </div>\n ) : null}\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {description.length >= 226 ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {showMore ? translate('Show less') : translate('Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{\n faSize: 14,\n wrapperSize: 16\n }}\n />\n </div>\n ) : null}\n </>\n ) : null}\n </div>\n\n <div className={style.ctaWrapper}>\n <ButtonLink\n type=\"secondary\"\n onClick={onReviewClick}\n label={translate('review_this_skill')}\n disabled={!availableForReview}\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px'\n }}\n />\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n {questionsToReview > 0 ? (\n <div className={style.skillInformation} data-name=\"skill-questions\">\n <span className={style.skillInformationNumber}>{questionsToReview}</span>\n &nbsp;{translate('skill_chart_side_panel_questions_to_review')}\n </div>\n ) : null}\n <div className={style.progressContainer}>\n <ProgressBar />\n <span className={style.progressInformationNumber}>{score.toFixed(1)}%</span>\n </div>\n <AllCourses\n content={skillIncludedCourses}\n filters={filters}\n sorting={sorting}\n totalContents={totalCourses}\n />\n </div>\n </div>\n );\n};\n\nSkillDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nSkillDetail.propTypes = {\n title: PropTypes.string.isRequired,\n skillRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n metrics: PropTypes.shape({\n score: PropTypes.number,\n questionsToReview: PropTypes.number\n }),\n focused: PropTypes.bool,\n availableForReview: PropTypes.bool,\n ongoingCoursesAvailable: PropTypes.bool,\n totalCourses: PropTypes.number,\n skillIncludedCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onReviewClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func\n};\n\nexport default SkillDetail;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,QAA2C,OAA3C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,OAAO,MAAMC,sBAAsB,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACxD,MAAM;IAACC,uBAAD;IAA0BC;EAA1B,IAAqCH,KAA3C;EACA,MAAM;IAACI,IAAD;IAAOC;EAAP,IAAoBJ,OAA1B;;EACA,MAAMK,gBAAgB,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C,SAAS,CAAC+E,MAXF;EAYtBrC,oBAAoB,EAAE1C,SAAS,CAAC8E,KAAV,CAAgBpE,SAAS,CAACqB,SAA1B,CAZA;EAatBY,OAAO,EAAE3C,SAAS,CAAC8E,KAAV,CAAgB;IACvBE,QAAQ,EAAEhF,SAAS,CAACiC,IADG;IAEvBgD,OAAO,EAAEjF,SAAS,CAACkF,OAAV,CAAkBlF,SAAS,CAAC8E,KAAV,CAAgBxE,qBAAhB,CAAlB;EAFc,CAAhB,CAba;EAiBtBsC,OAAO,EAAE5C,SAAS,CAAC8E,KAAV,CAAgBzE,MAAM,CAAC0B,SAAvB,CAjBa;EAkBtBc,WAAW,EAAE7C,SAAS,CAACiC,IAlBD;EAmBtBa,aAAa,EAAE9C,SAAS,CAACiC,IAnBH;EAoBtBc,uBAAuB,EAAE/C,SAAS,CAACiC;AApBb,CAAxB;AAuBA,eAAeC,WAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useState","useRef","useEffect","PropTypes","convert","classnames","Markdown","Provider","Select","SelectOptionPropTypes","ButtonLink","ButtonLinkIcon","Icon","CardsGrid","style","AllCourses","ContinueLearningButton","props","context","ongoingCoursesAvailable","onClick","skin","translate","primarySkinColor","width","borderRadius","backgroundColor","position","faIcon","name","color","size","contextTypes","childContextTypes","propTypes","bool","func","SkillDetail","title","skillRef","description","metrics","focused","availableForReview","totalCourses","skillIncludedCourses","filters","sorting","onBackClick","onReviewClick","onContinueLearningClick","descriptionRef","score","questionsToReview","isDescriptionTruncated","setIsDescriptionTruncated","showMore","setShowMore","handleShowMore","current","clientHeight","scrollHeight","Description","truncate","ProgressBar","undefined","progressBarColor","inlineProgressValueStyle","progressBarWrapper","progress","backgroundContainer","container","backButton","ctaContainer","skillFocusBadge","faSize","wrapperSize","showMoreWrapper","ctaWrapper","skillInformation","skillInformationNumber","progressContainer","progressInformationNumber","toFixed","string","isRequired","shape","number","onChange","options","arrayOf"],"sources":["../../../src/template/skill-detail/index.js"],"sourcesContent":["import React, {useCallback, useState, useRef, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport {convert} from 'css-color-function';\nimport classnames from 'classnames';\nimport {get, isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport style from './style.css';\nimport AllCourses from './all-courses';\n\nexport const ContinueLearningButton = (props, context) => {\n const {ongoingCoursesAvailable, onClick} = props;\n const {skin, translate} = context;\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div>\n <ButtonLink\n label={\n ongoingCoursesAvailable ? translate('continue_learning') : translate('start_learning')\n }\n type=\"primary\"\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px',\n backgroundColor: primarySkinColor\n }}\n hoverBackgroundColor={convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`)}\n hoverColor=\"#FFFFFF\"\n icon={{\n position: 'left',\n faIcon: {\n name: 'play',\n color: '#FFFFFF',\n size: 16\n }\n }}\n onClick={onClick}\n />\n </div>\n );\n};\n\nContinueLearningButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContinueLearningButton.propTypes = {\n ongoingCoursesAvailable: PropTypes.bool,\n onClick: PropTypes.func\n};\n\nconst SkillDetail = (props, context) => {\n const {\n title,\n skillRef,\n description,\n metrics = {},\n focused,\n availableForReview,\n ongoingCoursesAvailable,\n totalCourses,\n skillIncludedCourses,\n filters,\n sorting,\n onBackClick,\n onReviewClick,\n onContinueLearningClick\n } = props;\n const descriptionRef = useRef(null);\n const {score = 0, questionsToReview} = metrics;\n const {translate} = context;\n\n const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n useEffect(() => {\n if (descriptionRef.current) {\n const {clientHeight = 0, scrollHeight = 0} = descriptionRef.current;\n setIsDescriptionTruncated(scrollHeight > clientHeight);\n }\n }, [description]);\n\n const Description = useCallback(() => {\n return (\n <div\n ref={descriptionRef}\n className={classnames(style.description, !showMore && style.truncate)}\n >\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n const ProgressBar = useCallback(() => {\n if (score === undefined) return null;\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${score}%`\n };\n\n return (\n <div className={style.progressBarWrapper}>\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n role=\"progressbar\"\n />\n </div>\n );\n }, [score]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={skillRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label={translate('back')}\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div>\n {focused ? (\n <div className={style.skillFocusBadge}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 10,\n wrapperSize: 16\n }}\n />\n {translate('skill_focus')}\n </div>\n ) : null}\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {isDescriptionTruncated ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {showMore ? translate('Show less') : translate('Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{\n faSize: 14,\n wrapperSize: 16\n }}\n />\n </div>\n ) : null}\n </>\n ) : null}\n </div>\n\n <div className={style.ctaWrapper}>\n <ButtonLink\n type=\"secondary\"\n onClick={onReviewClick}\n label={translate('review_this_skill')}\n disabled={!availableForReview}\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px'\n }}\n />\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n {questionsToReview > 0 ? (\n <div className={style.skillInformation} data-name=\"skill-questions\">\n <span className={style.skillInformationNumber}>{questionsToReview}</span>\n &nbsp;{translate('skill_chart_side_panel_questions_to_review')}\n </div>\n ) : null}\n <div className={style.progressContainer}>\n <ProgressBar />\n <span className={style.progressInformationNumber}>{score.toFixed(1)}%</span>\n </div>\n <AllCourses\n content={skillIncludedCourses}\n filters={filters}\n sorting={sorting}\n totalContents={totalCourses}\n />\n </div>\n </div>\n );\n};\n\nSkillDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nSkillDetail.propTypes = {\n title: PropTypes.string.isRequired,\n skillRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n metrics: PropTypes.shape({\n score: PropTypes.number,\n questionsToReview: PropTypes.number\n }),\n focused: PropTypes.bool,\n availableForReview: PropTypes.bool,\n ongoingCoursesAvailable: PropTypes.bool,\n totalCourses: PropTypes.number,\n skillIncludedCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onReviewClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func\n};\n\nexport default SkillDetail;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,MAAtC,EAA8CC,SAA9C,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA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CAACiC,IAlBD;EAmBtBa,aAAa,EAAE9C,SAAS,CAACiC,IAnBH;EAoBtBc,uBAAuB,EAAE/C,SAAS,CAACiC;AApBb,CAAxB;AAuBA,eAAeC,WAAf"}
@@ -2,6 +2,7 @@ export declare const COLORS: {
2
2
  readonly gray: "#EAEAEB";
3
3
  readonly negative: "#ed3436";
4
4
  readonly positive: "#35CC7F";
5
+ readonly white: "#ffffff";
5
6
  readonly cm_grey_800: "#171721";
6
7
  readonly cm_primary_blue: "#0061FF";
7
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/variables/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;CAMT,CAAC;AAEX,oBAAY,MAAM,GAAG,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/variables/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAC;AAEX,oBAAY,MAAM,GAAG,OAAO,MAAM,CAAC"}
@@ -2,6 +2,7 @@ export const COLORS = {
2
2
  gray: '#EAEAEB',
3
3
  negative: '#ed3436',
4
4
  positive: '#35CC7F',
5
+ white: '#ffffff',
5
6
  cm_grey_800: '#171721',
6
7
  cm_primary_blue: '#0061FF'
7
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","names":["COLORS","gray","negative","positive","cm_grey_800","cm_primary_blue"],"sources":["../../src/variables/colors.ts"],"sourcesContent":["export const COLORS = {\n gray: '#EAEAEB',\n negative: '#ed3436',\n positive: '#35CC7F',\n cm_grey_800: '#171721',\n cm_primary_blue: '#0061FF'\n} as const;\n\nexport type Colors = typeof COLORS;\n"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG;EACpBC,IAAI,EAAE,SADc;EAEpBC,QAAQ,EAAE,SAFU;EAGpBC,QAAQ,EAAE,SAHU;EAIpBC,WAAW,EAAE,SAJO;EAKpBC,eAAe,EAAE;AALG,CAAf"}
1
+ {"version":3,"file":"colors.js","names":["COLORS","gray","negative","positive","white","cm_grey_800","cm_primary_blue"],"sources":["../../src/variables/colors.ts"],"sourcesContent":["export const COLORS = {\n gray: '#EAEAEB',\n negative: '#ed3436',\n positive: '#35CC7F',\n white: '#ffffff',\n cm_grey_800: '#171721',\n cm_primary_blue: '#0061FF'\n} as const;\n\nexport type Colors = typeof COLORS;\n"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG;EACpBC,IAAI,EAAE,SADc;EAEpBC,QAAQ,EAAE,SAFU;EAGpBC,QAAQ,EAAE,SAHU;EAIpBC,KAAK,EAAE,SAJa;EAKpBC,WAAW,EAAE,SALO;EAMpBC,eAAe,EAAE;AANG,CAAf"}
@@ -0,0 +1,17 @@
1
+ export default SelectIcon;
2
+ declare function SelectIcon(props: any): JSX.Element;
3
+ declare namespace SelectIcon {
4
+ const propTypes: {
5
+ 'aria-label': PropTypes.Requireable<string>;
6
+ 'data-name': PropTypes.Requireable<string>;
7
+ faIcon: PropTypes.Requireable<string>;
8
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
9
+ options: PropTypes.Requireable<PropTypes.InferProps<{
10
+ selectionMode: PropTypes.Requireable<string>;
11
+ isSelected: PropTypes.Requireable<boolean>;
12
+ iconColor: PropTypes.Requireable<string>;
13
+ }>>;
14
+ };
15
+ }
16
+ import PropTypes from "prop-types";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select-icon/index.js"],"names":[],"mappings":";AAgDA,qDA0BC"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _react = _interopRequireWildcard(require("react"));
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+
12
+ var _icon = _interopRequireDefault(require("../icon"));
13
+
14
+ var _colors = require("../../variables/colors");
15
+
16
+ var _style = _interopRequireDefault(require("./style.css"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ 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; }
23
+
24
+ const ICON_COLOR = _colors.COLORS.cm_primary_blue;
25
+ const BACKGROUND_COLOR = _colors.COLORS.white;
26
+ const CHECK_ICON_NAME_MAP = {
27
+ single: 'circle-check',
28
+ multi: 'square-check'
29
+ };
30
+
31
+ const getButtonContent = (faIcon, options = {}) => {
32
+ const {
33
+ selectionMode = 'single',
34
+ isSelected = false,
35
+ iconColor = ICON_COLOR
36
+ } = options;
37
+ return /*#__PURE__*/_react.default.createElement("div", {
38
+ className: _style.default.contentWrapper
39
+ }, isSelected ?
40
+ /*#__PURE__*/
41
+
42
+ /* checkbox icon */
43
+ _react.default.createElement("div", {
44
+ className: _style.default.checkIcon
45
+ }, /*#__PURE__*/_react.default.createElement(_icon.default, {
46
+ iconName: CHECK_ICON_NAME_MAP[selectionMode],
47
+ iconColor: iconColor,
48
+ backgroundColor: BACKGROUND_COLOR,
49
+ size: {
50
+ faSize: 16,
51
+ wrapperSize: 16
52
+ }
53
+ })) : null,
54
+ /*#__PURE__*/
55
+
56
+ /* selection tick (L18) / icon */
57
+ _react.default.createElement("div", {
58
+ className: _style.default.iconWrapper
59
+ }, /*#__PURE__*/_react.default.createElement("div", {
60
+ className: _style.default.icon
61
+ }, /*#__PURE__*/_react.default.createElement(_icon.default, {
62
+ iconName: faIcon,
63
+ iconColor: isSelected ? iconColor : '',
64
+ size: {
65
+ faSize: 32,
66
+ wrapperSize: 32
67
+ }
68
+ })), /*#__PURE__*/_react.default.createElement("div", {
69
+ className: _style.default.iconText
70
+ }, faIcon)));
71
+ };
72
+
73
+ const SelectIcon = props => {
74
+ const {
75
+ faIcon,
76
+ 'data-name': dataName,
77
+ 'aria-label': ariaLabel,
78
+ onClick,
79
+ options = {}
80
+ } = props;
81
+ const {
82
+ isSelected = false
83
+ } = options;
84
+ const contentView = getButtonContent(faIcon, options);
85
+ const styleButton = (0, _classnames.default)(_style.default.default, isSelected && _style.default.selected);
86
+ const handleOnClick = (0, _react.useCallback)(() => onClick(), [onClick]);
87
+ const IconButton = (0, _react.useCallback)(() => /*#__PURE__*/_react.default.createElement("button", {
88
+ type: "button",
89
+ "aria-label": ariaLabel,
90
+ "data-name": dataName,
91
+ "data-testid": `button-${dataName}`,
92
+ className: styleButton,
93
+ onClick: handleOnClick
94
+ }, contentView), [ariaLabel, contentView, dataName, handleOnClick, styleButton]);
95
+ return /*#__PURE__*/_react.default.createElement(IconButton, null);
96
+ };
97
+
98
+ SelectIcon.propTypes = process.env.NODE_ENV !== "production" ? {
99
+ 'aria-label': _propTypes.default.string,
100
+ 'data-name': _propTypes.default.string,
101
+ faIcon: _propTypes.default.string,
102
+ onClick: _propTypes.default.func,
103
+ options: _propTypes.default.shape({
104
+ selectionMode: _propTypes.default.oneOf(['single', 'multi']),
105
+ isSelected: _propTypes.default.bool,
106
+ iconColor: _propTypes.default.string
107
+ })
108
+ } : {};
109
+ var _default = SelectIcon;
110
+ exports.default = _default;
111
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["ICON_COLOR","COLORS","cm_primary_blue","BACKGROUND_COLOR","white","CHECK_ICON_NAME_MAP","single","multi","getButtonContent","faIcon","options","selectionMode","isSelected","iconColor","style","contentWrapper","checkIcon","faSize","wrapperSize","iconWrapper","icon","iconText","SelectIcon","props","dataName","ariaLabel","onClick","contentView","styleButton","classnames","default","selected","handleOnClick","useCallback","IconButton","propTypes","PropTypes","string","func","shape","oneOf","bool"],"sources":["../../../src/atom/select-icon/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport FaIcon from '../icon';\n\nimport {COLORS} from '../../variables/colors';\nimport style from './style.css';\n\nconst ICON_COLOR = COLORS.cm_primary_blue;\nconst BACKGROUND_COLOR = COLORS.white;\nconst CHECK_ICON_NAME_MAP = {\n single: 'circle-check',\n multi: 'square-check'\n};\n\nconst getButtonContent = (faIcon, options = {}) => {\n const {selectionMode = 'single', isSelected = false, iconColor = ICON_COLOR} = options;\n\n return (\n <div className={style.contentWrapper}>\n {isSelected ? (\n /* checkbox icon */\n <div className={style.checkIcon}>\n <FaIcon\n iconName={CHECK_ICON_NAME_MAP[selectionMode]}\n iconColor={iconColor}\n backgroundColor={BACKGROUND_COLOR}\n size={{faSize: 16, wrapperSize: 16}}\n />\n </div>\n ) : null}\n {\n /* selection tick (L18) / icon */\n <div className={style.iconWrapper}>\n <div className={style.icon}>\n <FaIcon\n iconName={faIcon}\n iconColor={isSelected ? iconColor : ''}\n size={{faSize: 32, wrapperSize: 32}}\n />\n </div>\n <div className={style.iconText}>{faIcon}</div>\n </div>\n }\n </div>\n );\n};\n\nconst SelectIcon = props => {\n const {faIcon, 'data-name': dataName, 'aria-label': ariaLabel, onClick, options = {}} = props;\n\n const {isSelected = false} = options;\n\n const contentView = getButtonContent(faIcon, options);\n const styleButton = classnames(style.default, isSelected && style.selected);\n const handleOnClick = useCallback(() => onClick(), [onClick]);\n\n const IconButton = useCallback(\n () => (\n <button\n type=\"button\"\n aria-label={ariaLabel}\n data-name={dataName}\n data-testid={`button-${dataName}`}\n className={styleButton}\n onClick={handleOnClick}\n >\n {contentView}\n </button>\n ),\n [ariaLabel, contentView, dataName, handleOnClick, styleButton]\n );\n\n return <IconButton />;\n};\n\nSelectIcon.propTypes = {\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n faIcon: PropTypes.string,\n onClick: PropTypes.func,\n options: PropTypes.shape({\n selectionMode: PropTypes.oneOf(['single', 'multi']),\n isSelected: PropTypes.bool,\n iconColor: PropTypes.string\n })\n};\n\nexport default SelectIcon;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,UAAU,GAAGC,cAAA,CAAOC,eAA1B;AACA,MAAMC,gBAAgB,GAAGF,cAAA,CAAOG,KAAhC;AACA,MAAMC,mBAAmB,GAAG;EAC1BC,MAAM,EAAE,cADkB;EAE1BC,KAAK,EAAE;AAFmB,CAA5B;;AAKA,MAAMC,gBAAgB,GAAG,CAACC,MAAD,EAASC,OAAO,GAAG,EAAnB,KAA0B;EACjD,MAAM;IAACC,aAAa,GAAG,QAAjB;IAA2BC,UAAU,GAAG,KAAxC;IAA+CC,SAAS,GAAGb;EAA3D,IAAyEU,OAA/E;EAEA,oBACE;IAAK,SAAS,EAAEI,cAAA,CAAMC;EAAtB,GACGH,UAAU;EAAA;;EACT;EACA;IAAK,SAAS,EAAEE,cAAA,CAAME;EAAtB,gBACE,6BAAC,aAAD;IACE,QAAQ,EAAEX,mBAAmB,CAACM,aAAD,CAD/B;IAEE,SAAS,EAAEE,SAFb;IAGE,eAAe,EAAEV,gBAHnB;IAIE,IAAI,EAAE;MAACc,MAAM,EAAE,EAAT;MAAaC,WAAW,EAAE;IAA1B;EAJR,EAD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UAAD,OAAP;AACD,CA1BD;;AA4BAN,UAAU,CAACa,SAAX,2CAAuB;EACrB,cAAcC,kBAAA,CAAUC,MADH;EAErB,aAAaD,kBAAA,CAAUC,MAFF;EAGrB5B,MAAM,EAAE2B,kBAAA,CAAUC,MAHG;EAIrBX,OAAO,EAAEU,kBAAA,CAAUE,IAJE;EAKrB5B,OAAO,EAAE0B,kBAAA,CAAUG,KAAV,CAAgB;IACvB5B,aAAa,EAAEyB,kBAAA,CAAUI,KAAV,CAAgB,CAAC,QAAD,EAAW,OAAX,CAAhB,CADQ;IAEvB5B,UAAU,EAAEwB,kBAAA,CAAUK,IAFC;IAGvB5B,SAAS,EAAEuB,kBAAA,CAAUC;EAHE,CAAhB;AALY,CAAvB;eAYef,U"}
@@ -0,0 +1,73 @@
1
+ @value colors: "../../variables/colors.css";
2
+ @value cm_grey_100 from colors;
3
+ @value cm_grey_400 from colors;
4
+ @value cm_grey_500 from colors;
5
+ @value cm_grey_75 from colors;
6
+ @value cm_grey_50 from colors;
7
+ @value cm_primary_blue from colors;
8
+ @value white from colors;
9
+
10
+ .button {
11
+ font-family: Gilroy;
12
+ font-size: 12px;
13
+ font-style: normal;
14
+ font-weight: 600;
15
+ line-height: 16px;
16
+ color: cm_grey_400;
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+ cursor: pointer;
21
+ border: none;
22
+ background-color: white;
23
+ }
24
+
25
+ .button:hover {
26
+ background-color: cm_grey_100;
27
+ }
28
+
29
+ .selected {
30
+ background-color: cm_grey_50;
31
+ border: 2px solid cm_primary_blue;
32
+ }
33
+
34
+ .selected:hover {
35
+ background-color: cm_grey_75;
36
+ color: cm_grey_500;
37
+ }
38
+
39
+ .default {
40
+ composes: button;
41
+ width: 144px;
42
+ height: 120px;
43
+ border-radius: 12px;
44
+ position: relative;
45
+ }
46
+
47
+ .contentWrapper {
48
+ display: flex;
49
+ flex-direction: column;
50
+ align-items: center;
51
+ justify-content: center;
52
+ height: 100%;
53
+ }
54
+
55
+ .checkIcon {
56
+ position: absolute;
57
+ top: 8px;
58
+ right: 8px;
59
+ }
60
+
61
+ .iconWrapper {
62
+ display: flex;
63
+ flex-direction: column;
64
+ align-items: center;
65
+ }
66
+
67
+ .icon {
68
+ margin-bottom: 8px;
69
+ }
70
+
71
+ .iconText {
72
+ font-size: 12px;
73
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/certification-card/index.js"],"names":[],"mappings":";AAQA,0EAwDC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/certification-card/index.js"],"names":[],"mappings":";AAQA,0EA0DC"}
@@ -66,10 +66,12 @@ const CertificationCard = (props, context) => {
66
66
  },
67
67
  icon: progressIconProps
68
68
  }) : null, /*#__PURE__*/_react.default.createElement("div", {
69
- className: _style.default.imageWrapper
69
+ className: _style.default.imageSection
70
+ }, /*#__PURE__*/_react.default.createElement("div", {
71
+ className: _style.default.imageContainer
70
72
  }, /*#__PURE__*/_react.default.createElement("img", {
71
73
  src: imgUrl
72
- })), /*#__PURE__*/_react.default.createElement("div", {
74
+ }))), /*#__PURE__*/_react.default.createElement("div", {
73
75
  className: _style.default.detailWrapper
74
76
  }, /*#__PURE__*/_react.default.createElement("div", {
75
77
  className: _style.default.titleWrapper
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["CertificationCard","props","context","label","goal","progress","imgUrl","onClick","title","condition","nbDone","translate","isInprogress","progressLabel","progressTagType","progressIconProps","position","iconName","iconColor","backgroundColor","size","faSize","wrapperSize","customStyle","padding","style","container","top","right","imageWrapper","detailWrapper","titleWrapper","moduleCount","customProgressBar","COLORS","positive","contextTypes","Provider","childContextTypes","propTypes","PropTypes","string","shape","number","func"],"sources":["../../../src/molecule/certification-card/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {COLORS} from '../../variables/colors';\nimport Provider from '../../atom/provider';\nimport Tag from '../../atom/tag';\nimport ProgressBar from '../progress-bar';\nimport style from './style.css';\n\nconst CertificationCard = (props, context) => {\n const {label, goal, progress, imgUrl, onClick} = props;\n const {\n title,\n condition: {nbDone}\n } = goal;\n const {translate} = context;\n\n const isInprogress = progress < 100;\n const progressLabel = isInprogress ? translate('in_progress') : translate('completed');\n const progressTagType = isInprogress ? 'progress' : 'success';\n const progressIconProps = {\n position: 'left',\n iconName: isInprogress ? 'clock' : 'circle-check',\n iconColor: isInprogress ? '#B87A00' : '#05944F',\n backgroundColor: isInprogress ? '#FFEECC' : '#D6F5E5',\n size: {\n faSize: 10,\n wrapperSize: 10\n },\n customStyle: {padding: 0}\n };\n return (\n <div className={style.container} data-name={`certification-card-${label}`} onClick={onClick}>\n {progress > 0 ? (\n <Tag\n label={progressLabel}\n type={progressTagType}\n customStyle={{position: 'absolute', top: '12px', right: '12px'}}\n icon={progressIconProps}\n />\n ) : null}\n <div className={style.imageWrapper}>\n <img src={imgUrl} />\n </div>\n <div className={style.detailWrapper}>\n <div className={style.titleWrapper}>\n <Tag label={translate('certification')} size=\"S\" />\n <div className={style.title} data-name=\"certification-title\">\n {title}\n </div>\n <div className={style.moduleCount}>\n <span>{nbDone}</span>\n {` ${translate('certification_module')}`}\n </div>\n </div>\n <ProgressBar\n className={style.customProgressBar}\n style={{backgroundColor: COLORS.positive}}\n displayInfo={false}\n value={progress}\n max={100}\n />\n </div>\n </div>\n );\n};\n\nCertificationCard.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nCertificationCard.propTypes = {\n label: PropTypes.string,\n goal: PropTypes.shape({\n title: PropTypes.string,\n condition: PropTypes.shape({\n nbDone: PropTypes.number\n })\n }),\n progress: PropTypes.number,\n imgUrl: PropTypes.string,\n onClick: PropTypes.func\n};\n\nexport default CertificationCard;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,iBAAiB,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EAC5C,MAAM;IA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AAK,SAAS,EAAEL,cAAA,CAAMM;EAAtB,gBACE,6BAAC,YAAD;IAAK,KAAK,EAAEpB,SAAS,CAAC,eAAD,CAArB;IAAwC,IAAI,EAAC;EAA7C,EADF,eAEE;IAAK,SAAS,EAAEc,cAAA,CAAMjB,KAAtB;IAA6B,aAAU;EAAvC,GACGA,KADH,CAFF,eAKE;IAAK,SAAS,EAAEiB,cAAA,CAAMO;EAAtB,gBACE,2CAAOtB,MAAP,CADF,EAEI,IAAGC,SAAS,CAAC,sBAAD,CAAyB,EAFzC,CALF,CADF,eAWE,6BAAC,oBAAD;IACE,SAAS,EAAEc,cAAA,CAAMQ,iBADnB;IAEE,KAAK,EAAE;MAACd,eAAe,EAAEe,cAAA,CAAOC;IAAzB,CAFT;IAGE,WAAW,EAAE,KAHf;IAIE,KAAK,EAAE9B,QAJT;IAKE,GAAG,EAAE;EALP,EAXF,CAZF,CADF;AAkCD,CAxDD;;AA0DAL,iBAAiB,CAACoC,YAAlB,GAAiC;EAC/BzB,SAAS,EAAE0B,iBAAA,CAASC,iBAAT,CAA2B3B;AADP,CAAjC;AAIAX,iBAAiB,CAACuC,SAAlB,2CAA8B;EAC5BpC,KAAK,EAAEqC,kBAAA,CAAUC,MADW;EAE5BrC,IAAI,EAAEoC,kBAAA,CAAUE,KAAV,CAAgB;IACpBlC,KAAK,EAAEgC,kBAAA,CAAUC,MADG;IAEpBhC,SAAS,EAAE+B,kBAAA,CAAUE,KAAV,CAAgB;MACzBhC,MAAM,EAAE8B,kBAAA,CAAUG;IADO,CAAhB;EAFS,CAAhB,CAFsB;EAQ5BtC,QAAQ,EAAEmC,kBAAA,CAAUG,MARQ;EAS5BrC,MAAM,EAAEkC,kBAAA,CAAUC,MATU;EAU5BlC,OAAO,EAAEiC,kBAAA,CAAUI;AAVS,CAA9B;eAae5C,iB"}
1
+ {"version":3,"file":"index.js","names":["CertificationCard","props","context","label","goal","progress","imgUrl","onClick","title","condition","nbDone","translate","isInprogress","progressLabel","progressTagType","progressIconProps","position","iconName","iconColor","backgroundColor","size","faSize","wrapperSize","customStyle","padding","style","container","top","right","imageSection","imageContainer","detailWrapper","titleWrapper","moduleCount","customProgressBar","COLORS","positive","contextTypes","Provider","childContextTypes","propTypes","PropTypes","string","shape","number","func"],"sources":["../../../src/molecule/certification-card/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {COLORS} from '../../variables/colors';\nimport Provider from '../../atom/provider';\nimport Tag from '../../atom/tag';\nimport ProgressBar from '../progress-bar';\nimport style from './style.css';\n\nconst CertificationCard = (props, context) => {\n const {label, goal, progress, imgUrl, onClick} = props;\n const {\n title,\n condition: {nbDone}\n } = goal;\n const {translate} = context;\n\n const isInprogress = progress < 100;\n const progressLabel = isInprogress ? translate('in_progress') : translate('completed');\n const progressTagType = isInprogress ? 'progress' : 'success';\n const progressIconProps = {\n position: 'left',\n iconName: isInprogress ? 'clock' : 'circle-check',\n iconColor: isInprogress ? '#B87A00' : '#05944F',\n backgroundColor: isInprogress ? '#FFEECC' : '#D6F5E5',\n size: {\n faSize: 10,\n wrapperSize: 10\n },\n customStyle: {padding: 0}\n };\n return (\n <div className={style.container} data-name={`certification-card-${label}`} onClick={onClick}>\n {progress > 0 ? (\n <Tag\n label={progressLabel}\n type={progressTagType}\n customStyle={{position: 'absolute', top: '12px', right: '12px'}}\n icon={progressIconProps}\n />\n ) : null}\n <div className={style.imageSection}>\n <div className={style.imageContainer}>\n <img src={imgUrl} />\n </div>\n </div>\n <div className={style.detailWrapper}>\n <div className={style.titleWrapper}>\n <Tag label={translate('certification')} size=\"S\" />\n <div className={style.title} data-name=\"certification-title\">\n {title}\n </div>\n <div className={style.moduleCount}>\n <span>{nbDone}</span>\n {` ${translate('certification_module')}`}\n </div>\n </div>\n <ProgressBar\n className={style.customProgressBar}\n style={{backgroundColor: COLORS.positive}}\n displayInfo={false}\n value={progress}\n max={100}\n />\n </div>\n </div>\n );\n};\n\nCertificationCard.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nCertificationCard.propTypes = {\n label: PropTypes.string,\n goal: PropTypes.shape({\n title: PropTypes.string,\n condition: PropTypes.shape({\n nbDone: PropTypes.number\n })\n }),\n progress: PropTypes.number,\n imgUrl: PropTypes.string,\n onClick: PropTypes.func\n};\n\nexport default CertificationCard;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,iBAAiB,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EAC5C,MAAM;IAACC,KAAD;IAAQC,IAAR;IAAcC,QAAd;IAAwBC,MAAxB;IAAgCC;EAAhC,IAA2CN,KAAjD;EACA,MAAM;IACJO,KADI;IAEJC,SAAS,EAAE;MAACC;IAAD;EAFP,IAGFN,IAHJ;EAIA,MAAM;IAACO;EAAD,IAAcT,OAApB;EAEA,MAAMU,YAAY,GAAGP,QAAQ,GAAG,GAAhC;EACA,MAAMQ,aAAa,GAAGD,YAAY,GAAGD,SAAS,CAAC,aAAD,CAAZ,GAA8BA,SAAS,CAAC,WAAD,CAAzE;EACA,MAAMG,eAAe,GAAGF,YAAY,GAAG,UAAH,GAAgB,SAApD;EACA,MAAMG,iBAAiB,GAAG;IACxBC,QAAQ,EAAE,MADc;IAExBC,QAAQ,EAAEL,YAAY,GAAG,OAAH,GAAa,cAFX;IAGxBM,SAAS,EAAEN,YAAY,GAAG,SAAH,GAAe,SAHd;IAIxBO,eAAe,EAAEP,YAAY,GAAG,SAAH,GAAe,SAJpB;IAKxBQ,IAAI,EAAE;MACJC,MAAM,EAAE,EADJ;MAEJC,WAAW,EAAE;IAFT,CALkB;IASxBC,WAAW,EAAE;MAACC,OAAO,EAAE;IAAV;EATW,CAA1B;EAWA,oBACE;IAAK,SAAS,EAAEC,cAAA,CAAMC,SAAtB;IAAiC,aAAY,sBAAqBvB,KAAM,EAAxE;IAA2E,OAAO,EAAEI;EAApF,GACGF,QAAQ,GAAG,CAAX,gBACC,6BAAC,YAAD;IACE,KA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MADG;IAEpBjC,SAAS,EAAEgC,kBAAA,CAAUE,KAAV,CAAgB;MACzBjC,MAAM,EAAE+B,kBAAA,CAAUG;IADO,CAAhB;EAFS,CAAhB,CAFsB;EAQ5BvC,QAAQ,EAAEoC,kBAAA,CAAUG,MARQ;EAS5BtC,MAAM,EAAEmC,kBAAA,CAAUC,MATU;EAU5BnC,OAAO,EAAEkC,kBAAA,CAAUI;AAVS,CAA9B;eAae7C,iB"}
@@ -22,7 +22,7 @@
22
22
  transition: all 0.5s ease-out;
23
23
  }
24
24
 
25
- .imageWrapper {
25
+ .imageSection {
26
26
  display: flex;
27
27
  justify-content: center;
28
28
  align-items: center;
@@ -30,22 +30,38 @@
30
30
  height: 160px;
31
31
  width: auto;
32
32
  transition: all 0.5s ease-out;
33
+ border-top-left-radius: 12px;
34
+ border-top-right-radius: 12px;
33
35
 
34
- img {
35
- width: 100px;
36
+ .imageContainer {
36
37
  transition: all 0.5s ease-out;
37
38
  }
38
39
  }
39
40
 
41
+ .imageContainer {
42
+ width: 202px;
43
+ height: 112px;
44
+ display: flex;
45
+ justify-content: center;
46
+ align-items: center;
47
+
48
+ img {
49
+ width: 100%;
50
+ height: 100%;
51
+ object-fit: contain;
52
+ }
53
+ }
54
+
40
55
  .container:hover {
41
56
  box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.14);
42
57
 
58
+ .imageContainer {
59
+ width: 244px;
60
+ height: 136px;
61
+ }
62
+
43
63
  .imageWrapper {
44
64
  background-color: cm_grey_75;
45
-
46
- img {
47
- width: 115px;
48
- }
49
65
  }
50
66
  }
51
67
  .detailWrapper {
@@ -75,7 +75,7 @@ const DetailSection = ({
75
75
  });
76
76
 
77
77
  const LockedTag = /*#__PURE__*/_react.default.createElement(_tag.default, {
78
- label: "Locked",
78
+ label: translate('locked'),
79
79
  size: "S",
80
80
  icon: {
81
81
  position: 'left',