@coorpacademy/components 11.32.49 → 11.32.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/input-switch/style.css +9 -1
- package/es/molecule/banner/index.d.ts +5 -4
- package/es/molecule/banner/index.d.ts.map +1 -1
- package/es/molecule/banner/index.js +93 -37
- package/es/molecule/banner/index.js.map +1 -1
- package/es/molecule/banner/style.css +27 -5
- package/es/template/back-office/brand-update/index.d.ts +5 -4
- package/es/template/playlist-detail/index.d.ts +1 -0
- package/es/template/playlist-detail/index.d.ts.map +1 -1
- package/es/template/playlist-detail/index.js +6 -3
- package/es/template/playlist-detail/index.js.map +1 -1
- package/es/template/skill-detail/all-courses.css +4 -0
- package/es/template/skill-detail/all-courses.d.ts +1 -0
- package/es/template/skill-detail/all-courses.d.ts.map +1 -1
- package/es/template/skill-detail/all-courses.js +16 -3
- package/es/template/skill-detail/all-courses.js.map +1 -1
- package/es/template/skill-detail/index.d.ts +1 -0
- package/es/template/skill-detail/index.d.ts.map +1 -1
- package/es/template/skill-detail/index.js +6 -3
- package/es/template/skill-detail/index.js.map +1 -1
- package/es/variables/colors.d.ts +3 -0
- package/es/variables/colors.d.ts.map +1 -1
- package/es/variables/colors.js +3 -0
- package/es/variables/colors.js.map +1 -1
- package/lib/atom/input-switch/style.css +9 -1
- package/lib/molecule/banner/index.d.ts +5 -4
- package/lib/molecule/banner/index.d.ts.map +1 -1
- package/lib/molecule/banner/index.js +105 -38
- package/lib/molecule/banner/index.js.map +1 -1
- package/lib/molecule/banner/style.css +27 -5
- package/lib/template/back-office/brand-update/index.d.ts +5 -4
- package/lib/template/playlist-detail/index.d.ts +1 -0
- package/lib/template/playlist-detail/index.d.ts.map +1 -1
- package/lib/template/playlist-detail/index.js +6 -3
- package/lib/template/playlist-detail/index.js.map +1 -1
- package/lib/template/skill-detail/all-courses.css +4 -0
- package/lib/template/skill-detail/all-courses.d.ts +1 -0
- package/lib/template/skill-detail/all-courses.d.ts.map +1 -1
- package/lib/template/skill-detail/all-courses.js +17 -3
- package/lib/template/skill-detail/all-courses.js.map +1 -1
- package/lib/template/skill-detail/index.d.ts +1 -0
- package/lib/template/skill-detail/index.d.ts.map +1 -1
- package/lib/template/skill-detail/index.js +6 -3
- package/lib/template/skill-detail/index.js.map +1 -1
- package/lib/variables/colors.d.ts +3 -0
- package/lib/variables/colors.d.ts.map +1 -1
- package/lib/variables/colors.js +3 -0
- package/lib/variables/colors.js.map +1 -1
- package/locales/bs/global.json +7 -5
- package/locales/cs/global.json +4 -2
- package/locales/de/global.json +4 -2
- package/locales/en/global.json +2 -0
- package/locales/es/global.json +4 -2
- package/locales/et/global.json +4 -2
- package/locales/fi/global.json +4 -2
- package/locales/fr/global.json +4 -2
- package/locales/hr/global.json +7 -5
- package/locales/hu/global.json +4 -2
- package/locales/hy/global.json +7 -5
- package/locales/it/global.json +4 -2
- package/locales/ja/global.json +4 -2
- package/locales/ko/global.json +4 -2
- package/locales/nl/global.json +4 -2
- package/locales/pl/global.json +4 -2
- package/locales/pt/global.json +4 -2
- package/locales/ro/global.json +2 -0
- package/locales/ru/global.json +4 -2
- package/locales/sk/global.json +4 -2
- package/locales/sl/global.json +4 -2
- package/locales/sv/global.json +4 -2
- package/locales/tl/global.json +7 -5
- package/locales/tr/global.json +4 -2
- package/locales/uk/global.json +4 -2
- package/locales/vi/global.json +7 -5
- package/locales/zh/global.json +4 -2
- package/locales/zh_TW/global.json +7 -5
- package/package.json +2 -2
|
@@ -86,6 +86,10 @@
|
|
|
86
86
|
left: 30px;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
.coorpmanager input:checked ~ label::after {
|
|
90
|
+
left: 23px;
|
|
91
|
+
}
|
|
92
|
+
|
|
89
93
|
.checkbox:disabled ~ label {
|
|
90
94
|
background: light;
|
|
91
95
|
pointer-events: none;
|
|
@@ -108,6 +112,10 @@
|
|
|
108
112
|
min-height: 24px;
|
|
109
113
|
}
|
|
110
114
|
|
|
115
|
+
.coorpmanager .title {
|
|
116
|
+
width: fit-content;
|
|
117
|
+
}
|
|
118
|
+
|
|
111
119
|
.description {
|
|
112
120
|
font-family: 'Gilroy';
|
|
113
121
|
font-weight: 500;
|
|
@@ -126,6 +134,7 @@
|
|
|
126
134
|
}
|
|
127
135
|
|
|
128
136
|
.coorpmanager label::after, .coorpmanagerModified label::after {
|
|
137
|
+
top: 1px;
|
|
129
138
|
width: 22px;
|
|
130
139
|
height: 22px;
|
|
131
140
|
}
|
|
@@ -134,7 +143,6 @@
|
|
|
134
143
|
font-family: Gilroy;
|
|
135
144
|
font-weight: bold;
|
|
136
145
|
color: black;
|
|
137
|
-
min-width: 190px;
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
.coorpmanager .checkbox:checked ~ label {
|
|
@@ -5,10 +5,11 @@ declare namespace Banner {
|
|
|
5
5
|
const bannerKey: PropTypes.Requireable<string>;
|
|
6
6
|
const type: PropTypes.Requireable<string>;
|
|
7
7
|
const message: PropTypes.Validator<string>;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const cta: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
9
|
+
label: PropTypes.Requireable<string>;
|
|
10
|
+
type: PropTypes.Requireable<string>;
|
|
11
|
+
action: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
}> | null | undefined)[]>;
|
|
12
13
|
const temporary: PropTypes.Requireable<boolean>;
|
|
13
14
|
const onEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";AA0BA,iDAmFC"}
|
|
@@ -1,34 +1,101 @@
|
|
|
1
|
+
import _size from "lodash/fp/size";
|
|
2
|
+
import _map from "lodash/fp/map";
|
|
3
|
+
import _isEmpty from "lodash/fp/isEmpty";
|
|
4
|
+
import _noop from "lodash/fp/noop";
|
|
1
5
|
import _keys from "lodash/fp/keys";
|
|
2
|
-
import React from 'react';
|
|
6
|
+
import React, { useState, useCallback } from 'react';
|
|
3
7
|
import PropTypes from 'prop-types';
|
|
4
8
|
import classnames from 'classnames';
|
|
5
|
-
import {
|
|
9
|
+
import { COLORS } from '../../variables/colors';
|
|
6
10
|
import ButtonLink from '../../atom/button-link';
|
|
11
|
+
import Icon from '../../atom/icon';
|
|
12
|
+
import InputSwitch from '../../atom/input-switch';
|
|
7
13
|
import style from './style.css';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
|
|
15
|
+
const uncappedMap = _map.convert({
|
|
16
|
+
cap: false
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const TYPES = {
|
|
20
|
+
success: ['circle-check', COLORS.cm_positive_200],
|
|
21
|
+
error: ['triangle-exclamation', COLORS.cm_negative_200],
|
|
22
|
+
warning: ['circle-exclamation', COLORS.cm_yellow_400],
|
|
23
|
+
info: ['circle-info', COLORS.cm_grey_500]
|
|
12
24
|
};
|
|
13
25
|
const STYLES = {
|
|
14
26
|
success: style.success,
|
|
15
27
|
error: style.error,
|
|
16
|
-
warning: style.warning
|
|
28
|
+
warning: style.warning,
|
|
29
|
+
info: style.info
|
|
17
30
|
};
|
|
18
31
|
|
|
19
32
|
const Banner = props => {
|
|
20
33
|
const {
|
|
21
34
|
type,
|
|
22
35
|
message,
|
|
23
|
-
|
|
24
|
-
firstCTALabel,
|
|
25
|
-
secondCTALabel,
|
|
26
|
-
secondCTA,
|
|
36
|
+
cta = [],
|
|
27
37
|
temporary,
|
|
28
38
|
bannerKey,
|
|
29
39
|
onEnd
|
|
30
40
|
} = props;
|
|
31
|
-
const
|
|
41
|
+
const [switchValue, setSwitchValue] = useState(false);
|
|
42
|
+
const ButtonSeparator = /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: classnames(style.buttonsBar, STYLES[type])
|
|
44
|
+
});
|
|
45
|
+
const handleSwitchToggle = useCallback(action => e => {
|
|
46
|
+
const newSwitchValue = !switchValue;
|
|
47
|
+
setSwitchValue(newSwitchValue);
|
|
48
|
+
action(newSwitchValue);
|
|
49
|
+
}, [switchValue]);
|
|
50
|
+
|
|
51
|
+
const buildButton = ({
|
|
52
|
+
type: buttonType = 'button',
|
|
53
|
+
label,
|
|
54
|
+
action = _noop
|
|
55
|
+
}) => {
|
|
56
|
+
const commonStyle = classnames(style.button, STYLES[type]);
|
|
57
|
+
|
|
58
|
+
switch (buttonType) {
|
|
59
|
+
case 'switch':
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: commonStyle
|
|
62
|
+
}, /*#__PURE__*/React.createElement(InputSwitch, {
|
|
63
|
+
id: "show-microlearning-switch",
|
|
64
|
+
theme: "coorpmanager",
|
|
65
|
+
title: label,
|
|
66
|
+
value: switchValue,
|
|
67
|
+
onChange: handleSwitchToggle(action),
|
|
68
|
+
"data-name": `banner-switch-cta`,
|
|
69
|
+
"aria-label": label
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
default:
|
|
73
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: commonStyle
|
|
75
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, {
|
|
76
|
+
"data-name": "banner-button-cta",
|
|
77
|
+
"aria-label": label,
|
|
78
|
+
label: label,
|
|
79
|
+
onClick: action,
|
|
80
|
+
type: "text",
|
|
81
|
+
customStyle: {
|
|
82
|
+
padding: 0
|
|
83
|
+
}
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const buildCta = ctaOptions => {
|
|
89
|
+
return uncappedMap((options, i) => {
|
|
90
|
+
if (_isEmpty(options)) return null;
|
|
91
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: style.ctaWrapper,
|
|
93
|
+
key: i
|
|
94
|
+
}, i > 0 && i <= _size(options) ? ButtonSeparator : null, buildButton(options));
|
|
95
|
+
}, ctaOptions);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const [iconName, iconColor] = TYPES[type];
|
|
32
99
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
100
|
key: bannerKey,
|
|
34
101
|
className: classnames(style.banner, STYLES[type], temporary && style.temporaryBanner),
|
|
@@ -38,36 +105,25 @@ const Banner = props => {
|
|
|
38
105
|
"data-name": `${type}-banner-message`,
|
|
39
106
|
className: style.message
|
|
40
107
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
className: classnames(style.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
onClick: firstCTA,
|
|
49
|
-
type: "text"
|
|
50
|
-
})) : null, firstCTALabel && secondCTALabel ? /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
className: classnames(style.buttonsBar, STYLES[type])
|
|
52
|
-
}) : null, secondCTALabel ? /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
className: classnames(style.button, STYLES[type])
|
|
54
|
-
}, /*#__PURE__*/React.createElement(ButtonLink, {
|
|
55
|
-
"data-name": "second-banner-cta",
|
|
56
|
-
onClick: secondCTA,
|
|
57
|
-
"aria-label": secondCTALabel,
|
|
58
|
-
label: secondCTALabel,
|
|
59
|
-
type: "text"
|
|
60
|
-
})) : null);
|
|
108
|
+
iconName: iconName,
|
|
109
|
+
iconColor: iconColor,
|
|
110
|
+
className: classnames(style.icon, temporary && style.temporaryIcon),
|
|
111
|
+
customStyle: {
|
|
112
|
+
padding: 0
|
|
113
|
+
}
|
|
114
|
+
}), message), buildCta(cta));
|
|
61
115
|
};
|
|
62
116
|
|
|
117
|
+
const ctaPropTypes = process.env.NODE_ENV !== "production" ? PropTypes.shape({
|
|
118
|
+
label: PropTypes.string,
|
|
119
|
+
type: PropTypes.oneOf(['button', 'switch']),
|
|
120
|
+
action: PropTypes.func
|
|
121
|
+
}) : {};
|
|
63
122
|
Banner.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
64
123
|
bannerKey: PropTypes.string,
|
|
65
|
-
type: PropTypes.oneOf(_keys(
|
|
124
|
+
type: PropTypes.oneOf(_keys(TYPES)),
|
|
66
125
|
message: PropTypes.string.isRequired,
|
|
67
|
-
|
|
68
|
-
firstCTALabel: PropTypes.string,
|
|
69
|
-
secondCTALabel: PropTypes.string,
|
|
70
|
-
secondCTA: PropTypes.func,
|
|
126
|
+
cta: PropTypes.arrayOf(ctaPropTypes),
|
|
71
127
|
temporary: PropTypes.bool,
|
|
72
128
|
onEnd: PropTypes.func
|
|
73
129
|
} : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classnames","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useCallback","PropTypes","classnames","COLORS","ButtonLink","Icon","InputSwitch","style","uncappedMap","convert","cap","TYPES","success","cm_positive_200","error","cm_negative_200","warning","cm_yellow_400","info","cm_grey_500","STYLES","Banner","props","type","message","cta","temporary","bannerKey","onEnd","switchValue","setSwitchValue","ButtonSeparator","buttonsBar","handleSwitchToggle","action","e","newSwitchValue","buildButton","buttonType","label","commonStyle","button","padding","buildCta","ctaOptions","options","i","ctaWrapper","iconName","iconColor","banner","temporaryBanner","icon","temporaryIcon","ctaPropTypes","shape","string","oneOf","func","propTypes","isRequired","arrayOf","bool"],"sources":["../../../src/molecule/banner/index.js"],"sourcesContent":["import React, {useState, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {keys, noop, isEmpty, map, size} from 'lodash/fp';\nimport {COLORS} from '../../variables/colors';\nimport ButtonLink from '../../atom/button-link';\nimport Icon from '../../atom/icon';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './style.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst TYPES = {\n success: ['circle-check', COLORS.cm_positive_200],\n error: ['triangle-exclamation', COLORS.cm_negative_200],\n warning: ['circle-exclamation', COLORS.cm_yellow_400],\n info: ['circle-info', COLORS.cm_grey_500]\n};\n\nconst STYLES = {\n success: style.success,\n error: style.error,\n warning: style.warning,\n info: style.info\n};\n\nconst Banner = props => {\n const {type, message, cta = [], temporary, bannerKey, onEnd} = props;\n const [switchValue, setSwitchValue] = useState(false);\n\n const ButtonSeparator = <div className={classnames(style.buttonsBar, STYLES[type])} />;\n\n const handleSwitchToggle = useCallback(\n action => e => {\n const newSwitchValue = !switchValue;\n setSwitchValue(newSwitchValue);\n action(newSwitchValue);\n },\n [switchValue]\n );\n\n const buildButton = ({type: buttonType = 'button', label, action = noop}) => {\n const commonStyle = classnames(style.button, STYLES[type]);\n\n switch (buttonType) {\n case 'switch':\n return (\n <div className={commonStyle}>\n <InputSwitch\n id=\"show-microlearning-switch\"\n theme=\"coorpmanager\"\n title={label}\n value={switchValue}\n onChange={handleSwitchToggle(action)}\n data-name={`banner-switch-cta`}\n aria-label={label}\n />\n </div>\n );\n default:\n return (\n <div className={commonStyle}>\n <ButtonLink\n data-name=\"banner-button-cta\"\n aria-label={label}\n label={label}\n onClick={action}\n type=\"text\"\n customStyle={{padding: 0}}\n />\n </div>\n );\n }\n };\n\n const buildCta = ctaOptions => {\n return uncappedMap((options, i) => {\n if (isEmpty(options)) return null;\n\n return (\n <div className={style.ctaWrapper} key={i}>\n {i > 0 && i <= size(options) ? ButtonSeparator : null}\n {buildButton(options)}\n </div>\n );\n }, ctaOptions);\n };\n\n const [iconName, iconColor] = TYPES[type];\n\n return (\n <div\n key={bannerKey}\n className={classnames(style.banner, STYLES[type], temporary && style.temporaryBanner)}\n onAnimationEnd={onEnd}\n title={message}\n >\n <div data-name={`${type}-banner-message`} className={style.message}>\n <Icon\n iconName={iconName}\n iconColor={iconColor}\n className={classnames(style.icon, temporary && style.temporaryIcon)}\n customStyle={{padding: 0}}\n />\n {message}\n </div>\n {buildCta(cta)}\n </div>\n );\n};\n\nconst ctaPropTypes = PropTypes.shape({\n label: PropTypes.string,\n type: PropTypes.oneOf(['button', 'switch']),\n action: PropTypes.func\n});\n\nBanner.propTypes = {\n bannerKey: PropTypes.string,\n type: PropTypes.oneOf(keys(TYPES)),\n message: PropTypes.string.isRequired,\n cta: PropTypes.arrayOf(ctaPropTypes),\n temporary: PropTypes.bool,\n onEnd: PropTypes.func\n};\n\nexport default Banner;\n"],"mappings":";;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,WAAzB,QAA2C,OAA3C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAAQC,MAAR,QAAqB,wBAArB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,WAAW,GAAG,KAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAApB;;AAEA,MAAMC,KAAK,GAAG;EACZC,OAAO,EAAE,CAAC,cAAD,EAAiBT,MAAM,CAACU,eAAxB,CADG;EAEZC,KAAK,EAAE,CAAC,sBAAD,EAAyBX,MAAM,CAACY,eAAhC,CAFK;EAGZC,OAAO,EAAE,CAAC,oBAAD,EAAuBb,MAAM,CAACc,aAA9B,CAHG;EAIZC,IAAI,EAAE,CAAC,aAAD,EAAgBf,MAAM,CAACgB,WAAvB;AAJM,CAAd;AAOA,MAAMC,MAAM,GAAG;EACbR,OAAO,EAAEL,KAAK,CAACK,OADF;EAEbE,KAAK,EAAEP,KAAK,CAACO,KAFA;EAGbE,OAAO,EAAET,KAAK,CAACS,OAHF;EAIbE,IAAI,EAAEX,KAAK,CAACW;AAJC,CAAf;;AAOA,MAAMG,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;IAACC,IAAD;IAAOC,OA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,EAAEtB,SAAS,CAACwD,KAAV,CAAgB,CAAC,QAAD,EAAW,QAAX,CAAhB,CAF6B;EAGnCvB,MAAM,EAAEjC,SAAS,CAACyD;AAHiB,CAAhB,CAArB;AAMArC,MAAM,CAACsC,SAAP,2CAAmB;EACjBhC,SAAS,EAAE1B,SAAS,CAACuD,MADJ;EAEjBjC,IAAI,EAAEtB,SAAS,CAACwD,KAAV,CAAgB,MAAK9C,KAAL,CAAhB,CAFW;EAGjBa,OAAO,EAAEvB,SAAS,CAACuD,MAAV,CAAiBI,UAHT;EAIjBnC,GAAG,EAAExB,SAAS,CAAC4D,OAAV,CAAkBP,YAAlB,CAJY;EAKjB5B,SAAS,EAAEzB,SAAS,CAAC6D,IALJ;EAMjBlC,KAAK,EAAE3B,SAAS,CAACyD;AANA,CAAnB;AASA,eAAerC,MAAf"}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
@value cm_yellow_100 from colors;
|
|
13
13
|
@value cm_yellow_200 from colors;
|
|
14
14
|
@value cm_yellow_400 from colors;
|
|
15
|
+
@value cm_grey_100 from colors;
|
|
16
|
+
@value cm_grey_700 from colors;
|
|
15
17
|
|
|
16
18
|
@keyframes fadeIn {
|
|
17
19
|
0% {
|
|
@@ -33,11 +35,11 @@
|
|
|
33
35
|
.banner {
|
|
34
36
|
display: flex;
|
|
35
37
|
flex-direction: row;
|
|
36
|
-
justify-content: flex-start;
|
|
37
|
-
align-items: center;
|
|
38
|
+
justify-content: flex-start;
|
|
39
|
+
align-items: center;
|
|
38
40
|
gap: 8px;
|
|
39
|
-
padding: 16px
|
|
40
|
-
border-radius:
|
|
41
|
+
padding: 16px;
|
|
42
|
+
border-radius: 12px;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
.banner.warning {
|
|
@@ -55,6 +57,11 @@
|
|
|
55
57
|
color: cm_positive_200;
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
.banner.info {
|
|
61
|
+
background-color: cm_grey_100;
|
|
62
|
+
color: cm_grey_700;
|
|
63
|
+
}
|
|
64
|
+
|
|
58
65
|
.temporaryBanner {
|
|
59
66
|
display: inline-flex;
|
|
60
67
|
align-items: center;
|
|
@@ -74,6 +81,11 @@
|
|
|
74
81
|
transform: translateX(-50%);
|
|
75
82
|
}
|
|
76
83
|
|
|
84
|
+
.ctaWrapper {
|
|
85
|
+
display: flex;
|
|
86
|
+
gap: 4px;
|
|
87
|
+
}
|
|
88
|
+
|
|
77
89
|
.button{
|
|
78
90
|
background-color: transparent;
|
|
79
91
|
white-space: nowrap;
|
|
@@ -103,7 +115,6 @@
|
|
|
103
115
|
color: color(cm_positive_100 blackness(+12%));
|
|
104
116
|
}
|
|
105
117
|
|
|
106
|
-
|
|
107
118
|
.buttonsBar {
|
|
108
119
|
width: 2px;
|
|
109
120
|
align-self: stretch;
|
|
@@ -123,6 +134,9 @@
|
|
|
123
134
|
background-color: cm_positive_100;
|
|
124
135
|
}
|
|
125
136
|
|
|
137
|
+
.buttonsBar.info {
|
|
138
|
+
background-color: cm_grey_700;
|
|
139
|
+
}
|
|
126
140
|
|
|
127
141
|
.icon {
|
|
128
142
|
height: 22px;
|
|
@@ -147,4 +161,12 @@
|
|
|
147
161
|
display: flex;
|
|
148
162
|
align-content: center;
|
|
149
163
|
align-items: center;
|
|
164
|
+
gap: 16px;
|
|
150
165
|
}
|
|
166
|
+
|
|
167
|
+
@media mobile {
|
|
168
|
+
.banner {
|
|
169
|
+
flex-wrap: wrap;
|
|
170
|
+
gap: 24px;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -9,10 +9,11 @@ declare namespace BrandUpdate {
|
|
|
9
9
|
bannerKey: PropTypes.Requireable<string>;
|
|
10
10
|
type: PropTypes.Requireable<string>;
|
|
11
11
|
message: PropTypes.Validator<string>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
cta: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
13
|
+
label: PropTypes.Requireable<string>;
|
|
14
|
+
type: PropTypes.Requireable<string>;
|
|
15
|
+
action: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
+
}> | null | undefined)[]>;
|
|
16
17
|
temporary: PropTypes.Requireable<boolean>;
|
|
17
18
|
onEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
19
|
}> | null | undefined)[]>;
|
|
@@ -83,6 +83,7 @@ declare namespace PlaylistDetail {
|
|
|
83
83
|
}>>;
|
|
84
84
|
const onBackClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
85
85
|
const onContinueLearningClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
86
|
+
const bannerMicrolearningRuleAction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
import PropTypes from "prop-types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/playlist-detail/index.js"],"names":[],"mappings":";AAgBA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/playlist-detail/index.js"],"names":[],"mappings":";AAgBA,uEA2FC"}
|
|
@@ -25,7 +25,8 @@ const PlaylistDetail = (props, context) => {
|
|
|
25
25
|
filters,
|
|
26
26
|
sorting,
|
|
27
27
|
onBackClick,
|
|
28
|
-
onContinueLearningClick
|
|
28
|
+
onContinueLearningClick,
|
|
29
|
+
bannerMicrolearningRuleAction = null
|
|
29
30
|
} = props;
|
|
30
31
|
const descriptionRef = useRef(null);
|
|
31
32
|
const {
|
|
@@ -88,7 +89,8 @@ const PlaylistDetail = (props, context) => {
|
|
|
88
89
|
})))), /*#__PURE__*/React.createElement(AllCourses, {
|
|
89
90
|
content: playlistCourses,
|
|
90
91
|
filters: filters,
|
|
91
|
-
sorting: sorting
|
|
92
|
+
sorting: sorting,
|
|
93
|
+
bannerMicrolearningRuleAction: bannerMicrolearningRuleAction
|
|
92
94
|
})));
|
|
93
95
|
};
|
|
94
96
|
|
|
@@ -109,7 +111,8 @@ PlaylistDetail.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
109
111
|
}),
|
|
110
112
|
sorting: PropTypes.shape(Select.propTypes),
|
|
111
113
|
onBackClick: PropTypes.func,
|
|
112
|
-
onContinueLearningClick: PropTypes.func
|
|
114
|
+
onContinueLearningClick: PropTypes.func,
|
|
115
|
+
bannerMicrolearningRuleAction: PropTypes.func
|
|
113
116
|
} : {};
|
|
114
117
|
export default PlaylistDetail;
|
|
115
118
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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","bannerMicrolearningRuleAction","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 bannerMicrolearningRuleAction = null\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\n content={playlistCourses}\n filters={filters}\n sorting={sorting}\n bannerMicrolearningRuleAction={bannerMicrolearningRuleAction}\n />\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 bannerMicrolearningRuleAction: 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,sBAAR,QAAqC,iBAArC;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,cAAc,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACzC,MAAM;IACJC,KADI;IAEJC,WAFI;IAGJC,WAHI;IAIJC,WAJI;IAKJC,uBALI;IAMJC,eANI;IAOJC,OAPI;IAQJC,OARI;IASJC,WATI;IAUJC,uBAVI;IAWJC,6BAA6B,GAAG;EAX5B,IAYFZ,KAZJ;EAaA,MAAMa,cAAc,GAAG7B,MAAM,CAAC,IAAD,CAA7B;EACA,MAAM;IAAC8B;EAAD,IAAcb,OAApB;EAEA,MAAM,CAACc,sBAAD,EAAyBC,yBAAzB,IAAsDlC,QAAQ,CAAC,KAAD,CAApE;EACA,MAAM,CAACmC,QAAD,EAAWC,WAAX,IAA0BpC,QAAQ,CAAC,KAAD,CAAxC;EAEA,MAAMqC,cAAc,GAAGtC,WAAW,CAAC,MAAMqC,WAAW,CAAC,CAACD,QAAF,C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C2C,SAA1B,CANQ;EAOzB7B,OAAO,EAAEvB,SAAS,CAACyD,KAAV,CAAgB;IACvBC,QAAQ,EAAE1D,SAAS,CAAC2D,IADG;IAEvBC,OAAO,EAAE5D,SAAS,CAAC6D,OAAV,CAAkB7D,SAAS,CAACyD,KAAV,CAAgBnD,qBAAhB,CAAlB;EAFc,CAAhB,CAPgB;EAWzBkB,OAAO,EAAExB,SAAS,CAACyD,KAAV,CAAgBpD,MAAM,CAAC+C,SAAvB,CAXgB;EAYzB3B,WAAW,EAAEzB,SAAS,CAAC2D,IAZE;EAazBjC,uBAAuB,EAAE1B,SAAS,CAAC2D,IAbV;EAczBhC,6BAA6B,EAAE3B,SAAS,CAAC2D;AAdhB,CAA3B;AAiBA,eAAe7C,cAAf"}
|
|
@@ -74,6 +74,7 @@ declare namespace AllCourses {
|
|
|
74
74
|
'aria-label': PropTypes.Requireable<string>;
|
|
75
75
|
'aria-labelledby': PropTypes.Requireable<string>;
|
|
76
76
|
}>>;
|
|
77
|
+
const bannerMicrolearningRuleAction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
import PropTypes from "prop-types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-courses.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/all-courses.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"all-courses.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/all-courses.js"],"names":[],"mappings":";AAiDA,mEA0IC"}
|
|
@@ -15,6 +15,7 @@ import SearchForm from '../../molecule/search-form';
|
|
|
15
15
|
import CardsGrid from '../../organism/cards-grid';
|
|
16
16
|
import searchValueIncluded from '../../util/search-value-included';
|
|
17
17
|
import InputSwitch from '../../atom/input-switch';
|
|
18
|
+
import Banner from '../../molecule/banner';
|
|
18
19
|
import style from './all-courses.css';
|
|
19
20
|
|
|
20
21
|
const uncappedMap = _map.convert({
|
|
@@ -67,7 +68,8 @@ const AllCourses = (props, context) => {
|
|
|
67
68
|
content,
|
|
68
69
|
filters,
|
|
69
70
|
sorting,
|
|
70
|
-
totalContents
|
|
71
|
+
totalContents,
|
|
72
|
+
bannerMicrolearningRuleAction
|
|
71
73
|
} = props;
|
|
72
74
|
const {
|
|
73
75
|
options,
|
|
@@ -132,7 +134,17 @@ const AllCourses = (props, context) => {
|
|
|
132
134
|
onChange: handleShowCompletedToggle
|
|
133
135
|
}), sortView ? /*#__PURE__*/React.createElement("div", {
|
|
134
136
|
className: style.sortWrapper
|
|
135
|
-
}, translate('sort_by'), sortView) : null)), /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
}, translate('sort_by'), sortView) : null)), bannerMicrolearningRuleAction ? /*#__PURE__*/React.createElement("div", {
|
|
138
|
+
className: style.bannerWrapper
|
|
139
|
+
}, /*#__PURE__*/React.createElement(Banner, {
|
|
140
|
+
type: "info",
|
|
141
|
+
message: translate('banner_microlearning_rule_message'),
|
|
142
|
+
cta: [{
|
|
143
|
+
type: 'switch',
|
|
144
|
+
label: translate('banner_microlearning_rule_label'),
|
|
145
|
+
action: bannerMicrolearningRuleAction
|
|
146
|
+
}]
|
|
147
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
136
148
|
className: style.filterWrapper
|
|
137
149
|
}, _size(options) > 2 ? uncappedMap((filterProps, index) => {
|
|
138
150
|
const {
|
|
@@ -188,7 +200,8 @@ AllCourses.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
188
200
|
onChange: PropTypes.func,
|
|
189
201
|
options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))
|
|
190
202
|
}),
|
|
191
|
-
sorting: PropTypes.shape(Select.propTypes)
|
|
203
|
+
sorting: PropTypes.shape(Select.propTypes),
|
|
204
|
+
bannerMicrolearningRuleAction: PropTypes.func
|
|
192
205
|
} : {};
|
|
193
206
|
export default AllCourses;
|
|
194
207
|
//# sourceMappingURL=all-courses.js.map
|
|
@@ -1 +1 @@
|
|
|
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","dataName","ariaLabel","selected","label","onClick","skin","primarySkinColor","buttonProps","customStyle","backgroundColor","color","transition","width","contextTypes","childContextTypes","translate","propTypes","string","bool","func","AllCourses","content","filters","sorting","totalContents","options","onChange","list","loading","showCompleted","setShowCompleted","searchValue","setSearchValue","sortView","undefined","filteredContent","course","progress","contentResult","skill","title","handleSearch","value","handleSearchReset","handleShowCompletedToggle","prevShowCompleted","continueLearningWrapper","continueLearningTitle","continueLearningNumber","searchAndSortSection","searchWrapper","placeholder","sortSection","sortWrapper","filterWrapper","filterProps","index","name","handleFilterChange","filterButtonWrapper","divider","justifyContent","emptySearchResultContainer","emptySearchResultTitle","emptySearchResultDescription","emptySearchResultClearSearch","shape","number","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, isNil} 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 {dataName, ariaLabel, 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': dataName,\n 'aria-label': ariaLabel\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 dataName: PropTypes.string,\n ariaLabel: PropTypes.string,\n selected: PropTypes.bool,\n label: PropTypes.string,\n onClick: PropTypes.func\n};\n\nconst AllCourses = (props, context) => {\n const {content, filters, sorting, totalContents} = 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 return (\n <>\n <div className={style.continueLearningWrapper}>\n <span className={style.continueLearningTitle}>{translate('all_content')}</span>\n <span className={style.continueLearningNumber}>\n {isNil(totalContents) ? size(contentResult) : totalContents}\n </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 dataTestId=\"all-courses-search-input\"\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\n ? uncappedMap((filterProps, index) => {\n const {name, value, selected} = filterProps;\n\n function handleFilterChange() {\n onChange(value);\n }\n\n return (\n <div key={index} className={style.filterButtonWrapper}>\n <FilterButton\n dataName={`filter-button-${value}`}\n ariaLabel={`Filter by ${name}`}\n selected={selected}\n label={name}\n onClick={handleFilterChange}\n />\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 totalContents: PropTypes.number,\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,MA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AI,EAAEpB,QAAQ,CAAC6B,iBAAT,CAA2BT,IADT;EAExBU,SAAS,EAAE9B,QAAQ,CAAC6B,iBAAT,CAA2BC;AAFd,CAA1B;AAKAK,UAAU,CAACJ,SAAX,2CAAuB;EACrBK,OAAO,EAAErC,SAAS,CAACkF,KAAV,CAAgB5E,SAAS,CAAC0B,SAA1B,CADY;EAErBQ,aAAa,EAAExC,SAAS,CAACmF,MAFJ;EAGrB7C,OAAO,EAAEtC,SAAS,CAACkF,KAAV,CAAgB;IACvBxC,QAAQ,EAAE1C,SAAS,CAACmC,IADG;IAEvBM,OAAO,EAAEzC,SAAS,CAACoF,OAAV,CAAkBpF,SAAS,CAACkF,KAAV,CAAgB/E,qBAAhB,CAAlB;EAFc,CAAhB,CAHY;EAOrBoC,OAAO,EAAEvC,SAAS,CAACkF,KAAV,CAAgBhF,MAAM,CAAC8B,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","Banner","style","uncappedMap","convert","cap","FilterButton","props","context","dataName","ariaLabel","selected","label","onClick","skin","primarySkinColor","buttonProps","customStyle","backgroundColor","color","transition","width","contextTypes","childContextTypes","translate","propTypes","string","bool","func","AllCourses","content","filters","sorting","totalContents","bannerMicrolearningRuleAction","options","onChange","list","loading","showCompleted","setShowCompleted","searchValue","setSearchValue","sortView","undefined","filteredContent","course","progress","contentResult","skill","title","handleSearch","value","handleSearchReset","handleShowCompletedToggle","prevShowCompleted","continueLearningWrapper","continueLearningTitle","continueLearningNumber","searchAndSortSection","searchWrapper","placeholder","sortSection","sortWrapper","bannerWrapper","type","action","filterWrapper","filterProps","index","name","handleFilterChange","filterButtonWrapper","divider","justifyContent","emptySearchResultContainer","emptySearchResultTitle","emptySearchResultDescription","emptySearchResultClearSearch","shape","number","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, isNil} 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 Banner from '../../molecule/banner';\nimport style from './all-courses.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst FilterButton = (props, context) => {\n const {dataName, ariaLabel, 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': dataName,\n 'aria-label': ariaLabel\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 dataName: PropTypes.string,\n ariaLabel: PropTypes.string,\n selected: PropTypes.bool,\n label: PropTypes.string,\n onClick: PropTypes.func\n};\n\nconst AllCourses = (props, context) => {\n const {content, filters, sorting, totalContents, bannerMicrolearningRuleAction} = 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 return (\n <>\n <div className={style.continueLearningWrapper}>\n <span className={style.continueLearningTitle}>{translate('all_content')}</span>\n <span className={style.continueLearningNumber}>\n {isNil(totalContents) ? size(contentResult) : totalContents}\n </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 dataTestId=\"all-courses-search-input\"\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 {bannerMicrolearningRuleAction ? (\n <div className={style.bannerWrapper}>\n <Banner\n type=\"info\"\n message={translate('banner_microlearning_rule_message')}\n cta={[\n {\n type: 'switch',\n label: translate('banner_microlearning_rule_label'),\n action: bannerMicrolearningRuleAction\n }\n ]}\n />\n </div>\n ) : null}\n <div className={style.filterWrapper}>\n {size(options) > 2\n ? uncappedMap((filterProps, index) => {\n const {name, value, selected} = filterProps;\n\n function handleFilterChange() {\n onChange(value);\n }\n\n return (\n <div key={index} className={style.filterButtonWrapper}>\n <FilterButton\n dataName={`filter-button-${value}`}\n ariaLabel={`Filter by ${name}`}\n selected={selected}\n label={name}\n onClick={handleFilterChange}\n />\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 totalContents: PropTypes.number,\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n bannerMicrolearningRuleAction: PropTypes.func\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,MAAP,MAAmB,uBAAnB;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;EACvC,MAAM;IAACC,QAAD;IAAWC,SA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EACxBR,IAAI,EAAErB,QAAQ,CAAC8B,iBAAT,CAA2BT,IADT;EAExBU,SAAS,EAAE/B,QAAQ,CAAC8B,iBAAT,CAA2BC;AAFd,CAA1B;AAKAK,UAAU,CAACJ,SAAX,2CAAuB;EACrBK,OAAO,EAAEtC,SAAS,CAACuF,KAAV,CAAgBjF,SAAS,CAAC2B,SAA1B,CADY;EAErBQ,aAAa,EAAEzC,SAAS,CAACwF,MAFJ;EAGrBjD,OAAO,EAAEvC,SAAS,CAACuF,KAAV,CAAgB;IACvB3C,QAAQ,EAAE5C,SAAS,CAACoC,IADG;IAEvBO,OAAO,EAAE3C,SAAS,CAACyF,OAAV,CAAkBzF,SAAS,CAACuF,KAAV,CAAgBpF,qBAAhB,CAAlB;EAFc,CAAhB,CAHY;EAOrBqC,OAAO,EAAExC,SAAS,CAACuF,KAAV,CAAgBrF,MAAM,CAAC+B,SAAvB,CAPY;EAQrBS,6BAA6B,EAAE1C,SAAS,CAACoC;AARpB,CAAvB;AAWA,eAAeC,UAAf"}
|
|
@@ -123,6 +123,7 @@ declare namespace SkillDetail {
|
|
|
123
123
|
export const onBackClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
124
124
|
export const onReviewClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
125
125
|
export const onContinueLearningClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
126
|
+
export const bannerMicrolearningRuleAction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
126
127
|
}
|
|
127
128
|
export { propTypes_1 as propTypes };
|
|
128
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/index.js"],"names":[],"mappings":"AAeO,8EA+BN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/index.js"],"names":[],"mappings":"AAeO,8EA+BN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYD,oEAqJC"}
|