@coorpacademy/components 11.11.9-alpha.6 → 11.11.10-alpha.10
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 +2 -1
- package/es/atom/select/style.css +1 -1
- package/es/molecule/errors-table/index.d.ts +16 -0
- package/es/molecule/errors-table/index.d.ts.map +1 -0
- package/es/molecule/errors-table/index.js +58 -0
- package/es/molecule/errors-table/index.js.map +1 -0
- package/es/molecule/errors-table/style.css +64 -0
- package/es/molecule/errors-table/types.d.ts +24 -0
- package/es/molecule/errors-table/types.d.ts.map +1 -0
- package/es/molecule/errors-table/types.js +13 -0
- package/es/molecule/errors-table/types.js.map +1 -0
- package/es/molecule/filters/filters-wapper.css +0 -1
- package/es/molecule/questions/mobile/template/index.native.d.ts.map +1 -1
- package/es/molecule/questions/mobile/template/index.native.js +6 -4
- package/es/molecule/questions/mobile/template/index.native.js.map +1 -1
- package/es/organism/mooc-header/index.d.ts +0 -1
- package/es/organism/mooc-header/index.d.ts.map +1 -1
- package/es/organism/mooc-header/index.js +5 -10
- package/es/organism/mooc-header/index.js.map +1 -1
- package/es/organism/mooc-header/style.css +23 -23
- package/es/template/activity/progression-item.d.ts.map +1 -1
- package/es/template/activity/progression-item.js +1 -0
- package/es/template/activity/progression-item.js.map +1 -1
- package/es/variables/colors.css +1 -0
- package/lib/atom/input-switch/style.css +2 -1
- package/lib/atom/select/style.css +1 -1
- package/lib/molecule/errors-table/index.d.ts +16 -0
- package/lib/molecule/errors-table/index.d.ts.map +1 -0
- package/lib/molecule/errors-table/index.js +68 -0
- package/lib/molecule/errors-table/index.js.map +1 -0
- package/lib/molecule/errors-table/style.css +64 -0
- package/lib/molecule/errors-table/types.d.ts +24 -0
- package/lib/molecule/errors-table/types.d.ts.map +1 -0
- package/lib/molecule/errors-table/types.js +24 -0
- package/lib/molecule/errors-table/types.js.map +1 -0
- package/lib/molecule/filters/filters-wapper.css +0 -1
- package/lib/molecule/questions/mobile/template/index.native.d.ts.map +1 -1
- package/lib/molecule/questions/mobile/template/index.native.js +6 -4
- package/lib/molecule/questions/mobile/template/index.native.js.map +1 -1
- package/lib/organism/mooc-header/index.d.ts +0 -1
- package/lib/organism/mooc-header/index.d.ts.map +1 -1
- package/lib/organism/mooc-header/index.js +6 -10
- package/lib/organism/mooc-header/index.js.map +1 -1
- package/lib/organism/mooc-header/style.css +23 -23
- package/lib/template/activity/progression-item.d.ts.map +1 -1
- package/lib/template/activity/progression-item.js +1 -0
- package/lib/template/activity/progression-item.js.map +1 -1
- package/lib/variables/colors.css +1 -0
- package/package.json +2 -2
- package/locales/.mtslconfig.json +0 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
@value white from colors;
|
|
5
5
|
@value light from colors;
|
|
6
6
|
@value dark from colors;
|
|
7
|
+
@value positive from colors;
|
|
7
8
|
@value cm_grey_200 from colors;
|
|
8
9
|
@value black from colors;
|
|
9
10
|
@value cm_primary_blue from colors;
|
|
@@ -78,7 +79,7 @@
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
.checkbox:checked ~ label {
|
|
81
|
-
background:
|
|
82
|
+
background: positive;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
.default input:checked ~ label::after {
|
package/es/atom/select/style.css
CHANGED
|
@@ -410,6 +410,7 @@ div.player:hover span.selectSpan {
|
|
|
410
410
|
height: 35px;
|
|
411
411
|
border: 0;
|
|
412
412
|
width: inherit;
|
|
413
|
+
background-color: light;
|
|
413
414
|
}
|
|
414
415
|
|
|
415
416
|
.mooc select {
|
|
@@ -547,7 +548,6 @@ div.player:hover span.selectSpan {
|
|
|
547
548
|
}
|
|
548
549
|
|
|
549
550
|
.default .selectWrapper select.selectBox {
|
|
550
|
-
max-width: 280px;
|
|
551
551
|
width: inherit;
|
|
552
552
|
border-radius: 8px;
|
|
553
553
|
padding: 0;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Props } from './types';
|
|
3
|
+
declare const ErrorsTable: {
|
|
4
|
+
(props: Props): JSX.Element;
|
|
5
|
+
propTypes: {
|
|
6
|
+
columns: import("prop-types").Requireable<(import("prop-types").InferProps<{
|
|
7
|
+
title: import("prop-types").Validator<string>;
|
|
8
|
+
}> | null | undefined)[]>;
|
|
9
|
+
rows: import("prop-types").Requireable<(import("prop-types").InferProps<{
|
|
10
|
+
fields: import("prop-types").Requireable<(string | null | undefined)[]>;
|
|
11
|
+
}> | null | undefined)[]>;
|
|
12
|
+
ariaDescribedby: import("prop-types").Requireable<string>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default ErrorsTable;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/errors-table/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,KAAK,EAAY,MAAM,SAAS,CAAC;AAEzC,QAAA,MAAM,WAAW;YAAW,KAAK;;;;;;;;;;CAuDhC,CAAC;AAIF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
|
|
3
|
+
/* eslint-disable css-modules/no-unused-class */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
import style from './style.css';
|
|
7
|
+
import { propTypes } from './types';
|
|
8
|
+
|
|
9
|
+
const ErrorsTable = props => {
|
|
10
|
+
const {
|
|
11
|
+
columns = [],
|
|
12
|
+
rows = [],
|
|
13
|
+
ariaDescribedby
|
|
14
|
+
} = props;
|
|
15
|
+
const headerRow = columns.map((column, cIndex) => {
|
|
16
|
+
const {
|
|
17
|
+
title
|
|
18
|
+
} = column;
|
|
19
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
20
|
+
className: classnames(style[`header-${cIndex + 1}`]),
|
|
21
|
+
key: `${title}-${cIndex + 1}`,
|
|
22
|
+
role: "columnheader"
|
|
23
|
+
}, /*#__PURE__*/React.createElement("div", null, title));
|
|
24
|
+
});
|
|
25
|
+
const headerView = [/*#__PURE__*/React.createElement("th", {
|
|
26
|
+
className: classnames(style[`header-0`]),
|
|
27
|
+
key: "header"
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", null, " ", ''))].concat(headerRow);
|
|
29
|
+
const bodyView = rows.map((row, index) => {
|
|
30
|
+
const {
|
|
31
|
+
fields = []
|
|
32
|
+
} = row;
|
|
33
|
+
const bodyRow = fields.map((field, fIndex) => {
|
|
34
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
35
|
+
className: classnames(style.col, style[`col-${fIndex + 1}`]),
|
|
36
|
+
key: `${field}-${fIndex}`
|
|
37
|
+
}, field || '');
|
|
38
|
+
});
|
|
39
|
+
bodyRow.unshift( /*#__PURE__*/React.createElement("td", {
|
|
40
|
+
className: classnames(style.col, style[`col-0`]),
|
|
41
|
+
key: "header"
|
|
42
|
+
}, index + 1));
|
|
43
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
44
|
+
key: `line-${index}`
|
|
45
|
+
}, bodyRow);
|
|
46
|
+
});
|
|
47
|
+
return /*#__PURE__*/React.createElement("table", _extends({}, ariaDescribedby ? {
|
|
48
|
+
'aria-describedby': ariaDescribedby
|
|
49
|
+
} : {}, {
|
|
50
|
+
className: style.table
|
|
51
|
+
}), /*#__PURE__*/React.createElement("thead", {
|
|
52
|
+
className: style.thead
|
|
53
|
+
}, /*#__PURE__*/React.createElement("tr", null, headerView)), /*#__PURE__*/React.createElement("tbody", null, bodyView));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
ErrorsTable.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
57
|
+
export default ErrorsTable;
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classnames","style","propTypes","ErrorsTable","props","columns","rows","ariaDescribedby","headerRow","map","column","cIndex","title","headerView","concat","bodyView","row","index","fields","bodyRow","field","fIndex","col","unshift","table","thead"],"sources":["../../../src/molecule/errors-table/index.tsx"],"sourcesContent":["/* eslint-disable css-modules/no-unused-class */\nimport React from 'react';\nimport classnames from 'classnames';\nimport style from './style.css';\nimport {Props, propTypes} from './types';\n\nconst ErrorsTable = (props: Props) => {\n const {columns = [], rows = [], ariaDescribedby} = props;\n\n const headerRow = columns.map((column, cIndex) => {\n const {title} = column;\n return (\n <th\n className={classnames(style[`header-${cIndex + 1}`])}\n key={`${title}-${cIndex + 1}`}\n role=\"columnheader\"\n >\n <div>{title}</div>\n </th>\n );\n });\n\n const headerView = [\n <th className={classnames(style[`header-0`])} key=\"header\">\n <div> {''}</div>\n </th>\n ].concat(headerRow);\n\n const bodyView = rows.map((row, index) => {\n const {fields = []} = row;\n\n const bodyRow = fields.map((field: string, fIndex: number) => {\n return (\n <td\n className={classnames(style.col, style[`col-${fIndex + 1}`])}\n key={`${field}-${fIndex}`}\n >\n {field || ''}\n </td>\n );\n });\n bodyRow.unshift(\n <td className={classnames(style.col, style[`col-0`])} key=\"header\">\n {index + 1}\n </td>\n );\n\n return <tr key={`line-${index}`}>{bodyRow}</tr>;\n });\n\n return (\n <table\n {...(ariaDescribedby ? {'aria-describedby': ariaDescribedby} : {})}\n className={style.table}\n >\n <thead className={style.thead}>\n <tr>{headerView}</tr>\n </thead>\n <tbody>{bodyView}</tbody>\n </table>\n );\n};\n\nErrorsTable.propTypes = propTypes;\n\nexport default ErrorsTable;\n"],"mappings":";;AAAA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,SAAe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EAAYrB,KAAK,CAAE,OAAF,CAAjB,CAAzB;MAAsD,GAAG,EAAC;IAA1D,GACGgB,KAAK,GAAG,CADX,CADF;IAMA,oBAAO;MAAI,GAAG,EAAG,QAAOA,KAAM;IAAvB,GAA2BE,OAA3B,CAAP;EACD,CApBgB,CAAjB;EAsBA,oBACE,0CACOZ,eAAe,GAAG;IAAC,oBAAoBA;EAArB,CAAH,GAA2C,EADjE;IAEE,SAAS,EAAEN,KAAK,CAACuB;EAFnB,iBAIE;IAAO,SAAS,EAAEvB,KAAK,CAACwB;EAAxB,gBACE,gCAAKZ,UAAL,CADF,CAJF,eAOE,mCAAQE,QAAR,CAPF,CADF;AAWD,CAvDD;;AAyDAZ,WAAW,CAACD,SAAZ,2CAAwBA,SAAxB;AAEA,eAAeC,WAAf"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@value colors: "../../variables/colors.css";
|
|
2
|
+
@value xtraLightGrey from colors;
|
|
3
|
+
@value cm_grey_400 from colors;
|
|
4
|
+
@value cm_grey_700 from colors;
|
|
5
|
+
@value cm_negative_red_200 from colors;
|
|
6
|
+
@value light from colors;
|
|
7
|
+
|
|
8
|
+
.table {
|
|
9
|
+
border: 1px solid light;
|
|
10
|
+
font-family: 'Gilroy';
|
|
11
|
+
font-style: normal;
|
|
12
|
+
border-spacing: 0;
|
|
13
|
+
border-radius: 8px;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.table .thead {
|
|
19
|
+
background-color: xtraLightGrey;
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
line-height: 24px;
|
|
23
|
+
color: cm_grey_400;
|
|
24
|
+
height: 40px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
text-align: left;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.table .col {
|
|
30
|
+
text-align: left;
|
|
31
|
+
padding-top: 8px;
|
|
32
|
+
padding-bottom: 8px;
|
|
33
|
+
position: relative;
|
|
34
|
+
font-weight: 500;
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
line-height: 16px;
|
|
37
|
+
color: cm_grey_700;
|
|
38
|
+
border-top: 1px solid light;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.table .header-0 {
|
|
42
|
+
width: 57px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.table .header-1 {
|
|
46
|
+
width: 182px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.table .col-2 {
|
|
50
|
+
color: cm_negative_red_200;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.table .col-1 {
|
|
54
|
+
width: 182px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.table .col-0 {
|
|
58
|
+
text-align: center;
|
|
59
|
+
font-weight: 600;
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
line-height: 16px;
|
|
62
|
+
width: 57px;
|
|
63
|
+
color: cm_grey_400;
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export declare const propTypes: {
|
|
3
|
+
columns: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
4
|
+
title: PropTypes.Validator<string>;
|
|
5
|
+
}> | null | undefined)[]>;
|
|
6
|
+
rows: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
7
|
+
fields: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
8
|
+
}> | null | undefined)[]>;
|
|
9
|
+
ariaDescribedby: PropTypes.Requireable<string>;
|
|
10
|
+
};
|
|
11
|
+
export declare type Column = {
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
export declare type Row = {
|
|
15
|
+
fields: string[];
|
|
16
|
+
};
|
|
17
|
+
export declare type Columns = [Column, Column];
|
|
18
|
+
export declare type Rows = Row[];
|
|
19
|
+
export declare type Props = {
|
|
20
|
+
columns: Columns;
|
|
21
|
+
rows: Rows;
|
|
22
|
+
ariaDescribedby?: string;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/errors-table/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAUnC,eAAO,MAAM,SAAS;;;;;;;;CAIrB,CAAC;AAEF,oBAAY,MAAM,GAAG;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC;AACrC,oBAAY,GAAG,GAAG;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC;AACrC,oBAAY,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACvC,oBAAY,IAAI,GAAG,GAAG,EAAE,CAAC;AAEzB,oBAAY,KAAK,GAAG;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
const columnProptypes = PropTypes.shape({
|
|
3
|
+
title: PropTypes.string.isRequired
|
|
4
|
+
});
|
|
5
|
+
const rowProptypes = PropTypes.shape({
|
|
6
|
+
fields: PropTypes.arrayOf(PropTypes.string)
|
|
7
|
+
});
|
|
8
|
+
export const propTypes = {
|
|
9
|
+
columns: PropTypes.arrayOf(columnProptypes),
|
|
10
|
+
rows: PropTypes.arrayOf(rowProptypes),
|
|
11
|
+
ariaDescribedby: PropTypes.string
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["PropTypes","columnProptypes","shape","title","string","isRequired","rowProptypes","fields","arrayOf","propTypes","columns","rows","ariaDescribedby"],"sources":["../../../src/molecule/errors-table/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\nconst columnProptypes = PropTypes.shape({\n title: PropTypes.string.isRequired\n});\n\nconst rowProptypes = PropTypes.shape({\n fields: PropTypes.arrayOf(PropTypes.string)\n});\n\nexport const propTypes = {\n columns: PropTypes.arrayOf(columnProptypes),\n rows: PropTypes.arrayOf(rowProptypes),\n ariaDescribedby: PropTypes.string\n};\n\nexport type Column = {title: string};\nexport type Row = {fields: string[]};\nexport type Columns = [Column, Column];\nexport type Rows = Row[];\n\nexport type Props = {\n columns: Columns;\n rows: Rows;\n ariaDescribedby?: string;\n};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,MAAMC,eAAe,GAAGD,SAAS,CAACE,KAAV,CAAgB;EACtCC,KAAK,EAAEH,SAAS,CAACI,MAAV,CAAiBC;AADc,CAAhB,CAAxB;AAIA,MAAMC,YAAY,GAAGN,SAAS,CAACE,KAAV,CAAgB;EACnCK,MAAM,EAAEP,SAAS,CAACQ,OAAV,CAAkBR,SAAS,CAACI,MAA5B;AAD2B,CAAhB,CAArB;AAIA,OAAO,MAAMK,SAAS,GAAG;EACvBC,OAAO,EAAEV,SAAS,CAACQ,OAAV,CAAkBP,eAAlB,CADc;EAEvBU,IAAI,EAAEX,SAAS,CAACQ,OAAV,CAAkBF,YAAlB,CAFiB;EAGvBM,eAAe,EAAEZ,SAAS,CAACI;AAHJ,CAAlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE3E,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EAEZ,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE3E,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EAEZ,MAAM,kDAAkD,CAAC;AAoJ1D,oBAAY,KAAK,GAAG;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC,kBAAkB,GAAG,qBAAqB,CAAC,CAAC;IAC3D,aAAa,EAAE,CAAC,IAAI,EAAE,kBAAkB,GAAG,qBAAqB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,QAAA,MAAM,gBAAgB,UAAW,KAAK,uBA+CrC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -48,6 +48,7 @@ const createStyleSheet = theme => ({
|
|
|
48
48
|
const Item = props => {
|
|
49
49
|
const {
|
|
50
50
|
part,
|
|
51
|
+
index,
|
|
51
52
|
isDisabled = false,
|
|
52
53
|
focusedSelectId,
|
|
53
54
|
choices,
|
|
@@ -62,7 +63,7 @@ const Item = props => {
|
|
|
62
63
|
translations
|
|
63
64
|
} = templateContext;
|
|
64
65
|
const inputNames = choices.map(choice => choice.name);
|
|
65
|
-
const id = `question-part-${
|
|
66
|
+
const id = `question-part-${index + 1}`;
|
|
66
67
|
const isFocused = focusedSelectId === id;
|
|
67
68
|
|
|
68
69
|
if (part.type === 'answerField' && inputNames.includes(part.value)) {
|
|
@@ -125,7 +126,7 @@ const Item = props => {
|
|
|
125
126
|
fontSize: theme.fontSize.regular,
|
|
126
127
|
testID: id,
|
|
127
128
|
style: styles.htmlText
|
|
128
|
-
},
|
|
129
|
+
}, trim(part.value || ''));
|
|
129
130
|
};
|
|
130
131
|
|
|
131
132
|
const QuestionTemplate = props => {
|
|
@@ -157,14 +158,15 @@ const QuestionTemplate = props => {
|
|
|
157
158
|
return /*#__PURE__*/React.createElement(View, {
|
|
158
159
|
style: styleSheet.container,
|
|
159
160
|
testID: "question-template"
|
|
160
|
-
}, parts.map(part => /*#__PURE__*/React.createElement(View, {
|
|
161
|
-
key: `question-part-${
|
|
161
|
+
}, parts.map((part, id) => /*#__PURE__*/React.createElement(View, {
|
|
162
|
+
key: `question-part-${id}`,
|
|
162
163
|
style: {
|
|
163
164
|
flexDirection: 'row'
|
|
164
165
|
}
|
|
165
166
|
}, /*#__PURE__*/React.createElement(Item, {
|
|
166
167
|
part: part,
|
|
167
168
|
choices: choices,
|
|
169
|
+
index: id,
|
|
168
170
|
focusedSelectId: focusedSelectId,
|
|
169
171
|
isDisabled: isDisabled,
|
|
170
172
|
handleBlur: handleBlur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["React","useEffect","useState","View","trim","Html","Select","Space","FreeText","useTemplateContext","parseTemplateString","BOX_STYLE","createStyleSheet","theme","container","width","flexDirection","flexWrap","justifyContent","alignItems","spaced","paddingVertical","spacing","tiny","htmlText","color","colors","black","fontWeight","bold","lineHeight","selectInput","padding","borderRadius","radius","regular","minWidth","marginHorizontal","backgroundColor","white","selectText","gray","medium","fontSize","textAlign","Item","props","part","isDisabled","focusedSelectId","choices","onInputChange","handleBlur","handleFocus","styles","templateContext","translations","inputNames","map","choice","name","id","value","isFocused","type","includes","choiceIndex","findIndex","disabledSuffix","selectedSuffix","handleInputChange","_item","_value","selectInputStyle","selectTextStyle","items","selectAnAnswer","QuestionTemplate","template","styleSheet","setStylesheet","_stylesheet","parts"],"sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {TextStyle, View, ViewStyle} from 'react-native';\n\nimport trim from 'lodash/fp/trim';\n\nimport Html from '../../../../atom/html/index.native';\nimport Select from '../../../../atom/select-modal/index.native';\nimport Space from '../../../../atom/space/index.native';\nimport type {TemplateListOfChoices, TemplateTextChoice} from '../../types';\nimport FreeText from '../../free-text/index.native';\nimport {\n FocusedSelectId,\n HandleBlur,\n HandleFocus,\n useTemplateContext\n} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\nimport parseTemplateString from '../../../../util/parse-template-string';\nimport {BOX_STYLE} from '../../../../variables/shadow';\n\ntype StyleSheetType = {\n container: ViewStyle;\n spaced: ViewStyle;\n htmlText: TextStyle;\n selectInput: ViewStyle;\n selectText: TextStyle;\n};\n\nconst createStyleSheet = (theme: Theme): StyleSheetType => ({\n container: {\n width: '100%',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center'\n },\n spaced: {\n paddingVertical: theme.spacing.tiny\n },\n htmlText: {\n color: theme.colors.black,\n fontWeight: theme.fontWeight.bold,\n lineHeight: 25\n },\n // eslint-disable-next-line @coorpacademy/coorpacademy/no-overwriting-spread\n selectInput: {\n padding: theme.spacing.tiny,\n borderRadius: theme.radius.regular,\n minWidth: 175,\n marginHorizontal: 12,\n paddingVertical: 16,\n ...BOX_STYLE,\n backgroundColor: theme.colors.white\n },\n selectText: {\n color: theme.colors.gray.medium,\n fontWeight: theme.fontWeight.bold,\n fontSize: theme.fontSize.regular,\n textAlign: 'center'\n }\n});\n\ntype TemplatePart = {\n type: 'string' | 'answerField';\n value: string;\n};\n\ntype ItemProps = {\n part: TemplatePart;\n choices: Array<TemplateTextChoice | TemplateListOfChoices>;\n isDisabled?: boolean;\n onInputChange: (item: TemplateTextChoice | TemplateListOfChoices, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n styles: StyleSheetType;\n};\n\nconst Item = (props: ItemProps) => {\n const {\n part,\n isDisabled = false,\n focusedSelectId,\n choices,\n onInputChange,\n handleBlur,\n handleFocus,\n styles\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme, translations} = templateContext;\n\n const inputNames = choices.map(choice => choice.name);\n const id = `question-part-${part.value}`;\n const isFocused = focusedSelectId === id;\n\n if (part.type === 'answerField' && inputNames.includes(part.value)) {\n const choiceIndex = choices.findIndex(choice => choice.name === part.value);\n const choice = choices[choiceIndex];\n const {value} = choice;\n\n if (!choice || !choice.type || !choice.name) {\n return null;\n }\n\n const disabledSuffix = isDisabled ? '-disabled' : '';\n const selectedSuffix = value ? '-selected' : '';\n\n const handleInputChange =\n (_item: TemplateTextChoice | TemplateListOfChoices) => (_value: string) =>\n onInputChange(_item, _value);\n\n if (choice.type === 'text') {\n return (\n <View style={styles.spaced} testID={id}>\n <FreeText\n key={id}\n isDisabled={isDisabled}\n onChange={handleInputChange(choice)}\n value={value}\n testID={`${id}-text${selectedSuffix}${disabledSuffix}`}\n questionType=\"template\"\n />\n </View>\n );\n }\n\n const selectInputStyle: TextStyle[] = [styles.selectInput];\n const selectTextStyle: TextStyle[] = [styles.selectText];\n\n if (choice.type === 'select') {\n return (\n <View style={styles.spaced} testID={id}>\n <Select\n isDisabled={isDisabled}\n questionType=\"template\"\n values={choice.items}\n value={value}\n placeholder={translations.selectAnAnswer}\n isFocused={isFocused}\n onBlur={handleBlur}\n onFocus={handleFocus(id)}\n onChange={handleInputChange(choice)}\n textStyle={selectTextStyle}\n style={selectInputStyle}\n analyticsID={`${id}-select${selectedSuffix}${disabledSuffix}`}\n testID={`${id}-select${selectedSuffix}${disabledSuffix}`}\n />\n </View>\n );\n }\n }\n\n return (\n <Html key={id} fontSize={theme.fontSize.regular} testID={id} style={styles.htmlText}>\n {part.value === ' ' ? part.value : trim(part.value || '')}\n </Html>\n );\n};\n\nexport type Props = {\n isDisabled?: boolean;\n template: string;\n choices: Array<TemplateTextChoice | TemplateListOfChoices>;\n onInputChange: (item: TemplateTextChoice | TemplateListOfChoices, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n};\n\nconst QuestionTemplate = (props: Props) => {\n const {\n template,\n onInputChange,\n choices,\n handleBlur,\n handleFocus,\n focusedSelectId,\n isDisabled = false\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!template || !styleSheet) {\n return null;\n }\n\n const parts: TemplatePart[] = parseTemplateString(template);\n\n return (\n <View style={styleSheet.container} testID=\"question-template\">\n {parts.map(part => (\n <View key={`question-part-${part.value}`} style={{flexDirection: 'row'}}>\n <Item\n part={part}\n choices={choices}\n focusedSelectId={focusedSelectId}\n isDisabled={isDisabled}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n onInputChange={onInputChange}\n styles={styleSheet}\n />\n <Space type=\"micro\" />\n </View>\n ))}\n </View>\n );\n};\n\nexport default QuestionTemplate;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AACA,SAAmBC,IAAnB,QAAyC,cAAzC;AAEA,OAAOC,IAAP,MAAiB,gBAAjB;AAEA,OAAOC,IAAP,MAAiB,oCAAjB;AACA,OAAOC,MAAP,MAAmB,4CAAnB;AACA,OAAOC,KAAP,MAAkB,qCAAlB;AAEA,OAAOC,QAAP,MAAqB,8BAArB;AACA,SAIEC,kBAJF,QAKO,kDALP;AAOA,OAAOC,mBAAP,MAAgC,wCAAhC;AACA,SAAQC,SAAR,QAAwB,8BAAxB;;AAUA,MAAMC,gBAAgB,GAAIC,KAAD,KAAmC;EAC1DC,SAAS,EAAE;IACTC,KAAK,EAAE,MADE;IAETC,aAAa,EAAE,KAFN;IAGTC,QAAQ,EAAE,MAHD;IAITC,cAAc,EAAE,QAJP;IAKTC,UAAU,EAAE;EALH,CAD+C;EAQ1DC,MAAM,EAAE;IACNC,eAAe,EAAER,KAAK,CAACS,OAAN,CAAcC;EADzB,CARkD;EAW1DC,QAAQ,EAAE;I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;IACAmE,aAAa,CAACC,WAAD,CAAb;EACD,CAHQ,EAGN,CAACpE,KAAD,CAHM,CAAT;;EAKA,IAAI,CAACiE,QAAD,IAAa,CAACC,UAAlB,EAA8B;IAC5B,OAAO,IAAP;EACD;;EAED,MAAMG,KAAqB,GAAGxE,mBAAmB,CAACoE,QAAD,CAAjD;EAEA,oBACE,oBAAC,IAAD;IAAM,KAAK,EAAEC,UAAU,CAACjE,SAAxB;IAAmC,MAAM,EAAC;EAA1C,GACGoE,KAAK,CAACxB,GAAN,CAAUX,IAAI,iBACb,oBAAC,IAAD;IAAM,GAAG,EAAG,iBAAgBA,IAAI,CAACe,KAAM,EAAvC;IAA0C,KAAK,EAAE;MAAC9C,aAAa,EAAE;IAAhB;EAAjD,gBACE,oBAAC,IAAD;IACE,IAAI,EAAE+B,IADR;IAEE,OAAO,EAAEG,OAFX;IAGE,eAAe,EAAED,eAHnB;IAIE,UAAU,EAAED,UAJd;IAKE,UAAU,EAAEI,UALd;IAME,WAAW,EAAEC,WANf;IAOE,aAAa,EAAEF,aAPjB;IAQE,MAAM,EAAE4B;EARV,EADF,eAWE,oBAAC,KAAD;IAAO,IAAI,EAAC;EAAZ,EAXF,CADD,CADH,CADF;AAmBD,CA9CD;;AAgDA,eAAeF,gBAAf"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["React","useEffect","useState","View","trim","Html","Select","Space","FreeText","useTemplateContext","parseTemplateString","BOX_STYLE","createStyleSheet","theme","container","width","flexDirection","flexWrap","justifyContent","alignItems","spaced","paddingVertical","spacing","tiny","htmlText","color","colors","black","fontWeight","bold","lineHeight","selectInput","padding","borderRadius","radius","regular","minWidth","marginHorizontal","backgroundColor","white","selectText","gray","medium","fontSize","textAlign","Item","props","part","index","isDisabled","focusedSelectId","choices","onInputChange","handleBlur","handleFocus","styles","templateContext","translations","inputNames","map","choice","name","id","isFocused","type","includes","value","choiceIndex","findIndex","disabledSuffix","selectedSuffix","handleInputChange","_item","_value","selectInputStyle","selectTextStyle","items","selectAnAnswer","QuestionTemplate","template","styleSheet","setStylesheet","_stylesheet","parts"],"sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {TextStyle, View, ViewStyle} from 'react-native';\n\nimport trim from 'lodash/fp/trim';\n\nimport Html from '../../../../atom/html/index.native';\nimport Select from '../../../../atom/select-modal/index.native';\nimport Space from '../../../../atom/space/index.native';\nimport type {TemplateListOfChoices, TemplateTextChoice} from '../../types';\nimport FreeText from '../../free-text/index.native';\nimport {\n FocusedSelectId,\n HandleBlur,\n HandleFocus,\n useTemplateContext\n} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\nimport parseTemplateString from '../../../../util/parse-template-string';\nimport {BOX_STYLE} from '../../../../variables/shadow';\n\ntype StyleSheetType = {\n container: ViewStyle;\n spaced: ViewStyle;\n htmlText: TextStyle;\n selectInput: ViewStyle;\n selectText: TextStyle;\n};\n\nconst createStyleSheet = (theme: Theme): StyleSheetType => ({\n container: {\n width: '100%',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center'\n },\n spaced: {\n paddingVertical: theme.spacing.tiny\n },\n htmlText: {\n color: theme.colors.black,\n fontWeight: theme.fontWeight.bold,\n lineHeight: 25\n },\n // eslint-disable-next-line @coorpacademy/coorpacademy/no-overwriting-spread\n selectInput: {\n padding: theme.spacing.tiny,\n borderRadius: theme.radius.regular,\n minWidth: 175,\n marginHorizontal: 12,\n paddingVertical: 16,\n ...BOX_STYLE,\n backgroundColor: theme.colors.white\n },\n selectText: {\n color: theme.colors.gray.medium,\n fontWeight: theme.fontWeight.bold,\n fontSize: theme.fontSize.regular,\n textAlign: 'center'\n }\n});\n\ntype TemplatePart = {\n type: 'string' | 'answerField';\n value: string;\n};\n\ntype ItemProps = {\n part: TemplatePart;\n choices: Array<TemplateTextChoice | TemplateListOfChoices>;\n index: number;\n isDisabled?: boolean;\n onInputChange: (item: TemplateTextChoice | TemplateListOfChoices, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n styles: StyleSheetType;\n};\n\nconst Item = (props: ItemProps) => {\n const {\n part,\n index,\n isDisabled = false,\n focusedSelectId,\n choices,\n onInputChange,\n handleBlur,\n handleFocus,\n styles\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme, translations} = templateContext;\n\n const inputNames = choices.map(choice => choice.name);\n const id = `question-part-${index + 1}`;\n const isFocused = focusedSelectId === id;\n\n if (part.type === 'answerField' && inputNames.includes(part.value)) {\n const choiceIndex = choices.findIndex(choice => choice.name === part.value);\n const choice = choices[choiceIndex];\n const {value} = choice;\n\n if (!choice || !choice.type || !choice.name) {\n return null;\n }\n\n const disabledSuffix = isDisabled ? '-disabled' : '';\n const selectedSuffix = value ? '-selected' : '';\n\n const handleInputChange =\n (_item: TemplateTextChoice | TemplateListOfChoices) => (_value: string) =>\n onInputChange(_item, _value);\n\n if (choice.type === 'text') {\n return (\n <View style={styles.spaced} testID={id}>\n <FreeText\n key={id}\n isDisabled={isDisabled}\n onChange={handleInputChange(choice)}\n value={value}\n testID={`${id}-text${selectedSuffix}${disabledSuffix}`}\n questionType=\"template\"\n />\n </View>\n );\n }\n\n const selectInputStyle: TextStyle[] = [styles.selectInput];\n const selectTextStyle: TextStyle[] = [styles.selectText];\n\n if (choice.type === 'select') {\n return (\n <View style={styles.spaced} testID={id}>\n <Select\n isDisabled={isDisabled}\n questionType=\"template\"\n values={choice.items}\n value={value}\n placeholder={translations.selectAnAnswer}\n isFocused={isFocused}\n onBlur={handleBlur}\n onFocus={handleFocus(id)}\n onChange={handleInputChange(choice)}\n textStyle={selectTextStyle}\n style={selectInputStyle}\n analyticsID={`${id}-select${selectedSuffix}${disabledSuffix}`}\n testID={`${id}-select${selectedSuffix}${disabledSuffix}`}\n />\n </View>\n );\n }\n }\n\n return (\n <Html key={id} fontSize={theme.fontSize.regular} testID={id} style={styles.htmlText}>\n {trim(part.value || '')}\n </Html>\n );\n};\n\nexport type Props = {\n isDisabled?: boolean;\n template: string;\n choices: Array<TemplateTextChoice | TemplateListOfChoices>;\n onInputChange: (item: TemplateTextChoice | TemplateListOfChoices, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n};\n\nconst QuestionTemplate = (props: Props) => {\n const {\n template,\n onInputChange,\n choices,\n handleBlur,\n handleFocus,\n focusedSelectId,\n isDisabled = false\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!template || !styleSheet) {\n return null;\n }\n\n const parts: TemplatePart[] = parseTemplateString(template);\n\n return (\n <View style={styleSheet.container} testID=\"question-template\">\n {parts.map((part, id) => (\n <View key={`question-part-${id}`} style={{flexDirection: 'row'}}>\n <Item\n part={part}\n choices={choices}\n index={id}\n focusedSelectId={focusedSelectId}\n isDisabled={isDisabled}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n onInputChange={onInputChange}\n styles={styleSheet}\n />\n <Space type=\"micro\" />\n </View>\n ))}\n </View>\n );\n};\n\nexport default QuestionTemplate;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AACA,SAAmBC,IAAnB,QAAyC,cAAzC;AAEA,OAAOC,IAAP,MAAiB,gBAAjB;AAEA,OAAOC,IAAP,MAAiB,oCAAjB;AACA,OAAOC,MAAP,MAAmB,4CAAnB;AACA,OAAOC,KAAP,MAAkB,qCAAlB;AAEA,OAAOC,QAAP,MAAqB,8BAArB;AACA,SAIEC,kBAJF,QAKO,kDALP;AAOA,OAAOC,mBAAP,MAAgC,wCAAhC;AACA,SAAQC,SAAR,QAAwB,8BAAxB;;AAUA,MAAMC,gBAAgB,GAAIC,KAA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AkB,EAA1C;EACA,MAAM;IAACI;EAAD,IAAU2C,eAAhB;EAEA,MAAM,CAACwB,UAAD,EAAaC,aAAb,IAA8B/E,QAAQ,CAAwB,IAAxB,CAA5C;EAEAD,SAAS,CAAC,MAAM;IACd,MAAMiF,WAAW,GAAGtE,gBAAgB,CAACC,KAAD,CAApC;;IACAoE,aAAa,CAACC,WAAD,CAAb;EACD,CAHQ,EAGN,CAACrE,KAAD,CAHM,CAAT;;EAKA,IAAI,CAACkE,QAAD,IAAa,CAACC,UAAlB,EAA8B;IAC5B,OAAO,IAAP;EACD;;EAED,MAAMG,KAAqB,GAAGzE,mBAAmB,CAACqE,QAAD,CAAjD;EAEA,oBACE,oBAAC,IAAD;IAAM,KAAK,EAAEC,UAAU,CAAClE,SAAxB;IAAmC,MAAM,EAAC;EAA1C,GACGqE,KAAK,CAACxB,GAAN,CAAU,CAACZ,IAAD,EAAOe,EAAP,kBACT,oBAAC,IAAD;IAAM,GAAG,EAAG,iBAAgBA,EAAG,EAA/B;IAAkC,KAAK,EAAE;MAAC9C,aAAa,EAAE;IAAhB;EAAzC,gBACE,oBAAC,IAAD;IACE,IAAI,EAAE+B,IADR;IAEE,OAAO,EAAEI,OAFX;IAGE,KAAK,EAAEW,EAHT;IAIE,eAAe,EAAEZ,eAJnB;IAKE,UAAU,EAAED,UALd;IAME,UAAU,EAAEI,UANd;IAOE,WAAW,EAAEC,WAPf;IAQE,aAAa,EAAEF,aARjB;IASE,MAAM,EAAE4B;EATV,EADF,eAYE,oBAAC,KAAD;IAAO,IAAI,EAAC;EAAZ,EAZF,CADD,CADH,CADF;AAoBD,CA/CD;;AAiDA,eAAeF,gBAAf"}
|
|
@@ -86,7 +86,6 @@ declare class MoocHeader extends React.Component<any, any, any> {
|
|
|
86
86
|
}>>;
|
|
87
87
|
}>>;
|
|
88
88
|
'settings-aria-label': PropTypes.Requireable<string>;
|
|
89
|
-
'close-settings-aria-label': PropTypes.Requireable<string>;
|
|
90
89
|
'active-page-aria-label': PropTypes.Requireable<string>;
|
|
91
90
|
settings: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
92
91
|
title: PropTypes.Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/mooc-header/index.js"],"names":[],"mappings":";AAyBA;IACE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/mooc-header/index.js"],"names":[],"mappings":";AAyBA;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6FE;IAEF;;;;;;;;;;;;;;;;;;;;;;;MAGE;IAEF,wBAwBC;IAtBC;;;;;;MAMC;IAgDH,6BAIC;IAED,yBAGC;IAxBD,qCAQC;IAED,wBAGC;IAjBD,+BAEC;IA4BD,2BAKC;IAED,0BAKC;IAED,sBAIC;IAED,qBAIC;IAED,yBAQC;IAED,0BAQC;IAED,0BAIC;IAED,2BAIC;IAED,iCAUC;IA7GD,2EASC;IAGC,kBAAsB;IAmGxB,6BAIE;IAEF,6BAIE;IAEF,6BAmcC;CACF"}
|
|
@@ -204,7 +204,7 @@ class MoocHeader extends React.Component {
|
|
|
204
204
|
search,
|
|
205
205
|
'search-reset-aria-label': searchResetAriaLabel,
|
|
206
206
|
'settings-aria-label': settingsAriaLabel,
|
|
207
|
-
'close-settings-aria-label': closeSettingsAriaLabel,
|
|
207
|
+
// 'close-settings-aria-label': closeSettingsAriaLabel,
|
|
208
208
|
'active-page-aria-label': activePageAriaLabel
|
|
209
209
|
} = this.props;
|
|
210
210
|
const {
|
|
@@ -235,8 +235,7 @@ class MoocHeader extends React.Component {
|
|
|
235
235
|
let settingsView = null;
|
|
236
236
|
let notificationsView = null;
|
|
237
237
|
let searchFormView = null;
|
|
238
|
-
const moreAriaLabel = translate('More');
|
|
239
|
-
const closeLabel = translate('Close');
|
|
238
|
+
const moreAriaLabel = translate('More'); // const closeLabel = translate('Close');
|
|
240
239
|
|
|
241
240
|
const primaryColor = _get('common.primary', skin);
|
|
242
241
|
|
|
@@ -491,7 +490,7 @@ class MoocHeader extends React.Component {
|
|
|
491
490
|
selectProps.className = style.languageSelect;
|
|
492
491
|
settingView = /*#__PURE__*/React.createElement("div", {
|
|
493
492
|
"data-name": `setting-${settingName}`,
|
|
494
|
-
className: style.setting,
|
|
493
|
+
className: classnames(style.setting, style.selectBoxes),
|
|
495
494
|
key: settingName
|
|
496
495
|
}, /*#__PURE__*/React.createElement("span", {
|
|
497
496
|
className: style.label
|
|
@@ -541,11 +540,7 @@ class MoocHeader extends React.Component {
|
|
|
541
540
|
}, /*#__PURE__*/React.createElement("div", {
|
|
542
541
|
"data-name": "settings",
|
|
543
542
|
className: style.settingsGroup
|
|
544
|
-
}, settingsElements)
|
|
545
|
-
className: style.closeSettings,
|
|
546
|
-
onClick: this.handleSettingsToggle,
|
|
547
|
-
"aria-label": closeSettingsAriaLabel
|
|
548
|
-
}, closeLabel)));
|
|
543
|
+
}, settingsElements)));
|
|
549
544
|
}
|
|
550
545
|
|
|
551
546
|
if (search) {
|
|
@@ -707,7 +702,7 @@ MoocHeader.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
707
702
|
})
|
|
708
703
|
}),
|
|
709
704
|
'settings-aria-label': PropTypes.string,
|
|
710
|
-
'close-settings-aria-label': PropTypes.string,
|
|
705
|
+
// 'close-settings-aria-label': PropTypes.string,
|
|
711
706
|
'active-page-aria-label': PropTypes.string,
|
|
712
707
|
settings: PropTypes.arrayOf(PropTypes.shape({
|
|
713
708
|
title: PropTypes.string,
|