@ndla/ui 30.7.1 → 30.8.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.
@@ -6,13 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- // N.B These component is used to render static markup serverside
9
+ // N.B These components is used to render static markup serverside
10
10
  // Any interactivty is added by scripts located in the ndla-article-scripts package
11
11
 
12
12
  import React, { ReactNode } from 'react';
13
13
  import BEMHelper from 'react-bem-helper';
14
14
  import { isFunction as isFunctionHelper, parseMarkdown } from '@ndla/util';
15
- import { useTranslation } from 'react-i18next';
16
15
  import { Link as LinkIcon } from '@ndla/icons/common';
17
16
  import { LicenseByline } from '@ndla/licenses';
18
17
  import SafeLink from '@ndla/safelink';
@@ -36,9 +35,8 @@ export const FigureCaption = ({
36
35
  hideFigcaption,
37
36
  hasLinkedVideo,
38
37
  hideIconsAndAuthors,
38
+ linkedVideoMessages,
39
39
  }: FigureCaptionProps) => {
40
- const { t } = useTranslation();
41
-
42
40
  return (
43
41
  <figcaption {...classes('caption', hideFigcaption && !isMobile ? 'hidden-caption' : undefined)}>
44
42
  {caption ? <div {...classes('info')}>{parseMarkdown(caption)}</div> : null}
@@ -66,8 +64,8 @@ export const FigureCaption = ({
66
64
  size="small"
67
65
  type="button"
68
66
  {...classes('toggleAlternativeVideo')}>
69
- <span className="original">{t('figure.button.alternative')}</span>
70
- <span className="alternative hidden">{t('figure.button.original')}</span>
67
+ <span className="original">{linkedVideoMessages?.alternative}</span>
68
+ <span className="alternative hidden">{linkedVideoMessages?.original}</span>
71
69
  </Button>
72
70
  )}
73
71
  </div>
@@ -122,6 +120,10 @@ interface FigureCaptionProps {
122
120
  hideFigcaption?: boolean;
123
121
  hasLinkedVideo?: boolean;
124
122
  hideIconsAndAuthors?: boolean;
123
+ linkedVideoMessages?: {
124
+ original: string;
125
+ alternative: string;
126
+ };
125
127
  }
126
128
 
127
129
  const Figure = ({ children, type = 'full', resizeIframe, ...rest }: Props) => {
@@ -99,15 +99,18 @@ const FolderTitle = styled.h2`
99
99
  }
100
100
  `;
101
101
 
102
- const MenuWrapper = styled.div`
102
+ interface MenuWrapperProps {
103
+ hasMenuButton: boolean;
104
+ }
105
+
106
+ const MenuWrapper = styled.div<MenuWrapperProps>`
103
107
  overflow: hidden;
104
108
  display: flex;
105
109
  flex-direction: row;
106
110
  align-items: center;
107
111
  gap: ${spacing.xsmall};
108
112
  justify-content: space-between;
109
- margin: -${spacing.nsmall};
110
- margin-left: 0;
113
+ margin: -${spacing.nsmall} -${(props) => (props.hasMenuButton ? spacing.nsmall : 0)} -${spacing.nsmall} 0;
111
114
  `;
112
115
 
113
116
  const CountContainer = styled.div`
@@ -185,7 +188,7 @@ const Folder = ({ id, link, title, subFolders, subResources, type = 'list', menu
185
188
  <FolderTitle title={title}>{title}</FolderTitle>
186
189
  </StyledLink>
187
190
  </TitleWrapper>
188
- <MenuWrapper>
191
+ <MenuWrapper hasMenuButton={!!menuItems?.length}>
189
192
  <CountContainer>
190
193
  <Count layoutType={type} type={'folder'} count={subFolders} />
191
194
  <Count layoutType={type} type={'resource'} count={subResources} />
@@ -55,6 +55,7 @@ const StyledTagListElement = styled.li`
55
55
 
56
56
  const StyledSafeLink = styled(SafeLink)`
57
57
  display: flex;
58
+ justify-content: flex-end;
58
59
  align-items: center;
59
60
  box-shadow: none;
60
61
  color: ${colors.brand.grey};
@@ -1093,6 +1093,7 @@ const messages = {
1093
1093
  alreadyFavourited: 'Already in my favourites',
1094
1094
  alreadyInFolder: 'Already in folder. You can still save new tags.',
1095
1095
  noFolderSelected: 'Select or create a new folder to save the resource.',
1096
+ examLockInfo: 'Editing content on Min NDLA is deactivated for pupils during the exam period.',
1096
1097
  help: 'Help',
1097
1098
  more: 'More options',
1098
1099
  listView: 'List view',
@@ -1091,6 +1091,7 @@ const messages = {
1091
1091
  alreadyFavourited: 'Allerede lagt til i mine favoritter',
1092
1092
  alreadyInFolder: 'Finnes allerede i mappen. Du kan fortsatt lagre nye emneknagger.',
1093
1093
  noFolderSelected: 'Velg eller opprett ny mappe for å lagre ressursen',
1094
+ examLockInfo: 'Redigering av innhold på Min NDLA er deaktivert for elever i eksamensperioden.',
1094
1095
  help: 'Hjelp',
1095
1096
  more: 'Flere valg',
1096
1097
  listView: 'Listevisning',
@@ -1092,6 +1092,7 @@ const messages = {
1092
1092
  alreadyFavourited: 'Allereie lagt til i mine favorittar',
1093
1093
  alreadyInFolder: 'Finst allereie i mappa. Du kan fortsatt lagre nye emneknaggar.',
1094
1094
  noFolderSelected: 'Velg eller opprett ny mappe for å lagre ressursen',
1095
+ examLockInfo: 'Redigering av innhald på Min NDLA er deaktivert for elevar i eksamensperioden.',
1095
1096
  help: 'Hjelp',
1096
1097
  more: 'Fleire val',
1097
1098
  listView: 'Listevisning',
@@ -1092,6 +1092,7 @@ const messages = {
1092
1092
  alreadyFavourited: 'Lea juo biddjon oiddohin',
1093
1093
  alreadyInFolder: 'Gávdno juo máhpas. Sáhtát ain vurket ođđa fáddágilkoriid.',
1094
1094
  noFolderSelected: 'Vállje dahje ráhkat ođđa máhpa vai seasttát resurssa',
1095
+ examLockInfo: 'Mu NDLA redigeren ii leat doaimmas ohppiide eksámenáigodagas.',
1095
1096
  help: 'Veahkki',
1096
1097
  more: 'Eanet válljejumit',
1097
1098
  listView: 'Oppalašlistu',
@@ -1093,6 +1093,7 @@ const messages = {
1093
1093
  alreadyFavourited: 'Allerede lagt til i mine favoritter',
1094
1094
  alreadyInFolder: 'Finnes allerede i mappen. Du kan fortsatt lagre nye emneknagger.',
1095
1095
  noFolderSelected: 'Velg eller opprett ny mappe for å lagre ressursen',
1096
+ examLockInfo: 'Redigering av innhold på Min NDLA er deaktivert for elever i eksamensperioden.',
1096
1097
  help: 'Hjelp',
1097
1098
  more: 'Flere valg',
1098
1099
  listView: 'Listevisning',