@ndla/ui 24.2.1 → 25.0.1

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 (117) hide show
  1. package/es/CompetenceGoals/CompetenceGoalsDialog.js +15 -24
  2. package/es/CompetenceGoals/index.js +1 -4
  3. package/es/Filter/FilterButtons.js +10 -11
  4. package/es/Filter/FilterList.js +82 -152
  5. package/es/Filter/FilterListPhone.js +180 -272
  6. package/es/Filter/ToggleItem.js +6 -25
  7. package/es/Frontpage/FrontpageAllSubjects.js +8 -9
  8. package/es/Frontpage/FrontpageSearch.js +3 -4
  9. package/es/LearningPaths/LearningPathMenuModalWrapper.js +1 -2
  10. package/es/Masthead/Masthead.js +65 -41
  11. package/es/Masthead/MastheadSearchModal.js +4 -5
  12. package/es/Masthead/SkipToMainContent.js +24 -0
  13. package/es/Masthead/index.js +2 -1
  14. package/es/SearchTypeResult/PopupFilter.js +8 -9
  15. package/es/SearchTypeResult/SearchFilterContent.js +3 -4
  16. package/es/SectionHeading/SectionHeading.js +24 -17
  17. package/es/Subject/index.js +0 -1
  18. package/es/User/UserInfo.js +11 -3
  19. package/es/all.css +1 -1
  20. package/es/index-javascript.js +1 -4
  21. package/es/index.js +5 -2
  22. package/es/locale/messages-en.js +1 -0
  23. package/es/locale/messages-nb.js +1 -0
  24. package/es/locale/messages-nn.js +1 -0
  25. package/es/locale/messages-se.js +1 -0
  26. package/es/locale/messages-sma.js +1 -0
  27. package/lib/CompetenceGoals/CompetenceGoalsDialog.d.ts +19 -0
  28. package/lib/CompetenceGoals/CompetenceGoalsDialog.js +13 -25
  29. package/lib/CompetenceGoals/index.d.ts +1 -0
  30. package/lib/CompetenceGoals/index.js +1 -33
  31. package/lib/Filter/FilterButtons.js +9 -9
  32. package/lib/Filter/FilterList.d.ts +25 -0
  33. package/lib/Filter/FilterList.js +85 -155
  34. package/lib/Filter/FilterListPhone.d.ts +32 -0
  35. package/lib/Filter/FilterListPhone.js +176 -270
  36. package/lib/Filter/ToggleItem.d.ts +15 -0
  37. package/lib/Filter/ToggleItem.js +6 -32
  38. package/lib/Filter/filterClasses.d.ts +2 -0
  39. package/lib/Filter/index.d.ts +12 -0
  40. package/lib/Frontpage/FrontpageAllSubjects.js +7 -7
  41. package/lib/Frontpage/FrontpageSearch.js +2 -3
  42. package/lib/LearningPaths/LearningPathMenuModalWrapper.js +1 -2
  43. package/lib/Masthead/Masthead.d.ts +4 -8
  44. package/lib/Masthead/Masthead.js +65 -49
  45. package/lib/Masthead/MastheadSearchModal.js +3 -4
  46. package/lib/Masthead/SkipToMainContent.d.ts +6 -0
  47. package/lib/Masthead/SkipToMainContent.js +38 -0
  48. package/lib/Masthead/index.d.ts +2 -1
  49. package/lib/Masthead/index.js +10 -0
  50. package/lib/SearchTypeResult/PopupFilter.js +7 -7
  51. package/lib/SearchTypeResult/SearchFilterContent.js +2 -2
  52. package/lib/SectionHeading/SectionHeading.d.ts +1 -13
  53. package/lib/SectionHeading/SectionHeading.js +23 -19
  54. package/lib/Subject/index.d.ts +0 -1
  55. package/lib/Subject/index.js +0 -8
  56. package/lib/User/UserInfo.js +11 -3
  57. package/lib/all.css +1 -1
  58. package/lib/index-javascript.js +1 -63
  59. package/lib/index.d.ts +5 -2
  60. package/lib/index.js +48 -7
  61. package/lib/locale/messages-en.d.ts +1 -0
  62. package/lib/locale/messages-en.js +1 -0
  63. package/lib/locale/messages-nb.d.ts +1 -0
  64. package/lib/locale/messages-nb.js +1 -0
  65. package/lib/locale/messages-nn.d.ts +1 -0
  66. package/lib/locale/messages-nn.js +1 -0
  67. package/lib/locale/messages-se.d.ts +1 -0
  68. package/lib/locale/messages-se.js +1 -0
  69. package/lib/locale/messages-sma.d.ts +1 -0
  70. package/lib/locale/messages-sma.js +1 -0
  71. package/package.json +11 -11
  72. package/src/.DS_Store +0 -0
  73. package/src/CompetenceGoals/{CompetenceGoalsDialog.jsx → CompetenceGoalsDialog.tsx} +34 -27
  74. package/src/CompetenceGoals/index.ts +1 -0
  75. package/src/Filter/FilterButtons.tsx +0 -1
  76. package/src/Filter/FilterList.tsx +135 -0
  77. package/src/Filter/FilterListPhone.tsx +275 -0
  78. package/src/Filter/ToggleItem.tsx +58 -0
  79. package/src/Filter/{filterClasses.js → filterClasses.ts} +0 -0
  80. package/src/Filter/{index.js → index.ts} +0 -0
  81. package/src/Frontpage/FrontpageAllSubjects.tsx +0 -1
  82. package/src/Frontpage/FrontpageSearch.tsx +0 -1
  83. package/src/LearningPaths/LearningPathMenuModalWrapper.tsx +0 -1
  84. package/src/Masthead/Masthead.tsx +85 -45
  85. package/src/Masthead/MastheadSearchModal.tsx +0 -1
  86. package/src/Masthead/SkipToMainContent.tsx +48 -0
  87. package/src/Masthead/index.ts +2 -1
  88. package/src/SearchTypeResult/PopupFilter.tsx +0 -1
  89. package/src/SearchTypeResult/SearchFilterContent.tsx +0 -1
  90. package/src/SectionHeading/SectionHeading.tsx +29 -16
  91. package/src/Subject/index.ts +0 -1
  92. package/src/User/UserInfo.tsx +4 -4
  93. package/src/index-javascript.js +0 -10
  94. package/src/index.ts +7 -2
  95. package/src/locale/messages-en.ts +1 -0
  96. package/src/locale/messages-nb.ts +1 -0
  97. package/src/locale/messages-nn.ts +1 -0
  98. package/src/locale/messages-se.ts +1 -0
  99. package/src/locale/messages-sma.ts +1 -0
  100. package/src/main.scss +0 -3
  101. package/es/CompetenceGoals/CompetenceGoalList.js +0 -58
  102. package/es/CompetenceGoals/CompetenceGoals.js +0 -159
  103. package/es/Subject/SubjectFilter.js +0 -42
  104. package/lib/CompetenceGoals/CompetenceGoalList.js +0 -78
  105. package/lib/CompetenceGoals/CompetenceGoals.js +0 -184
  106. package/lib/Subject/SubjectFilter.d.ts +0 -27
  107. package/lib/Subject/SubjectFilter.js +0 -58
  108. package/src/CompetenceGoals/CompetenceGoalList.jsx +0 -51
  109. package/src/CompetenceGoals/CompetenceGoals.jsx +0 -152
  110. package/src/CompetenceGoals/component.competence-goals.scss +0 -161
  111. package/src/CompetenceGoals/index.js +0 -6
  112. package/src/Filter/FilterList.jsx +0 -167
  113. package/src/Filter/FilterListPhone.jsx +0 -329
  114. package/src/Filter/ToggleItem.jsx +0 -71
  115. package/src/Masthead/component.masthead.scss +0 -146
  116. package/src/SectionHeading/component.section-heading.scss +0 -17
  117. package/src/Subject/SubjectFilter.tsx +0 -48
@@ -1,167 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- * FRI OG BEGRENSET
7
- */
8
-
9
- import React, { Component, Fragment } from 'react';
10
- import PropTypes from 'prop-types';
11
- import { ChevronDown, ChevronUp } from '@ndla/icons/common';
12
-
13
- import { classes } from './filterClasses';
14
- import ToggleItem from './ToggleItem';
15
-
16
- class FilterList extends Component {
17
- constructor(props) {
18
- super(props);
19
- this.state = {
20
- visibleCount: props.defaultVisibleCount,
21
- };
22
- }
23
-
24
- render() {
25
- const {
26
- modifiers,
27
- preid,
28
- label,
29
- labelNotVisible,
30
- options,
31
- values,
32
- onChange,
33
- defaultVisibleCount,
34
- showLabel,
35
- hideLabel,
36
- alignedGroup,
37
- collapseMobile,
38
- } = this.props;
39
-
40
- const showAll = defaultVisibleCount === null || options.length <= defaultVisibleCount;
41
- const labelModifiers = [];
42
-
43
- if (labelNotVisible) {
44
- labelModifiers.push('hidden');
45
- }
46
-
47
- return (
48
- <section {...classes('list', modifiers)}>
49
- {label && <h1 {...classes('label', labelModifiers)}>{label}</h1>}
50
- {this.props.noFilterSelectedLabel && options.length === 0 && (
51
- <span {...classes('no-filter-selected')}>{this.props.noFilterSelectedLabel}</span>
52
- )}
53
- <ul
54
- {...classes('item-wrapper', {
55
- 'aligned-grouping': alignedGroup,
56
- 'collapse-mobile': collapseMobile,
57
- })}>
58
- {options.map((option, index) => {
59
- const itemModifiers = [];
60
-
61
- const checked = values.some((value) => value === option.value);
62
-
63
- if (!showAll && !checked && index + 1 > this.state.visibleCount) {
64
- itemModifiers.push('hidden');
65
- }
66
-
67
- const disabled = option.noResults || option.hits === 0;
68
-
69
- if (disabled) {
70
- itemModifiers.push('no-results');
71
- }
72
-
73
- return (
74
- <ToggleItem
75
- modifiers={itemModifiers}
76
- id={preid + option.value}
77
- key={option.value}
78
- value={option.value}
79
- disabled={disabled}
80
- tabIndex={disabled ? -1 : 0}
81
- checked={checked}
82
- icon={option.icon}
83
- label={option.title}
84
- onChange={(event) => {
85
- let newValues = null;
86
- if (event.currentTarget.checked) {
87
- newValues = [...values, option.value];
88
- } else {
89
- newValues = values.filter((value) => value !== option.value);
90
- }
91
- if (onChange) {
92
- onChange(newValues, option.value);
93
- }
94
- }}
95
- />
96
- );
97
- })}
98
- </ul>
99
- {!showAll && (
100
- <button
101
- {...classes('expand')}
102
- type="button"
103
- onClick={() => {
104
- this.setState((prevState) => {
105
- if (prevState.visibleCount === defaultVisibleCount) {
106
- return {
107
- visibleCount: options.length,
108
- };
109
- }
110
-
111
- return {
112
- visibleCount: defaultVisibleCount,
113
- };
114
- });
115
- }}>
116
- {this.state.visibleCount === defaultVisibleCount ? (
117
- <Fragment>
118
- <span>{showLabel}</span> <ChevronDown />
119
- </Fragment>
120
- ) : (
121
- <Fragment>
122
- <span>{hideLabel}</span> <ChevronUp />
123
- </Fragment>
124
- )}
125
- </button>
126
- )}
127
- </section>
128
- );
129
- }
130
- }
131
-
132
- const valueShape = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
133
-
134
- FilterList.propTypes = {
135
- children: PropTypes.node,
136
- label: PropTypes.string,
137
- preid: PropTypes.string,
138
- labelNotVisible: PropTypes.bool,
139
- modifiers: PropTypes.string,
140
- onChange: PropTypes.func, // isRequired
141
- options: PropTypes.arrayOf(
142
- PropTypes.shape({
143
- title: PropTypes.string.isRequired,
144
- value: valueShape.isRequired,
145
- hits: PropTypes.number,
146
- icon: PropTypes.func,
147
- noResults: PropTypes.bool,
148
- }),
149
- ).isRequired,
150
- values: PropTypes.arrayOf(valueShape),
151
- defaultVisibleCount: PropTypes.number,
152
- showLabel: PropTypes.string,
153
- noFilterSelectedLabel: PropTypes.string,
154
- hideLabel: PropTypes.string,
155
- alignedGroup: PropTypes.bool,
156
- collapseMobile: PropTypes.bool,
157
- };
158
-
159
- FilterList.defaultProps = {
160
- label: 'FILTER:',
161
- preid: '',
162
- modifiers: '',
163
- values: [],
164
- defaultVisibleCount: null,
165
- };
166
-
167
- export default FilterList;
@@ -1,329 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- * FRI OG BEGRENSET
7
- */
8
-
9
- import React, { Component, Fragment } from 'react';
10
- import PropTypes from 'prop-types';
11
- import { ChevronDown, ChevronUp } from '@ndla/icons/common';
12
- import { Cross } from '@ndla/icons/action';
13
- import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
14
- import Button from '@ndla/button';
15
- import { debounce } from 'lodash';
16
- import { classes } from './filterClasses';
17
- import ToggleItem from './ToggleItem';
18
- import ActiveFilters from '../Search/ActiveFilters';
19
-
20
- class FilterListPhone extends Component {
21
- constructor(props) {
22
- super(props);
23
- this.state = {
24
- isNarrowScreen: false,
25
- visibleCount: props.defaultVisibleCount,
26
- };
27
- this.setScreenSizeDebounced = debounce(() => this.setScreenSize(false), 50);
28
- this.handleChange = this.handleChange.bind(this);
29
- }
30
-
31
- componentDidMount() {
32
- this.setScreenSize(true);
33
- window.addEventListener('resize', this.setScreenSizeDebounced);
34
- }
35
-
36
- componentWillUnmount() {
37
- this.setScreenSizeDebounced.cancel();
38
- window.removeEventListener('resize', this.setScreenSizeDebounced);
39
- }
40
-
41
- setScreenSize(initial = false) {
42
- const isNarrowScreen = (window.innerWidth || document.documentElement.clientWidth) < 768;
43
-
44
- /* eslint react/no-did-mount-set-state: 0 */
45
- if ((initial && isNarrowScreen) || !initial) {
46
- this.setState({
47
- isNarrowScreen,
48
- });
49
- }
50
- /* eslint react/no-did-mount-set-state: 1 */
51
- }
52
-
53
- handleChange(event, option) {
54
- const { onChange, values } = this.props;
55
- let newValues = null;
56
- if (event.currentTarget.checked) {
57
- newValues = [...values, option.value];
58
- } else {
59
- newValues = values.filter((value) => value !== option.value);
60
- }
61
- if (onChange) {
62
- onChange(newValues, option.value);
63
- }
64
- }
65
-
66
- render() {
67
- const {
68
- preid,
69
- modifiers,
70
- label,
71
- labelNotVisible,
72
- options,
73
- values,
74
- onChange,
75
- defaultVisibleCount,
76
- showLabel,
77
- hideLabel,
78
- messages,
79
- alignedGroup,
80
- collapseMobile,
81
- activeFiltersNarrow,
82
- viewMode,
83
- isGroupedOptions,
84
- showActiveFiltersOnSmallScreen,
85
- } = this.props;
86
-
87
- const showAll = defaultVisibleCount === null || options.length <= defaultVisibleCount;
88
- const labelModifiers = [];
89
-
90
- if (labelNotVisible) {
91
- labelModifiers.push('hidden');
92
- }
93
-
94
- let groupedOptions = options;
95
- if (!isGroupedOptions) {
96
- groupedOptions = [options];
97
- }
98
-
99
- if (this.state.isNarrowScreen || viewMode === 'allModal') {
100
- let currentlyActiveFilters = [];
101
- groupedOptions.forEach((options) => {
102
- const activeFilters = options.filter((option) => values.some((value) => value === option.value));
103
- currentlyActiveFilters = [...currentlyActiveFilters, ...activeFilters];
104
- });
105
-
106
- const wrapperClassName =
107
- activeFiltersNarrow || viewMode === 'allModal' ? classes('narrow-active-filters').className : '';
108
- return (
109
- <div className={wrapperClassName}>
110
- {currentlyActiveFilters.length > 0 && (
111
- <ActiveFilters
112
- filters={currentlyActiveFilters}
113
- showOnSmallScreen={showActiveFiltersOnSmallScreen}
114
- onFilterRemove={(value) => {
115
- onChange(
116
- values.filter((option) => option !== value),
117
- value,
118
- );
119
- }}
120
- />
121
- )}
122
- <Modal
123
- size="fullscreen"
124
- animation="slide-up"
125
- backgroundColor="grey"
126
- activateButton={
127
- <Button outline {...classes('modal-button')}>
128
- {messages.openFilter}
129
- </Button>
130
- }>
131
- {(onClose) => (
132
- <Fragment>
133
- <ModalHeader modifier={['left-align']}>
134
- <div {...classes('modal-header')}>
135
- <div {...classes('modal-heading')}>
136
- {!this.state.isNarrowScreen && label && <h1 {...classes('label')}>{label}</h1>}
137
- <Button outline onClick={onClose}>
138
- {messages.useFilter}
139
- </Button>
140
- </div>
141
- <ModalCloseButton
142
- title={
143
- <Fragment>
144
- <Cross /> {messages.closeFilter}
145
- </Fragment>
146
- }
147
- onClick={onClose}
148
- />
149
- </div>
150
- </ModalHeader>
151
- <ModalBody modifier="no-side-padding-mobile">
152
- {this.state.isNarrowScreen && label && <h1 {...classes('label')}>{label}</h1>}
153
- {groupedOptions.map((options, index) => (
154
- <ul
155
- key={index}
156
- {...classes('item-wrapper', {
157
- 'aligned-grouping': alignedGroup,
158
- 'collapse-mobile': collapseMobile,
159
- 'grouped-options': isGroupedOptions,
160
- })}>
161
- {options.map((option) => {
162
- const itemModifiers = [];
163
-
164
- const checked = values.some((value) => value === option.value);
165
-
166
- if (option.noResults) {
167
- itemModifiers.push('no-results');
168
- }
169
-
170
- if (option.disabled) {
171
- itemModifiers.push('disabled');
172
- }
173
- return (
174
- <ToggleItem
175
- key={option.value}
176
- id={preid + option.value}
177
- value={option.value}
178
- checked={checked}
179
- onChange={(event) => {
180
- this.handleChange(event, option);
181
- }}
182
- icon={option.icon}
183
- label={option.title}
184
- disabled={option.disabled}
185
- modifiers={itemModifiers}
186
- />
187
- );
188
- })}
189
- </ul>
190
- ))}
191
-
192
- <div {...classes('usefilter-wrapper')}>
193
- <Button outline onClick={onClose}>
194
- {messages.useFilter}
195
- </Button>
196
- </div>
197
- </ModalBody>
198
- </Fragment>
199
- )}
200
- </Modal>
201
- </div>
202
- );
203
- }
204
-
205
- return (
206
- <>
207
- {isGroupedOptions && label && <h2 {...classes('label', labelModifiers)}>{label}</h2>}
208
- {groupedOptions.map((options, index) => (
209
- <section key={index} {...classes('list', modifiers)}>
210
- {!isGroupedOptions && label && <h1 {...classes('label', labelModifiers)}>{label}</h1>}
211
- <ul {...classes('item-wrapper')}>
212
- {options.map((option, index) => {
213
- const itemModifiers = [];
214
-
215
- const checked = values.some((value) => value === option.value);
216
-
217
- if (!showAll && !checked && index + 1 > this.state.visibleCount) {
218
- itemModifiers.push('hidden');
219
- }
220
-
221
- if (option.noResults) {
222
- itemModifiers.push('no-results');
223
- }
224
-
225
- if (option.disabled) {
226
- itemModifiers.push('disabled');
227
- }
228
-
229
- return (
230
- <ToggleItem
231
- key={option.value}
232
- id={preid + option.value}
233
- value={option.value}
234
- tabIndex={option.noResults ? -1 : 0}
235
- checked={checked}
236
- onChange={(event) => {
237
- this.handleChange(event, option);
238
- }}
239
- icon={option.icon}
240
- label={option.title}
241
- modifiers={itemModifiers}
242
- disabled={option.disabled}
243
- />
244
- );
245
- })}
246
- </ul>
247
- {!showAll && (
248
- <button
249
- {...classes('expand')}
250
- type="button"
251
- onClick={() => {
252
- this.setState((prevState) => {
253
- if (prevState.visibleCount === defaultVisibleCount) {
254
- return {
255
- visibleCount: options.length,
256
- };
257
- }
258
-
259
- return {
260
- visibleCount: defaultVisibleCount,
261
- };
262
- });
263
- }}>
264
- {this.state.visibleCount === defaultVisibleCount ? (
265
- <Fragment>
266
- <span>{showLabel}</span> <ChevronDown />
267
- </Fragment>
268
- ) : (
269
- <Fragment>
270
- <span>{hideLabel}</span> <ChevronUp />
271
- </Fragment>
272
- )}
273
- </button>
274
- )}
275
- </section>
276
- ))}
277
- </>
278
- );
279
- }
280
- }
281
-
282
- const valueShape = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
283
-
284
- const optionsShape = PropTypes.shape({
285
- title: PropTypes.string.isRequired,
286
- value: valueShape.isRequired,
287
- icon: PropTypes.func,
288
- noResults: PropTypes.bool,
289
- disabled: PropTypes.bool,
290
- });
291
-
292
- FilterListPhone.propTypes = {
293
- preid: PropTypes.string.isRequired,
294
- children: PropTypes.node,
295
- label: PropTypes.string,
296
- labelNotVisible: PropTypes.bool,
297
- modifiers: PropTypes.string,
298
- onChange: PropTypes.func, // isRequired
299
- options: PropTypes.oneOfType([PropTypes.arrayOf(optionsShape), PropTypes.arrayOf(PropTypes.arrayOf(optionsShape))])
300
- .isRequired,
301
- values: PropTypes.arrayOf(valueShape),
302
- defaultVisibleCount: PropTypes.number,
303
- showLabel: PropTypes.string,
304
- hideLabel: PropTypes.string,
305
- onToggle: PropTypes.func,
306
- alignedGroup: PropTypes.bool,
307
- collapseMobile: PropTypes.bool,
308
- activeFiltersNarrow: PropTypes.bool,
309
- messages: PropTypes.shape({
310
- useFilter: PropTypes.string.isRequired,
311
- openFilter: PropTypes.string.isRequired,
312
- closeFilter: PropTypes.string.isRequired,
313
- }).isRequired,
314
- viewMode: PropTypes.oneOf(['inlineDesktop', 'allModal']),
315
- isGroupedOptions: PropTypes.bool,
316
- showActiveFiltersOnSmallScreen: PropTypes.bool,
317
- };
318
-
319
- FilterListPhone.defaultProps = {
320
- modifiers: '',
321
- values: [],
322
- defaultVisibleCount: null,
323
- onToggle: null,
324
- alignedGroup: false,
325
- collapseMobile: true,
326
- viewMode: 'inlineDesktop',
327
- };
328
-
329
- export default FilterListPhone;
@@ -1,71 +0,0 @@
1
- /*
2
- * Copyright (c) 2017-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import React, { createElement } from 'react';
10
- import PropTypes from 'prop-types';
11
- import { classes } from './filterClasses';
12
-
13
- const ToggleItem = ({
14
- id,
15
- checked,
16
- modifiers,
17
- label,
18
- component: Component,
19
- icon,
20
- onChange,
21
- tabIndex,
22
- value,
23
- disabled,
24
- hits,
25
- }) => (
26
- <Component {...classes('item', modifiers)}>
27
- <input
28
- {...classes('input')}
29
- type="checkbox"
30
- id={id}
31
- value={value}
32
- disabled={disabled}
33
- tabIndex={tabIndex}
34
- checked={checked}
35
- onChange={onChange}
36
- />
37
- <label htmlFor={id}>
38
- <span {...classes('item-checkbox')} />
39
- <span {...classes('text')}>
40
- {label}
41
- {hits !== undefined && ` (${hits})`}
42
- </span>
43
- {icon
44
- ? createElement(icon, {
45
- className: `c-icon--22 ${classes('icon').className}`,
46
- })
47
- : null}
48
- </label>
49
- </Component>
50
- );
51
-
52
- ToggleItem.propTypes = {
53
- id: PropTypes.string.isRequired,
54
- label: PropTypes.string.isRequired,
55
- onChange: PropTypes.func.isRequired,
56
- checked: PropTypes.bool,
57
- disabled: PropTypes.bool,
58
- tabIndex: PropTypes.number,
59
- modifiers: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
60
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
61
- component: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.object]),
62
- hits: PropTypes.number,
63
- icon: PropTypes.func,
64
- };
65
-
66
- ToggleItem.defaultProps = {
67
- component: 'li',
68
- checked: false,
69
- };
70
-
71
- export default ToggleItem;
@@ -1,146 +0,0 @@
1
- .c-masthead {
2
- z-index: 99;
3
- position: relative;
4
- background: white;
5
- border-bottom: 1px solid $brand-grey--lighter;
6
- min-height: $masthead-height;
7
- display: flex;
8
- flex-flow: column;
9
- justify-content: flex-end;
10
-
11
- &__skip-to-main-content {
12
- left: -999px;
13
- position: absolute;
14
- top: auto;
15
- width: 1px;
16
- height: 1px;
17
- overflow: hidden;
18
- z-index: -999;
19
- &:focus,
20
- &:active {
21
- color: #fff;
22
- background: $brand-color;
23
- left: auto;
24
- top: auto;
25
- width: 30%;
26
- height: auto;
27
- overflow: auto;
28
- margin: 10px 35%;
29
- padding: 5px;
30
- border-radius: 15px;
31
- border: 4px solid $brand-color--tertiary;
32
- text-align: center;
33
- font-size: 1.2em;
34
- z-index: 9999;
35
- animation-name: fadeIn;
36
- animation-duration: 0.3s;
37
- }
38
- }
39
-
40
- &--fixed {
41
- top: 0;
42
- position: sticky;
43
- @media print {
44
- position: relative;
45
- }
46
- }
47
-
48
- &--ndlaFilm {
49
- background: $film-color-light;
50
- background-image: linear-gradient(0deg, $film-color-light, $film-color);
51
- border: 0;
52
- border-bottom: 1px solid $film-color-lighter;
53
- .c-breadcrumb-block,
54
- .c-breadcrumb-block__item,
55
- .c-breadcrumb-block__item a,
56
- .c-breadcrumb-block__item span,
57
- .c-breadcrumb-block__item .c-icon {
58
- color: #fff;
59
- }
60
- }
61
-
62
- &__content {
63
- justify-content: center;
64
- align-items: center;
65
- text-align: center;
66
- padding: $spacing--small;
67
- font-weight: $font-weight-normal;
68
- display: flex;
69
- height: $masthead-height;
70
- justify-content: space-between;
71
-
72
- @include mq(tablet) {
73
- flex-direction: row;
74
- padding: $spacing--small $spacing;
75
- }
76
- @include mq(desktop) {
77
- padding: $spacing--small $spacing--large;
78
- }
79
- }
80
-
81
- &__info {
82
- text-align: center;
83
- }
84
-
85
- &__info-content {
86
- background: $yellow-light;
87
- padding: 0 $spacing;
88
- display: inline-block;
89
- @include font-size(12px, 30px);
90
-
91
- @include mq(tablet) {
92
- padding: 0 $spacing--large;
93
- @include font-size(14px, 35px);
94
- }
95
-
96
- @include mq(wide) {
97
- @include font-size(16px, 45px);
98
-
99
- z-index: 1;
100
- position: absolute;
101
- left: 50%;
102
- transform: translateX(-50%);
103
- top: 0;
104
- }
105
- }
106
-
107
- &__left {
108
- display: flex;
109
- button {
110
- white-space: nowrap;
111
- }
112
- > div:last-child {
113
- flex-grow: 1;
114
- }
115
- @include mq(desktop) {
116
- flex-grow: 1;
117
- text-align: left;
118
- }
119
- }
120
-
121
- &__right {
122
- display: flex;
123
- align-items: center;
124
- justify-content: flex-end;
125
-
126
- @include mq(tablet) {
127
- padding: $spacing--small 0;
128
- padding: 0;
129
- }
130
- }
131
- }
132
-
133
- .c-masthead,
134
- .c-masthead__placeholder {
135
- &--infoContent {
136
- min-height: $masthead-height + 30px;
137
-
138
- @include mq(tablet) {
139
- min-height: $masthead-height + 35px;
140
- }
141
-
142
- @include mq(wide) {
143
- min-height: $masthead-height;
144
- }
145
- }
146
- }