@ndla/ui 44.0.12 → 44.0.14
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/ContactBlock/ContactBlock.js +13 -13
- package/es/LinkBlock/LinkBlock.js +6 -6
- package/es/Masthead/Masthead.js +13 -34
- package/es/Masthead/MastheadSearchModal.js +2 -4
- package/es/Masthead/index.js +2 -2
- package/es/ProgrammeCard/ProgrammeCard.js +3 -5
- package/es/Search/ToggleSearchButton.js +9 -24
- package/es/Table/Table.js +36 -30
- package/es/Table/index.js +1 -0
- package/es/TreeStructure/FolderItem.js +11 -9
- package/es/User/UserInfo.js +6 -3
- package/es/User/parseUserObject.js +1 -1
- package/es/all.css +1 -1
- package/es/index.js +2 -2
- package/es/locale/messages-en.js +0 -2
- package/es/locale/messages-nb.js +0 -2
- package/es/locale/messages-nn.js +0 -2
- package/es/locale/messages-se.js +0 -2
- package/es/locale/messages-sma.js +0 -2
- package/lib/ContactBlock/ContactBlock.js +13 -13
- package/lib/LinkBlock/LinkBlock.js +6 -6
- package/lib/Masthead/Masthead.d.ts +0 -6
- package/lib/Masthead/Masthead.js +14 -36
- package/lib/Masthead/MastheadSearchModal.d.ts +1 -2
- package/lib/Masthead/MastheadSearchModal.js +2 -4
- package/lib/Masthead/index.d.ts +2 -2
- package/lib/Masthead/index.js +1 -10
- package/lib/ProgrammeCard/ProgrammeCard.js +3 -5
- package/lib/Search/ToggleSearchButton.d.ts +0 -2
- package/lib/Search/ToggleSearchButton.js +8 -23
- package/lib/Table/Table.d.ts +1 -0
- package/lib/Table/Table.js +43 -36
- package/lib/Table/index.d.ts +1 -0
- package/lib/Table/index.js +10 -2
- package/lib/TreeStructure/FolderItem.js +11 -9
- package/lib/User/UserInfo.js +6 -3
- package/lib/User/parseUserObject.d.ts +1 -1
- package/lib/User/parseUserObject.js +1 -1
- package/lib/all.css +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +7 -7
- package/lib/locale/messages-en.d.ts +0 -2
- package/lib/locale/messages-en.js +0 -2
- package/lib/locale/messages-nb.d.ts +0 -2
- package/lib/locale/messages-nb.js +0 -2
- package/lib/locale/messages-nn.d.ts +0 -2
- package/lib/locale/messages-nn.js +0 -2
- package/lib/locale/messages-se.d.ts +0 -2
- package/lib/locale/messages-se.js +0 -2
- package/lib/locale/messages-sma.d.ts +0 -2
- package/lib/locale/messages-sma.js +0 -2
- package/package.json +16 -16
- package/src/ContactBlock/ContactBlock.tsx +1 -0
- package/src/LinkBlock/LinkBlock.tsx +1 -0
- package/src/Masthead/Masthead.tsx +6 -38
- package/src/Masthead/MastheadSearchModal.tsx +2 -3
- package/src/Masthead/index.ts +2 -2
- package/src/ProgrammeCard/ProgrammeCard.tsx +2 -2
- package/src/Search/ToggleSearchButton.tsx +21 -38
- package/src/Table/Table.tsx +166 -19
- package/src/Table/index.ts +1 -0
- package/src/TreeStructure/FolderItem.tsx +38 -37
- package/src/User/UserInfo.tsx +3 -1
- package/src/User/__tests__/parseUserObject-test.ts +1 -1
- package/src/User/parseUserObject.ts +1 -1
- package/src/index.ts +2 -2
- package/src/locale/messages-en.ts +0 -2
- package/src/locale/messages-nb.ts +0 -2
- package/src/locale/messages-nn.ts +0 -2
- package/src/locale/messages-se.ts +0 -2
- package/src/locale/messages-sma.ts +0 -2
- package/src/main.scss +0 -1
- package/src/Table/component.tables.scss +0 -223
|
@@ -41,6 +41,9 @@ const OpenButton = styled.span`
|
|
|
41
41
|
transform: rotate(0deg);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
&[data-hide-arrow='true'] {
|
|
45
|
+
visibility: hidden;
|
|
46
|
+
}
|
|
44
47
|
`;
|
|
45
48
|
|
|
46
49
|
const StyledName = styled.span`
|
|
@@ -226,25 +229,24 @@ const FolderItem = ({
|
|
|
226
229
|
onFocus={() => setFocusedFolder(folder)}
|
|
227
230
|
onClick={handleClickFolder}
|
|
228
231
|
>
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
)}
|
|
232
|
+
<OpenButton
|
|
233
|
+
aria-hidden
|
|
234
|
+
tabIndex={-1}
|
|
235
|
+
data-open={isOpen}
|
|
236
|
+
data-hide-arrow={hideArrow}
|
|
237
|
+
onClick={(e) => {
|
|
238
|
+
e.stopPropagation();
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
ref.current?.focus();
|
|
241
|
+
if (isOpen) {
|
|
242
|
+
onCloseFolder(id);
|
|
243
|
+
} else {
|
|
244
|
+
onOpenFolder(id);
|
|
245
|
+
}
|
|
246
|
+
}}
|
|
247
|
+
>
|
|
248
|
+
<ArrowDropDownRounded />
|
|
249
|
+
</OpenButton>
|
|
248
250
|
<StyledName>{name}</StyledName>
|
|
249
251
|
</FolderNameLink>
|
|
250
252
|
) : (
|
|
@@ -270,24 +272,23 @@ const FolderItem = ({
|
|
|
270
272
|
data-creating={isCreatingFolder}
|
|
271
273
|
>
|
|
272
274
|
<IconWrapper>
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
)}
|
|
275
|
+
<OpenButton
|
|
276
|
+
aria-hidden
|
|
277
|
+
tabIndex={-1}
|
|
278
|
+
data-open={isOpen}
|
|
279
|
+
data-hide-arrow={hideArrow}
|
|
280
|
+
onClick={(e) => {
|
|
281
|
+
e.stopPropagation();
|
|
282
|
+
setFocusedFolder(folder);
|
|
283
|
+
if (isOpen) {
|
|
284
|
+
onCloseFolder(id);
|
|
285
|
+
} else {
|
|
286
|
+
onOpenFolder(id);
|
|
287
|
+
}
|
|
288
|
+
}}
|
|
289
|
+
>
|
|
290
|
+
<ArrowDropDownRounded />
|
|
291
|
+
</OpenButton>
|
|
291
292
|
<FolderIconWrapper>
|
|
292
293
|
<FolderIcon />
|
|
293
294
|
</FolderIconWrapper>
|
package/src/User/UserInfo.tsx
CHANGED
|
@@ -23,6 +23,8 @@ const ShortInfoDiv = styled.div`
|
|
|
23
23
|
margin: 2rem auto;
|
|
24
24
|
`;
|
|
25
25
|
|
|
26
|
+
const isTeacher = (affiliations: FeideUserApiType['eduPersonAffiliation']) => affiliations.includes('employee');
|
|
27
|
+
|
|
26
28
|
export const UserInfo = ({ user }: Props) => {
|
|
27
29
|
const { t } = useTranslation();
|
|
28
30
|
|
|
@@ -33,7 +35,7 @@ export const UserInfo = ({ user }: Props) => {
|
|
|
33
35
|
{
|
|
34
36
|
<p>
|
|
35
37
|
{t('user.loggedInAs', {
|
|
36
|
-
role: t(`user.role.${parsedUser.
|
|
38
|
+
role: t(`user.role.${isTeacher(parsedUser.eduPersonAffiliation) ? 'employee' : 'student'}`),
|
|
37
39
|
})}
|
|
38
40
|
</p>
|
|
39
41
|
}
|
|
@@ -162,9 +162,9 @@ describe('parseUserObject', () => {
|
|
|
162
162
|
it('Correctly parses Feide user', () => {
|
|
163
163
|
const expected = {
|
|
164
164
|
uid: ['david_laerervgs'],
|
|
165
|
-
primaryAffiliation: 'employee',
|
|
166
165
|
displayName: 'David LærerVGS Jonsen',
|
|
167
166
|
mail: ['david_laerervgs@feide.no'],
|
|
167
|
+
eduPersonAffiliation: ['member', 'employee', 'faculty'],
|
|
168
168
|
grepCodes: [],
|
|
169
169
|
organizations: [
|
|
170
170
|
{
|
|
@@ -80,7 +80,7 @@ export const parseUserObject = (user: FeideUserApiType) => {
|
|
|
80
80
|
|
|
81
81
|
return {
|
|
82
82
|
uid: user.uid,
|
|
83
|
-
|
|
83
|
+
eduPersonAffiliation: user.eduPersonAffiliation,
|
|
84
84
|
displayName: user.displayName,
|
|
85
85
|
mail: user.mail,
|
|
86
86
|
organizations: roots,
|
package/src/index.ts
CHANGED
|
@@ -36,7 +36,7 @@ export {
|
|
|
36
36
|
default as Article,
|
|
37
37
|
} from './Article';
|
|
38
38
|
|
|
39
|
-
export { default as Table } from './Table';
|
|
39
|
+
export { default as Table, TableStyling } from './Table';
|
|
40
40
|
|
|
41
41
|
export { default as ResourcesWrapper, ResourcesTopicTitle } from './ResourcesWrapper';
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
|
44
44
|
|
|
45
45
|
export { default as NoContentBox } from './NoContentBox';
|
|
46
46
|
|
|
47
|
-
export { default as Masthead,
|
|
47
|
+
export { default as Masthead, getMastheadHeight, useMastheadHeight, SkipToMainContent } from './Masthead';
|
|
48
48
|
|
|
49
49
|
export { default as ContentLoader } from './ContentLoader';
|
|
50
50
|
|
package/src/main.scss
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
@import 'MediaList/component.medialist';
|
|
17
17
|
@import 'RelatedArticleList/component.related-articles';
|
|
18
18
|
@import 'ContentTypeBadge/component.content-type-badge';
|
|
19
|
-
@import 'Table/component.tables';
|
|
20
19
|
@import 'Filter/component.filter';
|
|
21
20
|
@import 'Translation/component.translation';
|
|
22
21
|
@import 'Search/component.search';
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
** TABLES
|
|
3
|
-
** Responsive styling for tables
|
|
4
|
-
** Applied for tables both with and without c-table class.
|
|
5
|
-
**/
|
|
6
|
-
|
|
7
|
-
.c-table {
|
|
8
|
-
$scrollbar-height: 8px;
|
|
9
|
-
margin: 0 0 $spacing--medium 0;
|
|
10
|
-
|
|
11
|
-
&::-webkit-scrollbar {
|
|
12
|
-
height: $scrollbar-height;
|
|
13
|
-
}
|
|
14
|
-
&::-webkit-scrollbar-track-piece {
|
|
15
|
-
background: $brand-color--lighter;
|
|
16
|
-
border-radius: $scrollbar-height;
|
|
17
|
-
}
|
|
18
|
-
&::-webkit-scrollbar-thumb {
|
|
19
|
-
background: $brand-color--dark;
|
|
20
|
-
border-radius: $scrollbar-height;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&__wrapper {
|
|
24
|
-
margin: $spacing--small 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&__content {
|
|
28
|
-
text-align: center;
|
|
29
|
-
position: relative;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&__left-shadow,
|
|
33
|
-
&__right-shadow {
|
|
34
|
-
position: absolute;
|
|
35
|
-
z-index: 1;
|
|
36
|
-
top: 0;
|
|
37
|
-
height: calc(100% - #{$spacing--large});
|
|
38
|
-
width: 15px;
|
|
39
|
-
background-attachment: scroll, scroll;
|
|
40
|
-
background-repeat: no-repeat;
|
|
41
|
-
display: none;
|
|
42
|
-
|
|
43
|
-
&--active {
|
|
44
|
-
display: block;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&__left-shadow {
|
|
49
|
-
left: 0;
|
|
50
|
-
background: radial-gradient(ellipse at left, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0) 75%) 0 center;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&__right-shadow {
|
|
54
|
-
right: 0;
|
|
55
|
-
background: radial-gradient(ellipse at right, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0) 75%) 0 center;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.c-article table:not(.c-table),
|
|
60
|
-
article table:not(.c-table) {
|
|
61
|
-
margin: $spacing--large 0 $spacing--large 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.c-table,
|
|
65
|
-
.c-article table,
|
|
66
|
-
article table {
|
|
67
|
-
padding-left: 1px;
|
|
68
|
-
padding-right: 1px;
|
|
69
|
-
display: inline-block;
|
|
70
|
-
vertical-align: top;
|
|
71
|
-
font-size: 85%;
|
|
72
|
-
table-layout: fixed;
|
|
73
|
-
|
|
74
|
-
overflow-x: auto;
|
|
75
|
-
max-width: 100%;
|
|
76
|
-
|
|
77
|
-
// optional - enable iOS momentum scrolling
|
|
78
|
-
-webkit-overflow-scrolling: touch;
|
|
79
|
-
|
|
80
|
-
// scrolling shadows on left/right
|
|
81
|
-
|
|
82
|
-
&:after,
|
|
83
|
-
&:before {
|
|
84
|
-
content: '';
|
|
85
|
-
display: table;
|
|
86
|
-
clear: both;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
caption {
|
|
90
|
-
background-color: transparent;
|
|
91
|
-
font-weight: $font-weight-bold;
|
|
92
|
-
@include font-size(16px, 20px);
|
|
93
|
-
text-align: left;
|
|
94
|
-
text-transform: uppercase;
|
|
95
|
-
font-family: $font;
|
|
96
|
-
margin-bottom: $spacing--small;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
thead {
|
|
100
|
-
overflow: hidden;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
td,
|
|
104
|
-
th {
|
|
105
|
-
display: table-cell;
|
|
106
|
-
padding: $spacing--small/2 $spacing--small;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
th {
|
|
110
|
-
font-weight: $font-weight-bold;
|
|
111
|
-
border-bottom: 3px solid $brand-color--tertiary;
|
|
112
|
-
font-family: $font;
|
|
113
|
-
|
|
114
|
-
@include font-size(16px, 22px);
|
|
115
|
-
@include mq(tablet) {
|
|
116
|
-
@include font-size(16px, 30px);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
tbody th {
|
|
121
|
-
border-bottom: 0;
|
|
122
|
-
border-right: 3px solid $brand-color--tertiary;
|
|
123
|
-
padding: $spacing--small/1.5;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
thead tr:nth-child(2) th {
|
|
127
|
-
border: 1px solid $brand-grey--lighter;
|
|
128
|
-
text-transform: none;
|
|
129
|
-
@include font-size(14px, 18px);
|
|
130
|
-
@include mq(tablet) {
|
|
131
|
-
@include font-size(15px, 26px);
|
|
132
|
-
}
|
|
133
|
-
font-weight: $font-weight-semibold;
|
|
134
|
-
height: 40px;
|
|
135
|
-
background-color: $brand-color--lighter;
|
|
136
|
-
padding: $spacing/6 $spacing $spacing/6 $spacing/3;
|
|
137
|
-
|
|
138
|
-
&:empty {
|
|
139
|
-
background-color: transparent;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
td {
|
|
144
|
-
border: 1px solid $brand-grey--lighter;
|
|
145
|
-
vertical-align: top;
|
|
146
|
-
line-height: 1.6em;
|
|
147
|
-
|
|
148
|
-
@include font-size(14px, 22px);
|
|
149
|
-
@include mq(tablet) {
|
|
150
|
-
@include font-size(15px, 30px);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
ol,
|
|
154
|
-
ul {
|
|
155
|
-
font-size: unset !important;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
p {
|
|
159
|
-
line-height: 1.6em;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
p:last-child {
|
|
163
|
-
margin: 0;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
img {
|
|
167
|
-
max-width: 100%;
|
|
168
|
-
min-width: 120px;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Remove excess spacing on headings inside table
|
|
173
|
-
h1,
|
|
174
|
-
h2,
|
|
175
|
-
h3,
|
|
176
|
-
h4,
|
|
177
|
-
h5 {
|
|
178
|
-
margin-top: 0;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
ul {
|
|
182
|
-
margin: 0 0 0 $spacing--small * 1.4;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.c-figure {
|
|
186
|
-
margin: 0;
|
|
187
|
-
padding: 0;
|
|
188
|
-
width: 100% !important;
|
|
189
|
-
left: 0 !important;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.c-styleguide-table {
|
|
194
|
-
&__warning-cell {
|
|
195
|
-
background: red;
|
|
196
|
-
color: #fff;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Fix for tables in framed <details />
|
|
201
|
-
details .frame .c-table__wrapper {
|
|
202
|
-
position: static !important;
|
|
203
|
-
width: 100% !important;
|
|
204
|
-
padding-left: 0 !important;
|
|
205
|
-
padding-right: 0 !important;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Fix for tables in framed <details />
|
|
209
|
-
details .c-table__wrapper {
|
|
210
|
-
position: static !important;
|
|
211
|
-
width: 100% !important;
|
|
212
|
-
padding-left: 0 !important;
|
|
213
|
-
padding-right: 0 !important;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Removes excess padding from paragraphs in table headers.
|
|
217
|
-
.c-article,
|
|
218
|
-
.c-editor,
|
|
219
|
-
.c-table {
|
|
220
|
-
th p {
|
|
221
|
-
margin: 0;
|
|
222
|
-
}
|
|
223
|
-
}
|