@coorpacademy/components 11.32.34 → 11.32.35-alpha.11

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 (30) hide show
  1. package/es/molecule/progress-wrapper/index.d.ts +4 -5
  2. package/es/molecule/progress-wrapper/index.d.ts.map +1 -1
  3. package/es/molecule/progress-wrapper/index.js +34 -45
  4. package/es/molecule/progress-wrapper/index.js.map +1 -1
  5. package/es/molecule/progress-wrapper/style.css +3 -25
  6. package/es/template/certification-detail/index.d.ts +5 -47
  7. package/es/template/certification-detail/index.d.ts.map +1 -1
  8. package/es/template/certification-detail/index.js +22 -43
  9. package/es/template/certification-detail/index.js.map +1 -1
  10. package/es/template/certification-detail/style.css +1 -12
  11. package/es/template/skill-detail/all-courses.d.ts +1 -2
  12. package/es/template/skill-detail/all-courses.d.ts.map +1 -1
  13. package/es/template/skill-detail/all-courses.js +38 -45
  14. package/es/template/skill-detail/all-courses.js.map +1 -1
  15. package/lib/molecule/progress-wrapper/index.d.ts +4 -5
  16. package/lib/molecule/progress-wrapper/index.d.ts.map +1 -1
  17. package/lib/molecule/progress-wrapper/index.js +34 -46
  18. package/lib/molecule/progress-wrapper/index.js.map +1 -1
  19. package/lib/molecule/progress-wrapper/style.css +3 -25
  20. package/lib/template/certification-detail/index.d.ts +5 -47
  21. package/lib/template/certification-detail/index.d.ts.map +1 -1
  22. package/lib/template/certification-detail/index.js +21 -43
  23. package/lib/template/certification-detail/index.js.map +1 -1
  24. package/lib/template/certification-detail/style.css +1 -12
  25. package/lib/template/skill-detail/all-courses.d.ts +1 -2
  26. package/lib/template/skill-detail/all-courses.d.ts.map +1 -1
  27. package/lib/template/skill-detail/all-courses.js +38 -44
  28. package/lib/template/skill-detail/all-courses.js.map +1 -1
  29. package/locales/en/global.json +2 -0
  30. package/package.json +2 -2
@@ -1,10 +1,11 @@
1
- import _sortBy from "lodash/fp/sortBy";
2
- import _getOr from "lodash/fp/getOr";
1
+ import _size from "lodash/fp/size";
2
+ import _map from "lodash/fp/map";
3
+ import _filter from "lodash/fp/filter";
3
4
  import _get from "lodash/fp/get";
4
5
 
5
6
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
7
 
7
- import React, { useState, useCallback, useEffect } from 'react';
8
+ import React, { useState, useCallback, useMemo } from 'react';
8
9
  import PropTypes from 'prop-types';
9
10
  import Provider from '../../atom/provider';
10
11
  import Select, { SelectOptionPropTypes } from '../../atom/select';
@@ -15,10 +16,14 @@ import searchValueIncluded from '../../util/search-value-included';
15
16
  import InputSwitch from '../../atom/input-switch';
16
17
  import style from './all-courses.css';
17
18
 
19
+ const uncappedMap = _map.convert({
20
+ cap: false
21
+ });
22
+
18
23
  const FilterButton = (props, context) => {
19
24
  const {
20
25
  selected,
21
- filter,
26
+ label,
22
27
  onClick
23
28
  } = props;
24
29
  const {
@@ -34,7 +39,7 @@ const FilterButton = (props, context) => {
34
39
  transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out',
35
40
  width: 'fit-content'
36
41
  },
37
- label: filter,
42
+ label,
38
43
  onClick,
39
44
  'data-name': 'filter-type-course-button'
40
45
  };
@@ -47,14 +52,13 @@ FilterButton.contextTypes = {
47
52
  };
48
53
  FilterButton.propTypes = process.env.NODE_ENV !== "production" ? {
49
54
  selected: PropTypes.bool,
50
- filter: PropTypes.string,
55
+ label: PropTypes.string,
51
56
  onClick: PropTypes.func
52
57
  } : {};
53
58
 
54
59
  const AllCourses = (props, context) => {
55
60
  const {
56
- courses,
57
- totalCourses,
61
+ content,
58
62
  filters,
59
63
  sorting
60
64
  } = props;
@@ -65,47 +69,43 @@ const AllCourses = (props, context) => {
65
69
  const {
66
70
  list,
67
71
  loading
68
- } = courses;
72
+ } = content;
69
73
  const {
70
74
  translate
71
75
  } = context;
72
76
  const [showCompleted, setShowCompleted] = useState(true);
73
77
  const [searchValue, setSearchValue] = useState('');
74
- const [searchResults, setSearchResults] = useState(_sortBy(course => -_getOr(0, ['progress'], course), list));
75
78
  const sortView = sorting !== undefined ? /*#__PURE__*/React.createElement("div", {
76
79
  "data-name": "choice"
77
80
  }, /*#__PURE__*/React.createElement(Select, _extends({}, sorting, {
78
81
  "aria-label": "All courses sort"
79
82
  }))) : null;
80
- useEffect(() => {
81
- setSearchResults(_sortBy(course => -_getOr(0, ['progress'], course), list));
82
- }, [list]);
83
+ const filteredContent = useMemo(() => {
84
+ return showCompleted ? list : _filter(course => course.progress < 1, list);
85
+ }, [list, showCompleted]);
86
+ const contentResult = useMemo(() => {
87
+ return _filter(skill => searchValueIncluded(skill.title, searchValue), filteredContent);
88
+ }, [filteredContent, searchValue]);
83
89
  const handleSearch = useCallback(value => {
84
90
  setSearchValue(value);
85
- setSearchResults(list.filter(skill => searchValueIncluded(skill.title, value)));
86
- }, [list, setSearchValue, setSearchResults]);
91
+ }, [setSearchValue]);
87
92
  const handleSearchReset = useCallback(() => {
88
93
  setSearchValue('');
89
- setSearchResults(list);
90
- }, [list, setSearchValue, setSearchResults]);
94
+ }, [setSearchValue]);
91
95
  const handleShowCompletedToggle = useCallback(() => {
92
- const toggledShowCompleted = !showCompleted;
93
- setShowCompleted(toggledShowCompleted);
94
-
95
- if (toggledShowCompleted) {
96
- setSearchResults(list);
97
- handleSearchReset();
98
- } else {
99
- setSearchResults(searchResults.filter(skill => skill.progress < 100));
100
- }
101
- }, [list, searchResults, showCompleted, setShowCompleted, setSearchResults, handleSearchReset]);
96
+ setShowCompleted(prevShowCompleted => !prevShowCompleted);
97
+ }, []);
98
+ const handleFilterChange = useCallback(value => {
99
+ onChange(value);
100
+ handleSearchReset();
101
+ }, [onChange, handleSearchReset]);
102
102
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
103
103
  className: style.continueLearningWrapper
104
104
  }, /*#__PURE__*/React.createElement("span", {
105
105
  className: style.continueLearningTitle
106
- }, translate('all_courses')), /*#__PURE__*/React.createElement("span", {
106
+ }, translate('all_content')), /*#__PURE__*/React.createElement("span", {
107
107
  className: style.continueLearningNumber
108
- }, totalCourses)), /*#__PURE__*/React.createElement("div", {
108
+ }, _size(contentResult))), /*#__PURE__*/React.createElement("div", {
109
109
  className: style.searchAndSortSection
110
110
  }, /*#__PURE__*/React.createElement("div", {
111
111
  className: style.searchWrapper
@@ -126,34 +126,28 @@ const AllCourses = (props, context) => {
126
126
  "aria-label": 'Show completed courses aria label',
127
127
  value: showCompleted,
128
128
  onChange: handleShowCompletedToggle
129
- }), /*#__PURE__*/React.createElement("div", {
129
+ }), sortView ? /*#__PURE__*/React.createElement("div", {
130
130
  className: style.sortWrapper
131
- }, translate('sort_by'), sortView))), /*#__PURE__*/React.createElement("div", {
131
+ }, translate('sort_by'), sortView) : null)), /*#__PURE__*/React.createElement("div", {
132
132
  className: style.filterWrapper
133
- }, options.length > 2 && searchResults.length > 0 ? options.map((filter, index) => {
133
+ }, _size(options) > 2 && _size(contentResult) ? uncappedMap((filterProps, index) => {
134
134
  const {
135
135
  name,
136
136
  value,
137
137
  selected
138
- } = filter;
139
-
140
- function handleChange() {
141
- onChange(value);
142
- handleSearchReset();
143
- }
144
-
138
+ } = filterProps;
145
139
  return /*#__PURE__*/React.createElement("div", {
146
140
  key: index,
147
141
  className: style.filterButtonWrapper
148
142
  }, /*#__PURE__*/React.createElement(FilterButton, {
149
143
  selected: selected,
150
- filter: name,
151
- onClick: handleChange
144
+ label: name,
145
+ onClick: handleFilterChange
152
146
  }), value === 'ALL' ? /*#__PURE__*/React.createElement("div", {
153
147
  className: style.divider
154
148
  }) : null);
155
- }) : null), /*#__PURE__*/React.createElement("div", null, searchResults.length > 0 ? /*#__PURE__*/React.createElement(CardsGrid, {
156
- list: searchResults,
149
+ }, options) : null), /*#__PURE__*/React.createElement("div", null, _size(contentResult) ? /*#__PURE__*/React.createElement(CardsGrid, {
150
+ list: contentResult,
157
151
  loading: loading,
158
152
  customStyle: {
159
153
  justifyContent: 'left'
@@ -177,8 +171,7 @@ AllCourses.contextTypes = {
177
171
  translate: Provider.childContextTypes.translate
178
172
  };
179
173
  AllCourses.propTypes = process.env.NODE_ENV !== "production" ? {
180
- courses: PropTypes.shape(CardsGrid.propTypes),
181
- totalCourses: PropTypes.number,
174
+ content: PropTypes.shape(CardsGrid.propTypes),
182
175
  filters: PropTypes.shape({
183
176
  onChange: PropTypes.func,
184
177
  options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))
@@ -1 +1 @@
1
- {"version":3,"file":"all-courses.js","names":["React","useState","useCallback","useEffect","PropTypes","Provider","Select","SelectOptionPropTypes","ButtonLink","SearchForm","CardsGrid","searchValueIncluded","InputSwitch","style","FilterButton","props","context","selected","filter","onClick","skin","primarySkinColor","buttonProps","customStyle","backgroundColor","color","transition","width","label","contextTypes","childContextTypes","translate","propTypes","bool","string","func","AllCourses","courses","totalCourses","filters","sorting","options","onChange","list","loading","showCompleted","setShowCompleted","searchValue","setSearchValue","searchResults","setSearchResults","course","sortView","undefined","handleSearch","value","skill","title","handleSearchReset","handleShowCompletedToggle","toggledShowCompleted","progress","continueLearningWrapper","continueLearningTitle","continueLearningNumber","searchAndSortSection","searchWrapper","placeholder","sortSection","sortWrapper","filterWrapper","length","map","index","name","handleChange","filterButtonWrapper","divider","justifyContent","emptySearchResultContainer","emptySearchResultTitle","emptySearchResultDescription","emptySearchResultClearSearch","shape","number","arrayOf"],"sources":["../../../src/template/skill-detail/all-courses.js"],"sourcesContent":["import React, {useState, useCallback, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, getOr, sortBy} from 'lodash/fp';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport SearchForm from '../../molecule/search-form';\nimport CardsGrid from '../../organism/cards-grid';\nimport searchValueIncluded from '../../util/search-value-included';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './all-courses.css';\n\nconst FilterButton = (props, context) => {\n const {selected, filter, onClick} = props;\n const {skin} = context;\n const primarySkinColor = get('common.primary', skin);\n\n const buttonProps = {\n customStyle: {\n backgroundColor: selected ? primarySkinColor : '#E1E1E3',\n color: selected ? '#FFFFFF' : '#515161',\n transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out',\n width: 'fit-content'\n },\n label: filter,\n onClick,\n 'data-name': 'filter-type-course-button'\n };\n\n return <ButtonLink {...buttonProps} />;\n};\n\nFilterButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nFilterButton.propTypes = {\n selected: PropTypes.bool,\n filter: PropTypes.string,\n onClick: PropTypes.func\n};\n\nconst AllCourses = (props, context) => {\n const {courses, totalCourses, filters, sorting} = props;\n const {options, onChange} = filters;\n const {list, loading} = courses;\n const {translate} = context;\n const [showCompleted, setShowCompleted] = useState(true);\n const [searchValue, setSearchValue] = useState('');\n const [searchResults, setSearchResults] = useState(\n sortBy(course => -getOr(0, ['progress'], course), list)\n );\n\n const sortView =\n sorting !== undefined ? (\n <div data-name=\"choice\">\n <Select {...sorting} aria-label=\"All courses sort\" />\n </div>\n ) : null;\n\n useEffect(() => {\n setSearchResults(sortBy(course => -getOr(0, ['progress'], course), list));\n }, [list]);\n\n const handleSearch = useCallback(\n value => {\n setSearchValue(value);\n setSearchResults(list.filter(skill => searchValueIncluded(skill.title, value)));\n },\n [list, setSearchValue, setSearchResults]\n );\n\n const handleSearchReset = useCallback(() => {\n setSearchValue('');\n setSearchResults(list);\n }, [list, setSearchValue, setSearchResults]);\n\n const handleShowCompletedToggle = useCallback(() => {\n const toggledShowCompleted = !showCompleted;\n setShowCompleted(toggledShowCompleted);\n if (toggledShowCompleted) {\n setSearchResults(list);\n handleSearchReset();\n } else {\n setSearchResults(searchResults.filter(skill => skill.progress < 100));\n }\n }, [list, searchResults, showCompleted, setShowCompleted, setSearchResults, handleSearchReset]);\n\n return (\n <>\n <div className={style.continueLearningWrapper}>\n <span className={style.continueLearningTitle}>{translate('all_courses')}</span>\n <span className={style.continueLearningNumber}>{totalCourses}</span>\n </div>\n <div className={style.searchAndSortSection}>\n <div className={style.searchWrapper}>\n <SearchForm\n search={{\n placeholder: translate('search_place_holder'),\n value: searchValue,\n onChange: handleSearch\n }}\n onReset={handleSearchReset}\n />\n </div>\n <div className={style.sortSection}>\n <InputSwitch\n id={'show-completed-courses-switch'}\n type=\"switch\"\n name={translate('show_completed')}\n title={translate('show_completed')}\n aria-label={'Show completed courses aria label'}\n value={showCompleted}\n onChange={handleShowCompletedToggle}\n />\n <div className={style.sortWrapper}>\n {translate('sort_by')}\n {sortView}\n </div>\n </div>\n </div>\n <div className={style.filterWrapper}>\n {options.length > 2 && searchResults.length > 0\n ? options.map((filter, index) => {\n const {name, value, selected} = filter;\n\n function handleChange() {\n onChange(value);\n handleSearchReset();\n }\n return (\n <div key={index} className={style.filterButtonWrapper}>\n <FilterButton selected={selected} filter={name} onClick={handleChange} />\n {value === 'ALL' ? <div className={style.divider} /> : null}\n </div>\n );\n })\n : null}\n </div>\n <div>\n {searchResults.length > 0 ? (\n <CardsGrid\n list={searchResults}\n loading={loading}\n customStyle={{justifyContent: 'left'}}\n />\n ) : (\n <div className={style.emptySearchResultContainer}>\n <div className={style.emptySearchResultTitle}>\n {translate('empty_search_result_title', {searchValue})}\n </div>\n <div className={style.emptySearchResultDescription}>\n {translate('empty_search_result_description')}\n </div>\n <div className={style.emptySearchResultClearSearch} onClick={handleSearchReset}>\n {translate('empty_search_result_clear_search')}\n </div>\n </div>\n )}\n </div>\n </>\n );\n};\n\nAllCourses.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nAllCourses.propTypes = {\n courses: PropTypes.shape(CardsGrid.propTypes),\n totalCourses: PropTypes.number,\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropT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AAEtB,aADR;IAEE,OAAO,EAAEL,OAFX;IAGE,WAAW,EAAE;MAACkC,cAAc,EAAE;IAAjB;EAHf,EADD,gBAOC;IAAK,SAAS,EAAEjE,KAAK,CAACkE;EAAtB,gBACE;IAAK,SAAS,EAAElE,KAAK,CAACmE;EAAtB,GACGjD,SAAS,CAAC,2BAAD,EAA8B;IAACgB;EAAD,CAA9B,CADZ,CADF,eAIE;IAAK,SAAS,EAAElC,KAAK,CAACoE;EAAtB,GACGlD,SAAS,CAAC,iCAAD,CADZ,CAJF,eAOE;IAAK,SAAS,EAAElB,KAAK,CAACqE,4BAAtB;IAAoD,OAAO,EAAExB;EAA7D,GACG3B,SAAS,CAAC,kCAAD,CADZ,CAPF,CARJ,CAlDF,CADF;AA0ED,CAxHD;;AA0HAK,UAAU,CAACP,YAAX,GAA0B;EACxBT,IAAI,EAAEf,QAAQ,CAACyB,iBAAT,CAA2BV,IADT;EAExBW,SAAS,EAAE1B,QAAQ,CAACyB,iBAAT,CAA2BC;AAFd,CAA1B;AAKAK,UAAU,CAACJ,SAAX,2CAAuB;EACrBK,OAAO,EAAEjC,SAAS,CAAC+E,KAAV,CAAgBzE,SAAS,CAACsB,SAA1B,CADY;EAErBM,YAAY,EAAElC,SAAS,CAACgF,MAFH;EAGrB7C,OAAO,EAAEnC,SAAS,CAAC+E,KAAV,CAAgB;IACvBzC,QAAQ,EAAEtC,SAAS,CAAC+B,IADG;IAEvBM,OAAO,EAAErC,SAAS,CAACiF,OAAV,CAAkBjF,SAAS,CAAC+E,KAAV,CAAgB5E,qBAAhB,CAAlB;EAFc,CAAhB,CAHY;EAOrBiC,OAAO,EAAEpC,SAAS,CAAC+E,KAAV,CAAgB7E,MAAM,CAAC0B,SAAvB;AAPY,CAAvB;AAUA,eAAeI,UAAf"}
1
+ {"version":3,"file":"all-courses.js","names":["React","useState","useCallback","useMemo","PropTypes","Provider","Select","SelectOptionPropTypes","ButtonLink","SearchForm","CardsGrid","searchValueIncluded","InputSwitch","style","uncappedMap","convert","cap","FilterButton","props","context","selected","label","onClick","skin","primarySkinColor","buttonProps","customStyle","backgroundColor","color","transition","width","contextTypes","childContextTypes","translate","propTypes","bool","string","func","AllCourses","content","filters","sorting","options","onChange","list","loading","showCompleted","setShowCompleted","searchValue","setSearchValue","sortView","undefined","filteredContent","course","progress","contentResult","skill","title","handleSearch","value","handleSearchReset","handleShowCompletedToggle","prevShowCompleted","handleFilterChange","continueLearningWrapper","continueLearningTitle","continueLearningNumber","searchAndSortSection","searchWrapper","placeholder","sortSection","sortWrapper","filterWrapper","filterProps","index","name","filterButtonWrapper","divider","justifyContent","emptySearchResultContainer","emptySearchResultTitle","emptySearchResultDescription","emptySearchResultClearSearch","shape","arrayOf"],"sources":["../../../src/template/skill-detail/all-courses.js"],"sourcesContent":["import React, {useState, useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, filter, map, size} from 'lodash/fp';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport SearchForm from '../../molecule/search-form';\nimport CardsGrid from '../../organism/cards-grid';\nimport searchValueIncluded from '../../util/search-value-included';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './all-courses.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst FilterButton = (props, context) => {\n const {selected, label, onClick} = props;\n const {skin} = context;\n const primarySkinColor = get('common.primary', skin);\n\n const buttonProps = {\n customStyle: {\n backgroundColor: selected ? primarySkinColor : '#E1E1E3',\n color: selected ? '#FFFFFF' : '#515161',\n transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out',\n width: 'fit-content'\n },\n label,\n onClick,\n 'data-name': 'filter-type-course-button'\n };\n\n return <ButtonLink {...buttonProps} />;\n};\n\nFilterButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nFilterButton.propTypes = {\n selected: PropTypes.bool,\n label: PropTypes.string,\n onClick: PropTypes.func\n};\n\nconst AllCourses = (props, context) => {\n const {content, filters, sorting} = props;\n const {options, onChange} = filters;\n const {list, loading} = content;\n const {translate} = context;\n const [showCompleted, setShowCompleted] = useState(true);\n const [searchValue, setSearchValue] = useState('');\n\n const sortView =\n sorting !== undefined ? (\n <div data-name=\"choice\">\n <Select {...sorting} aria-label=\"All courses sort\" />\n </div>\n ) : null;\n\n const filteredContent = useMemo(() => {\n return showCompleted ? list : filter(course => course.progress < 1, list);\n }, [list, showCompleted]);\n\n const contentResult = useMemo(() => {\n return filter(skill => searchValueIncluded(skill.title, searchValue), filteredContent);\n }, [filteredContent, searchValue]);\n\n const handleSearch = useCallback(\n value => {\n setSearchValue(value);\n },\n [setSearchValue]\n );\n\n const handleSearchReset = useCallback(() => {\n setSearchValue('');\n }, [setSearchValue]);\n\n const handleShowCompletedToggle = useCallback(() => {\n setShowCompleted(prevShowCompleted => !prevShowCompleted);\n }, []);\n\n const handleFilterChange = useCallback(\n value => {\n onChange(value);\n handleSearchReset();\n },\n [onChange, handleSearchReset]\n );\n\n return (\n <>\n <div className={style.continueLearningWrapper}>\n <span className={style.continueLearningTitle}>{translate('all_content')}</span>\n <span className={style.continueLearningNumber}>{size(contentResult)}</span>\n </div>\n <div className={style.searchAndSortSection}>\n <div className={style.searchWrapper}>\n <SearchForm\n search={{\n placeholder: translate('search_place_holder'),\n value: searchValue,\n onChange: handleSearch\n }}\n onReset={handleSearchReset}\n />\n </div>\n <div className={style.sortSection}>\n <InputSwitch\n id={'show-completed-courses-switch'}\n type=\"switch\"\n name={translate('show_completed')}\n title={translate('show_completed')}\n aria-label={'Show completed courses aria label'}\n value={showCompleted}\n onChange={handleShowCompletedToggle}\n />\n {sortView ? (\n <div className={style.sortWrapper}>\n {translate('sort_by')}\n {sortView}\n </div>\n ) : null}\n </div>\n </div>\n <div className={style.filterWrapper}>\n {size(options) > 2 && size(contentResult)\n ? uncappedMap((filterProps, index) => {\n const {name, value, selected} = filterProps;\n\n return (\n <div key={index} className={style.filterButtonWrapper}>\n <FilterButton selected={selected} label={name} onClick={handleFilterChange} />\n {value === 'ALL' ? <div className={style.divider} /> : null}\n </div>\n );\n }, options)\n : null}\n </div>\n <div>\n {size(contentResult) ? (\n <CardsGrid\n list={contentResult}\n loading={loading}\n customStyle={{justifyContent: 'left'}}\n />\n ) : (\n <div className={style.emptySearchResultContainer}>\n <div className={style.emptySearchResultTitle}>\n {translate('empty_search_result_title', {searchValue})}\n </div>\n <div className={style.emptySearchResultDescription}>\n {translate('empty_search_result_description')}\n </div>\n <div className={style.emptySearchResultClearSearch} onClick={handleSearchReset}>\n {translate('empty_search_result_clear_search')}\n </div>\n </div>\n )}\n </div>\n </>\n );\n};\n\nAllCourses.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nAllCourses.propTypes = {\n content: 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};\n\nexport default AllCourses;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,WAAzB,EAAsCC,OAAtC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,UAAP,MAAuB,4BAAvB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,mBAAP,MAAgC,kCAAhC;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;;AAEA,MAAMC,WAAW,GAAG,KAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAApB;;AAEA,MAAMC,YAAY,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB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AAC+E,KAAV,CAAgB7E,MAAM,CAAC4B,SAAvB;AANY,CAAvB;AASA,eAAeI,UAAf"}
@@ -1,7 +1,7 @@
1
1
  export default ProgressWrapper;
2
- declare function ProgressWrapper({ completedCourses, completedModules, title, subtitle, progression, sections }: {
3
- completedCourses: any;
2
+ declare function ProgressWrapper({ completedModules, mandatoryModules, title, subtitle, progression, sections }: {
4
3
  completedModules: any;
4
+ mandatoryModules: any;
5
5
  title: any;
6
6
  subtitle: any;
7
7
  progression: any;
@@ -14,13 +14,12 @@ declare namespace ProgressWrapper {
14
14
  namespace propTypes {
15
15
  const title: PropTypes.Requireable<string>;
16
16
  const subtitle: PropTypes.Requireable<string>;
17
- const completedCourses: PropTypes.Requireable<number>;
18
17
  const completedModules: PropTypes.Requireable<number>;
18
+ const mandatoryModules: PropTypes.Requireable<number>;
19
19
  const progression: PropTypes.Requireable<number>;
20
20
  const sections: PropTypes.Requireable<(PropTypes.InferProps<{
21
21
  type: PropTypes.Requireable<string>;
22
- badgeUrl: PropTypes.Requireable<string>;
23
- onDownload: PropTypes.Requireable<(...args: any[]) => any>;
22
+ downloadUrl: PropTypes.Requireable<string>;
24
23
  stars: PropTypes.Requireable<number>;
25
24
  }> | null | undefined)[]>;
26
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/progress-wrapper/index.js"],"names":[],"mappings":";AAyFA;;;;;;;8BA8DC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/progress-wrapper/index.js"],"names":[],"mappings":";AAqGA;;;;;;;8BA8DC"}
@@ -5,8 +5,6 @@ exports.default = void 0;
5
5
 
6
6
  var _map2 = _interopRequireDefault(require("lodash/fp/map"));
7
7
 
8
- var _lowerCase2 = _interopRequireDefault(require("lodash/fp/lowerCase"));
9
-
10
8
  var _isEmpty2 = _interopRequireDefault(require("lodash/fp/isEmpty"));
11
9
 
12
10
  var _react = _interopRequireDefault(require("react"));
@@ -38,11 +36,11 @@ const uncappedMap = _map2.default.convert({
38
36
  });
39
37
 
40
38
  const DetailSection = ({
39
+ dataName,
41
40
  index,
42
41
  type,
43
42
  isLocked,
44
- badgeUrl,
45
- onDownload,
43
+ downloadUrl,
46
44
  stars
47
45
  }, context) => {
48
46
  const {
@@ -52,12 +50,16 @@ const DetailSection = ({
52
50
 
53
51
  const DownloadButton = /*#__PURE__*/_react.default.createElement(_buttonLink.default, {
54
52
  label: translate('download'),
55
- onClick: onDownload,
56
- "data-name": "download-button",
57
- "aria-label": "download button",
53
+ link: {
54
+ target: '_blank',
55
+ href: downloadUrl
56
+ },
57
+ "data-name": `download-${type}-button`,
58
+ "aria-label": `download ${type} button`,
58
59
  customStyle: {
59
60
  backgroundColor: '#F1F6FE',
60
- color: '#0061FF'
61
+ color: '#0061FF',
62
+ width: 'auto'
61
63
  },
62
64
  icon: {
63
65
  position: 'left',
@@ -88,7 +90,9 @@ const DetailSection = ({
88
90
  });
89
91
 
90
92
  return isTypeStars ? /*#__PURE__*/_react.default.createElement("div", {
91
- className: _style.default[`detailsSection${index}`]
93
+ className: _style.default[`detailsSection${index}`],
94
+ "data-name": type,
95
+ "aria-label": `${type} informations`
92
96
  }, /*#__PURE__*/_react.default.createElement("div", {
93
97
  className: _style.default.detailsInfo
94
98
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -103,10 +107,12 @@ const DetailSection = ({
103
107
  backgroundColor: "#FFF9D1",
104
108
  preset: "xl"
105
109
  }), /*#__PURE__*/_react.default.createElement("span", null, stars)))) : /*#__PURE__*/_react.default.createElement("div", {
106
- className: _style.default[`detailsSection${index}`]
110
+ className: _style.default[`detailsSection${index}`],
111
+ "data-name": type,
112
+ "aria-label": `${type} informations`
107
113
  }, /*#__PURE__*/_react.default.createElement("img", {
108
114
  className: _style.default.img,
109
- src: badgeUrl || 'https://s3.eu-west-1.amazonaws.com/static.coorpacademy.com/assets/images/diploma.svg'
115
+ src: type === 'badge' ? downloadUrl : 'https://s3.eu-west-1.amazonaws.com/static.coorpacademy.com/assets/images/diploma.svg'
110
116
  }), /*#__PURE__*/_react.default.createElement("div", {
111
117
  className: _style.default.detailsInfo
112
118
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -119,8 +125,8 @@ const DetailSection = ({
119
125
  };
120
126
 
121
127
  const ProgressWrapper = ({
122
- completedCourses,
123
128
  completedModules,
129
+ mandatoryModules,
124
130
  title,
125
131
  subtitle,
126
132
  progression,
@@ -129,10 +135,12 @@ const ProgressWrapper = ({
129
135
  const {
130
136
  translate
131
137
  } = context;
132
- const modulesCompletedLocal = translate('modules_completed');
138
+ const mandatoryCompletedModulesLocal = translate('modules_completed_mandatory');
133
139
  const isLocked = progression !== 100;
134
140
  return /*#__PURE__*/_react.default.createElement("div", {
135
- className: _style.default.container
141
+ className: _style.default.container,
142
+ "data-name": "prgress-wrapper",
143
+ "aria-label": "progress wrapper section"
136
144
  }, /*#__PURE__*/_react.default.createElement("div", {
137
145
  className: _style.default.titleContainer
138
146
  }, /*#__PURE__*/_react.default.createElement(_title.default, {
@@ -145,17 +153,13 @@ const ProgressWrapper = ({
145
153
  }, /*#__PURE__*/_react.default.createElement("div", {
146
154
  className: _style.default.stats
147
155
  }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", {
148
- className: _style.default.statsNumber
149
- }, completedCourses), (0, _lowerCase2.default)(translate('courses_completed'))), /*#__PURE__*/_react.default.createElement("div", {
150
- className: _style.default.divider
151
- }), /*#__PURE__*/_react.default.createElement("div", {
152
- className: _style.default.statsModule
153
- }, /*#__PURE__*/_react.default.createElement("span", {
154
- className: _style.default.statsNumber
155
- }, completedModules), modulesCompletedLocal)), /*#__PURE__*/_react.default.createElement("div", {
156
+ className: _style.default.statsNumber,
157
+ "data-name": "progress-stats"
158
+ }, `${completedModules > mandatoryModules ? mandatoryModules : completedModules} / ${mandatoryModules}`), mandatoryCompletedModulesLocal)), /*#__PURE__*/_react.default.createElement("div", {
156
159
  className: _style.default.progression
157
160
  }, /*#__PURE__*/_react.default.createElement("span", {
158
- className: _style.default.statsNumber
161
+ className: _style.default.statsNumber,
162
+ "data-name": "progress-value"
159
163
  }, progression, "%"))), /*#__PURE__*/_react.default.createElement(_progressBar.default, {
160
164
  className: _style.default.customProgressBar,
161
165
  style: {
@@ -165,37 +169,21 @@ const ProgressWrapper = ({
165
169
  value: progression,
166
170
  max: 100
167
171
  }), /*#__PURE__*/_react.default.createElement("div", {
168
- className: _style.default.statsMobile
169
- }, /*#__PURE__*/_react.default.createElement("div", {
170
- className: _style.default.statsModuleMobile
171
- }, /*#__PURE__*/_react.default.createElement("span", {
172
- className: _style.default.statsNumber
173
- }, completedModules), modulesCompletedLocal), /*#__PURE__*/_react.default.createElement("div", {
174
172
  className: _style.default.statsProgressionMobile
175
173
  }, /*#__PURE__*/_react.default.createElement("span", {
176
174
  className: _style.default.statsNumber
177
- }, progression, "%"))), (0, _isEmpty2.default)(sections) ? null : /*#__PURE__*/_react.default.createElement("div", {
175
+ }, progression, "%")), (0, _isEmpty2.default)(sections) ? null : /*#__PURE__*/_react.default.createElement("div", {
178
176
  className: _style.default.details
179
- }, uncappedMap(({
180
- type,
181
- stars,
182
- badgeUrl,
183
- onDownload
184
- }, index) => /*#__PURE__*/_react.default.createElement(DetailSection, {
185
- type,
186
- isLocked,
187
- badgeUrl,
188
- onDownload,
189
- stars,
190
- key: `${type}-${index}`,
177
+ }, uncappedMap((section, index) => /*#__PURE__*/_react.default.createElement(DetailSection, _extends({}, section, {
178
+ isLocked: isLocked,
179
+ key: `${section.type}-${index}`,
191
180
  index: index
192
- }), sections)));
181
+ })), sections)));
193
182
  };
194
183
 
195
184
  const commonDetailSectionPropTypes = process.env.NODE_ENV !== "production" ? {
196
185
  type: _propTypes.default.oneOf(['diploma', 'badge', 'stars']),
197
- badgeUrl: _propTypes.default.string,
198
- onDownload: _propTypes.default.func,
186
+ downloadUrl: _propTypes.default.string,
199
187
  stars: _propTypes.default.number
200
188
  } : {};
201
189
  DetailSection.contextTypes = {
@@ -211,8 +199,8 @@ ProgressWrapper.contextTypes = {
211
199
  ProgressWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
212
200
  title: _propTypes.default.string,
213
201
  subtitle: _propTypes.default.string,
214
- completedCourses: _propTypes.default.number,
215
202
  completedModules: _propTypes.default.number,
203
+ mandatoryModules: _propTypes.default.number,
216
204
  progression: _propTypes.default.number,
217
205
  sections: _propTypes.default.arrayOf(_propTypes.default.shape(commonDetailSectionPropTypes))
218
206
  } : {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["uncappedMap","convert","cap","DetailSection","index","type","isLocked","badgeUrl","onDownload","stars","context","translate","isTypeStars","DownloadButton","backgroundColor","color","position","faIcon","name","size","customStyle","padding","LockedTag","iconName","iconColor","preset","style","detailsInfo","detailsInfoText","detailsTitle","img","buttonContainer","ProgressWrapper","completedCourses","completedModules","title","subtitle","progression","sections","modulesCompletedLocal","container","titleContainer","statscontainer","stats","statsNumber","divider","statsModule","customProgressBar","COLORS","positive","statsMobile","statsModuleMobile","statsProgressionMobile","details","commonDetailSectionPropTypes","PropTypes","oneOf","string","func","number","contextTypes","Provider","childContextTypes","propTypes","bool","arrayOf","shape"],"sources":["../../../src/molecule/progress-wrapper/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {isEmpty, lowerCase, map} from 'lodash/fp';\nimport Title from '../../atom/title';\nimport ProgressBar from '../progress-bar';\nimport {COLORS} from '../../variables/colors';\nimport Tag from '../../atom/tag';\nimport ButtonLink from '../../atom/button-link';\nimport Icon from '../../atom/icon';\nimport Provider from '../../atom/provider';\n// eslint-disable-next-line css-modules/no-unused-class\nimport style from './style.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst DetailSection = ({index, type, isLocked, badgeUrl, onDownload, stars}, context) => {\n const {translate} = context;\n const isTypeStars = type === 'stars';\n\n const DownloadButton = (\n <ButtonLink\n label={translate('download')}\n onClick={onDownload}\n data-name=\"download-button\"\n aria-label=\"download button\"\n customStyle={{backgroundColor: '#F1F6FE', color: '#0061FF'}}\n icon={{\n position: 'left',\n faIcon: {\n name: 'download',\n color: '#0061FF',\n size: 14,\n customStyle: {padding: 0}\n }\n }}\n disabled={isLocked}\n />\n );\n\n const LockedTag = (\n <Tag\n label=\"Locked\"\n size=\"S\"\n icon={{\n position: 'left',\n iconName: 'lock',\n iconColor: '#515161',\n preset: 's',\n customStyle: {padding: 0}\n }}\n />\n );\n\n return isTypeStars ? (\n <div className={style[`detailsSection${index}`]}>\n <div className={style.detailsInfo}>\n <div className={style.detailsInfoText}>\n <span className={style.detailsTitle}>{translate('bonus_stars')}</span>\n {isLocked ? LockedTag : null}\n </div>\n <div className={style.stars}>\n <Icon iconName=\"star\" iconColor=\"#FFCE0A\" backgroundColor=\"#FFF9D1\" preset=\"xl\" />\n <span>{stars}</span>\n </div>\n </div>\n </div>\n ) : (\n <div className={style[`detailsSection${index}`]}>\n <img\n className={style.img}\n src={\n badgeUrl ||\n 'https://s3.eu-west-1.amazonaws.com/static.coorpacademy.com/assets/images/diploma.svg'\n }\n />\n <div className={style.detailsInfo}>\n <div className={style.detailsInfoText}>\n <span className={style.detailsTitle}>\n {type === 'diploma' ? translate('diploma') : translate('badge')}\n </span>\n {isLocked ? LockedTag : null}\n </div>\n\n <div className={style.buttonContainer}>{DownloadButton}</div>\n </div>\n </div>\n );\n};\n\nconst ProgressWrapper = (\n {completedCourses, completedModules, title, subtitle, progression, sections},\n context\n) => {\n const {translate} = context;\n const modulesCompletedLocal = translate('modules_completed');\n const isLocked = progression !== 100;\n\n return (\n <div className={style.container}>\n <div className={style.titleContainer}>\n <Title type=\"form-group\" titleSize=\"medium\" title={title} subtitle={subtitle} />\n </div>\n <div className={style.statscontainer}>\n <div className={style.stats}>\n <div>\n <span className={style.statsNumber}>{completedCourses}</span>\n {lowerCase(translate('courses_completed'))}\n </div>\n <div className={style.divider} />\n <div className={style.statsModule}>\n <span className={style.statsNumber}>{completedModules}</span>\n {modulesCompletedLocal}\n </div>\n </div>\n <div className={style.progression}>\n <span className={style.statsNumber}>{progression}%</span>\n </div>\n </div>\n <ProgressBar\n className={style.customProgressBar}\n style={{backgroundColor: COLORS.positive}}\n displayInfo={false}\n value={progression}\n max={100}\n />\n <div className={style.statsMobile}>\n <div className={style.statsModuleMobile}>\n <span className={style.statsNumber}>{completedModules}</span>\n {modulesCompletedLocal}\n </div>\n <div className={style.statsProgressionMobile}>\n <span className={style.statsNumber}>{progression}%</span>\n </div>\n </div>\n\n {isEmpty(sections) ? null : (\n <div className={style.details}>\n {uncappedMap(\n ({type, stars, badgeUrl, onDownload}, index) => (\n <DetailSection\n {...{type, isLocked, badgeUrl, onDownload, stars}}\n key={`${type}-${index}`}\n index={index}\n />\n ),\n sections\n )}\n </div>\n )}\n </div>\n );\n};\n\nconst commonDetailSectionPropTypes = {\n type: PropTypes.oneOf(['diploma', 'badge', 'stars']),\n badgeUrl: PropTypes.string,\n onDownload: PropTypes.func,\n stars: PropTypes.number\n};\n\nDetailSection.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nDetailSection.propTypes = {\n index: PropTypes.number,\n isLocked: PropTypes.bool,\n ...commonDetailSectionPropTypes\n};\n\nProgressWrapper.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nProgressWrapper.propTypes = {\n title: PropTypes.string,\n subtitle: PropTypes.string,\n completedCourses: PropTypes.number,\n completedModules: PropTypes.number,\n progression: PropTypes.number,\n sections: PropTypes.arrayOf(PropTypes.shape(commonDetailSectionPropTypes))\n};\n\nexport default ProgressWrapper;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA,MAAMA,WAAW,GAAG,cAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAApB;;AAEA,MAAMC,aAAa,GAAG,CAAC;EAACC,KAAD;EAAQC,IAAR;EAAcC,QAAd;EAAw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names":["uncappedMap","convert","cap","DetailSection","dataName","index","type","isLocked","downloadUrl","stars","context","translate","isTypeStars","DownloadButton","target","href","backgroundColor","color","width","position","faIcon","name","size","customStyle","padding","LockedTag","iconName","iconColor","preset","style","detailsInfo","detailsInfoText","detailsTitle","img","buttonContainer","ProgressWrapper","completedModules","mandatoryModules","title","subtitle","progression","sections","mandatoryCompletedModulesLocal","container","titleContainer","statscontainer","stats","statsNumber","customProgressBar","COLORS","positive","statsProgressionMobile","details","section","commonDetailSectionPropTypes","PropTypes","oneOf","string","number","contextTypes","Provider","childContextTypes","propTypes","bool","arrayOf","shape"],"sources":["../../../src/molecule/progress-wrapper/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {isEmpty, map} from 'lodash/fp';\nimport Title from '../../atom/title';\nimport ProgressBar from '../progress-bar';\nimport {COLORS} from '../../variables/colors';\nimport Tag from '../../atom/tag';\nimport ButtonLink from '../../atom/button-link';\nimport Icon from '../../atom/icon';\nimport Provider from '../../atom/provider';\n// eslint-disable-next-line css-modules/no-unused-class\nimport style from './style.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst DetailSection = ({dataName, index, type, isLocked, downloadUrl, stars}, context) => {\n const {translate} = context;\n const isTypeStars = type === 'stars';\n\n const DownloadButton = (\n <ButtonLink\n label={translate('download')}\n link={{\n target: '_blank',\n href: downloadUrl\n }}\n data-name={`download-${type}-button`}\n aria-label={`download ${type} button`}\n customStyle={{backgroundColor: '#F1F6FE', color: '#0061FF', width: 'auto'}}\n icon={{\n position: 'left',\n faIcon: {\n name: 'download',\n color: '#0061FF',\n size: 14,\n customStyle: {padding: 0}\n }\n }}\n disabled={isLocked}\n />\n );\n\n const LockedTag = (\n <Tag\n label=\"Locked\"\n size=\"S\"\n icon={{\n position: 'left',\n iconName: 'lock',\n iconColor: '#515161',\n preset: 's',\n customStyle: {padding: 0}\n }}\n />\n );\n\n return isTypeStars ? (\n <div\n className={style[`detailsSection${index}`]}\n data-name={type}\n aria-label={`${type} informations`}\n >\n <div className={style.detailsInfo}>\n <div className={style.detailsInfoText}>\n <span className={style.detailsTitle}>{translate('bonus_stars')}</span>\n {isLocked ? LockedTag : null}\n </div>\n <div className={style.stars}>\n <Icon iconName=\"star\" iconColor=\"#FFCE0A\" backgroundColor=\"#FFF9D1\" preset=\"xl\" />\n <span>{stars}</span>\n </div>\n </div>\n </div>\n ) : (\n <div\n className={style[`detailsSection${index}`]}\n data-name={type}\n aria-label={`${type} informations`}\n >\n <img\n className={style.img}\n src={\n type === 'badge'\n ? downloadUrl\n : 'https://s3.eu-west-1.amazonaws.com/static.coorpacademy.com/assets/images/diploma.svg'\n }\n />\n <div className={style.detailsInfo}>\n <div className={style.detailsInfoText}>\n <span className={style.detailsTitle}>\n {type === 'diploma' ? translate('diploma') : translate('badge')}\n </span>\n {isLocked ? LockedTag : null}\n </div>\n\n <div className={style.buttonContainer}>{DownloadButton}</div>\n </div>\n </div>\n );\n};\n\nconst ProgressWrapper = (\n {completedModules, mandatoryModules, title, subtitle, progression, sections},\n context\n) => {\n const {translate} = context;\n const mandatoryCompletedModulesLocal = translate('modules_completed_mandatory');\n const isLocked = progression !== 100;\n\n return (\n <div\n className={style.container}\n data-name=\"prgress-wrapper\"\n aria-label=\"progress wrapper section\"\n >\n <div className={style.titleContainer}>\n <Title type=\"form-group\" titleSize=\"medium\" title={title} subtitle={subtitle} />\n </div>\n <div className={style.statscontainer}>\n <div className={style.stats}>\n <div>\n <span className={style.statsNumber} data-name=\"progress-stats\">\n {`${\n completedModules > mandatoryModules ? mandatoryModules : completedModules\n } / ${mandatoryModules}`}\n </span>\n {mandatoryCompletedModulesLocal}\n </div>\n </div>\n <div className={style.progression}>\n <span className={style.statsNumber} data-name=\"progress-value\">\n {progression}%\n </span>\n </div>\n </div>\n <ProgressBar\n className={style.customProgressBar}\n style={{backgroundColor: COLORS.positive}}\n displayInfo={false}\n value={progression}\n max={100}\n />\n <div className={style.statsProgressionMobile}>\n <span className={style.statsNumber}>{progression}%</span>\n </div>\n\n {isEmpty(sections) ? null : (\n <div className={style.details}>\n {uncappedMap(\n (section, index) => (\n <DetailSection\n {...section}\n isLocked={isLocked}\n key={`${section.type}-${index}`}\n index={index}\n />\n ),\n sections\n )}\n </div>\n )}\n </div>\n );\n};\n\nconst commonDetailSectionPropTypes = {\n type: PropTypes.oneOf(['diploma', 'badge', 'stars']),\n downloadUrl: PropTypes.string,\n stars: PropTypes.number\n};\n\nDetailSection.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nDetailSection.propTypes = {\n index: PropTypes.number,\n isLocked: PropTypes.bool,\n ...commonDetailSectionPropTypes\n};\n\nProgressWrapper.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nProgressWrapper.propTypes = {\n title: PropTypes.string,\n subtitle: PropTypes.string,\n completedModules: PropTypes.number,\n mandatoryModules: PropTypes.number,\n progression: PropTypes.number,\n sections: PropTypes.arrayOf(PropTypes.shape(commonDetailSectionPropTypes))\n};\n\nexport default ProgressWrapper;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA,MAAMA,WAAW,GAAG,cAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAApB;;AAEA,MAAMC,aAAa,GAAG,CAAC;EAACC,QAAD;EAAWC,KAAX;EAAkBC,IAAlB;EAAwBC,QAAxB;EAAkCC,WAAlC;EAA+CC;AAA/C,CAAD,EAAwDC,OAAxD,KAAoE;EACxF,MAAM;IAACC;EAAD,IAAcD,OAApB;EACA,MAAME,WAAW,GAAGN,IAAI,KAAK,OAA7B;;EAEA,MAAMO,cAAc,gBAClB,6BAAC,mBAAD;IACE,KAAK,EAAEF,SAAS,CAAC,UAAD,CADlB;IAEE,IAAI,EAAE;MACJG,MAAM,EAAE,QADJ;MAEJC,IAAI,EAAEP;IAFF,CAFR;IAME,aAAY,YAAWF,IAAK,SAN9B;IAOE,cAA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C;AAMAvD,aAAa,CAACwD,YAAd,GAA6B;EAC3BhD,SAAS,EAAEiD,iBAAA,CAASC,iBAAT,CAA2BlD;AADX,CAA7B;AAIAR,aAAa,CAAC2D,SAAd;EACEzD,KAAK,EAAEkD,kBAAA,CAAUG,MADnB;EAEEnD,QAAQ,EAAEgD,kBAAA,CAAUQ;AAFtB,GAGKT,4BAHL;AAMAnB,eAAe,CAACwB,YAAhB,GAA+B;EAC7BhD,SAAS,EAAEiD,iBAAA,CAASC,iBAAT,CAA2BlD;AADT,CAA/B;AAIAwB,eAAe,CAAC2B,SAAhB,2CAA4B;EAC1BxB,KAAK,EAAEiB,kBAAA,CAAUE,MADS;EAE1BlB,QAAQ,EAAEgB,kBAAA,CAAUE,MAFM;EAG1BrB,gBAAgB,EAAEmB,kBAAA,CAAUG,MAHF;EAI1BrB,gBAAgB,EAAEkB,kBAAA,CAAUG,MAJF;EAK1BlB,WAAW,EAAEe,kBAAA,CAAUG,MALG;EAM1BjB,QAAQ,EAAEc,kBAAA,CAAUS,OAAV,CAAkBT,kBAAA,CAAUU,KAAV,CAAgBX,4BAAhB,CAAlB;AANgB,CAA5B;eASenB,e"}
@@ -41,14 +41,6 @@
41
41
  gap: 16px;
42
42
  }
43
43
 
44
- .divider {
45
- width: 4px;
46
- height: 4px;
47
- background-color: #d7d7da;
48
- border: solid #d7d7da 1px;
49
- border-radius: 4px;
50
- }
51
-
52
44
  .progression {
53
45
  display: flex;
54
46
  justify-content: end;
@@ -129,10 +121,6 @@
129
121
  font-weight: 700;
130
122
  }
131
123
 
132
- .statsMobile {
133
- display: none;
134
- }
135
-
136
124
  .statsModuleMobile {
137
125
  display: none;
138
126
  }
@@ -140,6 +128,9 @@
140
128
  .statsProgressionMobile {
141
129
  composes: progression;
142
130
  display: none;
131
+ color: cm_grey_400;
132
+ font-weight: 600;
133
+ padding-top: 16px;
143
134
  }
144
135
 
145
136
  @media mobile, tablet {
@@ -160,12 +151,6 @@
160
151
  justify-content: space-around;
161
152
  gap: 0;
162
153
  }
163
- .divider {
164
- display: none;
165
- }
166
- .statsModule {
167
- display: none;
168
- }
169
154
  .progression {
170
155
  display: none;
171
156
  }
@@ -175,11 +160,4 @@
175
160
  .statsModuleMobile {
176
161
  display: block;
177
162
  }
178
- .statsMobile {
179
- display: flex;
180
- justify-content: space-between;
181
- padding-top: 16px;
182
- color: cm_grey_400;
183
- font-weight: 600;
184
- }
185
163
  }
@@ -33,21 +33,12 @@ declare namespace CertificationDetail {
33
33
  const metrics: PropTypes.Requireable<PropTypes.InferProps<{
34
34
  progression: PropTypes.Requireable<number>;
35
35
  stars: PropTypes.Requireable<number>;
36
- completedCourses: PropTypes.Requireable<number>;
37
- completedModules: PropTypes.Requireable<number>;
38
- }>>;
39
- const onDownloadDiploma: PropTypes.Requireable<(...args: any[]) => any>;
40
- const badge: PropTypes.Requireable<PropTypes.InferProps<{
41
- badgeUrl: PropTypes.Requireable<string>;
42
- onDownloadBadge: PropTypes.Requireable<(...args: any[]) => any>;
43
- }>>;
44
- const ongoingCourses: PropTypes.Requireable<PropTypes.InferProps<{
45
- list: PropTypes.Requireable<(PropTypes.InferProps<any> | null | undefined)[]>;
46
- customStyle: PropTypes.Requireable<{
47
- [x: string]: string | null | undefined;
48
- }>;
49
- loading: PropTypes.Requireable<boolean>;
36
+ mandatoryModules: PropTypes.Requireable<number>;
37
+ totalModules: PropTypes.Requireable<number>;
50
38
  }>>;
39
+ const diplomaUrl: PropTypes.Requireable<string>;
40
+ const badgeUrl: PropTypes.Requireable<string>;
41
+ const ongoingCoursesAvailable: PropTypes.Requireable<boolean>;
51
42
  const certificationCourses: PropTypes.Requireable<PropTypes.InferProps<{
52
43
  list: PropTypes.Requireable<(PropTypes.InferProps<any> | null | undefined)[]>;
53
44
  customStyle: PropTypes.Requireable<{
@@ -55,8 +46,6 @@ declare namespace CertificationDetail {
55
46
  }>;
56
47
  loading: PropTypes.Requireable<boolean>;
57
48
  }>>;
58
- const totalCourses: PropTypes.Requireable<number>;
59
- const totalModules: PropTypes.Requireable<number>;
60
49
  const filters: PropTypes.Requireable<PropTypes.InferProps<{
61
50
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
62
51
  options: PropTypes.Requireable<(PropTypes.InferProps<{
@@ -66,37 +55,6 @@ declare namespace CertificationDetail {
66
55
  validOption: PropTypes.Requireable<boolean>;
67
56
  }> | null | undefined)[]>;
68
57
  }>>;
69
- const sorting: PropTypes.Requireable<PropTypes.InferProps<{
70
- title: PropTypes.Requireable<string>;
71
- name: PropTypes.Requireable<string>;
72
- className: PropTypes.Requireable<string>;
73
- borderClassName: PropTypes.Requireable<string>;
74
- disabled: PropTypes.Requireable<boolean>;
75
- multiple: PropTypes.Requireable<boolean>;
76
- description: PropTypes.Requireable<string>;
77
- required: PropTypes.Requireable<boolean>;
78
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
79
- theme: PropTypes.Requireable<string>;
80
- options: PropTypes.Requireable<(PropTypes.InferProps<{
81
- name: PropTypes.Validator<string>;
82
- value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
83
- selected: PropTypes.Requireable<boolean>;
84
- validOption: PropTypes.Requireable<boolean>;
85
- }> | null | undefined)[]>;
86
- optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
87
- label: PropTypes.Validator<string>;
88
- options: PropTypes.Requireable<(PropTypes.InferProps<{
89
- name: PropTypes.Validator<string>;
90
- value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
91
- selected: PropTypes.Requireable<boolean>;
92
- validOption: PropTypes.Requireable<boolean>;
93
- }> | null | undefined)[]>;
94
- }> | null | undefined)[]>;
95
- modified: PropTypes.Requireable<boolean>;
96
- error: PropTypes.Requireable<boolean>;
97
- 'aria-label': PropTypes.Requireable<string>;
98
- 'aria-labelledby': PropTypes.Requireable<string>;
99
- }>>;
100
58
  const onBackClick: PropTypes.Requireable<(...args: any[]) => any>;
101
59
  const onContinueLearningClick: PropTypes.Requireable<(...args: any[]) => any>;
102
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/certification-detail/index.js"],"names":[],"mappings":";AAkBA,4EA8GC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/certification-detail/index.js"],"names":[],"mappings":";AAiBA,4EAwGC"}