@ndla/ui 50.5.3 → 50.6.0

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 (51) hide show
  1. package/es/FileList/File.js +9 -55
  2. package/es/FileList/FileList.js +19 -8
  3. package/es/FileList/Format.js +70 -0
  4. package/es/FileList/index.js +1 -0
  5. package/es/LicenseByline/EmbedByline.js +7 -7
  6. package/es/Navigation/NavigationBox.js +43 -78
  7. package/es/ResourceGroup/ResourceItem.js +15 -11
  8. package/es/SearchTypeResult/components/ItemContexts.js +9 -7
  9. package/es/Topic/Topic.js +24 -52
  10. package/es/all.css +1 -1
  11. package/es/index.js +1 -1
  12. package/es/locale/messages-en.js +1 -1
  13. package/es/locale/messages-nb.js +1 -1
  14. package/es/locale/messages-nn.js +1 -1
  15. package/es/locale/messages-sma.js +1 -1
  16. package/lib/FileList/File.js +11 -54
  17. package/lib/FileList/FileList.d.ts +4 -3
  18. package/lib/FileList/FileList.js +19 -8
  19. package/lib/FileList/Format.d.ts +16 -0
  20. package/lib/FileList/Format.js +74 -0
  21. package/lib/FileList/index.d.ts +1 -0
  22. package/lib/FileList/index.js +7 -0
  23. package/lib/LicenseByline/EmbedByline.js +7 -7
  24. package/lib/Navigation/NavigationBox.d.ts +2 -5
  25. package/lib/Navigation/NavigationBox.js +42 -77
  26. package/lib/ResourceGroup/ResourceItem.js +15 -11
  27. package/lib/SearchTypeResult/components/ItemContexts.js +9 -7
  28. package/lib/Topic/Topic.js +24 -50
  29. package/lib/all.css +1 -1
  30. package/lib/index.d.ts +1 -1
  31. package/lib/index.js +6 -0
  32. package/lib/locale/messages-en.js +1 -1
  33. package/lib/locale/messages-nb.js +1 -1
  34. package/lib/locale/messages-nn.js +1 -1
  35. package/lib/locale/messages-sma.js +1 -1
  36. package/package.json +12 -12
  37. package/src/FileList/File.tsx +5 -65
  38. package/src/FileList/FileList.tsx +17 -20
  39. package/src/FileList/Format.tsx +75 -0
  40. package/src/FileList/index.ts +1 -0
  41. package/src/LicenseByline/EmbedByline.tsx +2 -1
  42. package/src/Navigation/NavigationBox.tsx +76 -104
  43. package/src/ResourceGroup/ResourceItem.tsx +2 -2
  44. package/src/SearchTypeResult/components/ItemContexts.tsx +5 -1
  45. package/src/Topic/Topic.tsx +26 -39
  46. package/src/all.scss +0 -1
  47. package/src/index.ts +1 -1
  48. package/src/locale/messages-en.ts +1 -1
  49. package/src/locale/messages-nb.ts +1 -1
  50. package/src/locale/messages-nn.ts +1 -1
  51. package/src/locale/messages-sma.ts +1 -1
@@ -102,7 +102,11 @@ const ItemContexts = ({ contexts, id, title }: ItemContextsType) => {
102
102
  <ContextListItem key={context.url}>
103
103
  <SafeLink to={context.url}>{title}</SafeLink>
104
104
  <Breadcrumb breadcrumb={context.breadcrumb}>
105
- {context.isAdditional ? <Additional style={iconStyle} /> : <Core style={iconStyle} />}
105
+ {context.isAdditional ? (
106
+ <Additional style={iconStyle} color={colors.brand.dark} />
107
+ ) : (
108
+ <Core style={iconStyle} color={colors.brand.primary} />
109
+ )}
106
110
  </Breadcrumb>
107
111
  </ContextListItem>
108
112
  ))}
@@ -11,10 +11,9 @@ import { useTranslation } from 'react-i18next';
11
11
  import { css } from '@emotion/react';
12
12
  import styled from '@emotion/styled';
13
13
  import { ButtonV2 } from '@ndla/button';
14
- import { animations, breakpoints, colors, mq, spacing } from '@ndla/core';
14
+ import { animations, breakpoints, colors, misc, mq, spacing } from '@ndla/core';
15
15
  import { CursorClick, ExpandTwoArrows } from '@ndla/icons/action';
16
- import { ChevronDown, ChevronUp, PlayCircleFilled } from '@ndla/icons/common';
17
-
16
+ import { Additional, ChevronDown, ChevronUp, PlayCircleFilled } from '@ndla/icons/common';
18
17
  import { ModalCloseButton, ModalContent, Modal, ModalHeader, ModalTrigger } from '@ndla/modal';
19
18
  import { EmbedMetaData } from '@ndla/types-embed';
20
19
  import { Text, Heading } from '@ndla/typography';
@@ -25,10 +24,6 @@ import { MessageBox } from '../Messages';
25
24
  import { NavigationBox } from '../Navigation';
26
25
  import { ItemProps } from '../Navigation/NavigationBox';
27
26
 
28
- type InvertItProps = {
29
- invertedStyle?: boolean;
30
- };
31
-
32
27
  const Wrapper = styled.div`
33
28
  display: flex;
34
29
  flex-direction: column;
@@ -67,7 +62,7 @@ const TopicHeaderVisualElementWrapper = styled.div`
67
62
  `;
68
63
 
69
64
  const ShowVisualElementWrapper = styled.div`
70
- border-radius: 50%;
65
+ border-radius: ${misc.borderRadiusLarge};
71
66
  width: 100%;
72
67
  height: 100%;
73
68
  overflow: hidden;
@@ -83,7 +78,7 @@ const VisualElementButton = styled(ButtonV2)`
83
78
  `;
84
79
 
85
80
  const TopicHeaderImage = styled.img`
86
- border-radius: 50%;
81
+ border-radius: ${misc.borderRadiusLarge};
87
82
  aspect-ratio: 1;
88
83
  width: 100%;
89
84
  height: 100%;
@@ -121,7 +116,7 @@ const TopicHeaderOverlay = styled.div`
121
116
  left: 0;
122
117
  bottom: 0;
123
118
  right: 0;
124
- border-radius: 50%;
119
+ border-radius: ${misc.borderRadiusLarge};
125
120
  transition: opacity ${animations.durations.fast};
126
121
  ${VisualElementButton}:hover & {
127
122
  opacity: 0.1;
@@ -144,37 +139,33 @@ const HeadingWrapper = styled.hgroup`
144
139
  }
145
140
  `;
146
141
 
147
- const StyledButtonWrapper = styled.div<InvertItProps>`
142
+ const StyledButtonWrapper = styled.div`
148
143
  margin-top: ${spacing.small};
149
144
  padding: ${spacing.xsmall} 0 ${spacing.xsmall} ${spacing.medium};
150
- border-left: 6px solid ${colors.brand.light};
151
- ${(props) =>
152
- props.invertedStyle &&
153
- css`
154
- button {
155
- color: #fff;
156
- &:hover,
157
- &:focus {
158
- color: #fff;
159
- }
145
+ border-left: ${spacing.xsmall} solid ${colors.brand.light};
146
+ &[data-inverted='true'] {
147
+ button {
148
+ color: ${colors.white};
149
+ &:hover,
150
+ &:focus {
151
+ color: ${colors.white};
160
152
  }
161
- `}
153
+ }
154
+ }
162
155
  `;
163
156
 
164
- const AdditionalIcon = styled.span`
157
+ const StyledAdditional = styled(Additional)`
158
+ color: ${colors.brand.dark};
159
+ height: ${spacing.normal};
160
+ width: ${spacing.normal};
165
161
  padding: 1px;
166
- border: 1px solid currentColor;
167
- border-radius: 100%;
168
- font-size: 15px;
169
- width: 25px;
170
- text-align: center;
171
162
  `;
172
163
 
173
- const StyledContentWrapper = styled.div<InvertItProps>`
174
- padding-top: ${spacing.normal};
175
- border-left: 6px solid ${colors.brand.light};
176
- color: ${colors.text.primary};
164
+ const StyledContentWrapper = styled.div`
177
165
  background-color: ${colors.white};
166
+ border-left: ${spacing.xsmall} solid ${colors.brand.light};
167
+ color: ${colors.text.primary};
168
+ padding-top: ${spacing.normal};
178
169
  `;
179
170
 
180
171
  const StyledModalHeader = styled(ModalHeader)`
@@ -268,7 +259,7 @@ const Topic = ({
268
259
  </Heading>
269
260
  {isAdditionalTopic && (
270
261
  <>
271
- <AdditionalIcon aria-hidden="true">T</AdditionalIcon>
262
+ <StyledAdditional aria-hidden="true" />
272
263
  <span>{t('navigation.additionalTopic')}</span>
273
264
  </>
274
265
  )}
@@ -320,7 +311,7 @@ const Topic = ({
320
311
  {messageBox && <MessageBox>{messageBox}</MessageBox>}
321
312
  <div>
322
313
  {onToggleShowContent && (
323
- <StyledButtonWrapper invertedStyle={invertedStyle}>
314
+ <StyledButtonWrapper data-inverted={invertedStyle}>
324
315
  <ButtonV2
325
316
  aria-expanded={!!showContent}
326
317
  aria-controls={contentId}
@@ -339,11 +330,7 @@ const Topic = ({
339
330
  </ButtonV2>
340
331
  </StyledButtonWrapper>
341
332
  )}
342
- {showContent && (
343
- <StyledContentWrapper id={contentId} invertedStyle={invertedStyle}>
344
- {children}
345
- </StyledContentWrapper>
346
- )}
333
+ {showContent && <StyledContentWrapper id={contentId}>{children}</StyledContentWrapper>}
347
334
  </div>
348
335
  {subTopics && subTopics.length !== 0 && (
349
336
  <NavigationBox
package/src/all.scss CHANGED
@@ -2,4 +2,3 @@
2
2
  @import '~@ndla/icons/scss/icons';
3
3
  @import './main';
4
4
  @import '~@ndla/core/scss/utilities';
5
- @import '~@ndla/video-search/scss/video-search';
package/src/index.ts CHANGED
@@ -56,7 +56,7 @@ export { default as RelatedArticleList, RelatedArticle } from './RelatedArticleL
56
56
 
57
57
  export { ErrorResourceAccessDenied, default as ErrorMessage } from './ErrorMessage';
58
58
 
59
- export { default as FileList, File, PdfFile } from './FileList';
59
+ export { default as FileList, File, PdfFile, Format } from './FileList';
60
60
 
61
61
  export { default as Logo } from './Logo';
62
62
 
@@ -1143,7 +1143,7 @@ const messages = {
1143
1143
  recentArenaTopics: 'New posts in the arena',
1144
1144
  },
1145
1145
  myProfile: {
1146
- title: 'My Profile',
1146
+ title: 'My profile',
1147
1147
  disclaimerTitle: { employee: 'Where is my name used?', student: 'Where is my name used?' },
1148
1148
  disclaimerText: {
1149
1149
  employee:
@@ -1141,7 +1141,7 @@ const messages = {
1141
1141
  recentArenaTopics: 'Nye innlegg i arenaen',
1142
1142
  },
1143
1143
  myProfile: {
1144
- title: 'Min Profil',
1144
+ title: 'Min profil',
1145
1145
  disclaimerTitle: {
1146
1146
  employee: 'Hvor brukes navnet mitt?',
1147
1147
  student: 'Hvor brukes navnet mitt?',
@@ -1141,7 +1141,7 @@ const messages = {
1141
1141
  recentArenaTopics: 'Nye innlegg i arenaen',
1142
1142
  },
1143
1143
  myProfile: {
1144
- title: 'Min Profil',
1144
+ title: 'Min profil',
1145
1145
  disclaimerTitle: {
1146
1146
  employee: 'Kvar blir namnet mitt brukt?',
1147
1147
  student: 'Kvar blir namnet mitt brukt?',
@@ -1146,7 +1146,7 @@ const messages = {
1146
1146
  recentArenaTopics: 'Nye innlegg i arenaen',
1147
1147
  },
1148
1148
  myProfile: {
1149
- title: 'Mov Profijle',
1149
+ title: 'Mov profijle',
1150
1150
  disclaimerTitle: { employee: 'Gusnie mov nomme?', student: 'Gusnie mov nomme?' },
1151
1151
  disclaimerText: {
1152
1152
  employee: