@ndla/ui 50.9.21 → 50.10.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 (52) hide show
  1. package/es/Embed/CopyrightEmbed.js +41 -0
  2. package/es/Embed/index.js +2 -1
  3. package/es/Gloss/Gloss.js +10 -10
  4. package/es/Gloss/GlossExample.js +10 -5
  5. package/es/Layout/LayoutItem.js +15 -32
  6. package/es/LicenseByline/EmbedByline.js +5 -5
  7. package/es/all.css +1 -1
  8. package/es/index.js +1 -1
  9. package/es/locale/messages-en.js +3 -1
  10. package/es/locale/messages-nb.js +3 -1
  11. package/es/locale/messages-nn.js +4 -2
  12. package/es/locale/messages-se.js +3 -1
  13. package/es/locale/messages-sma.js +3 -1
  14. package/lib/Embed/CopyrightEmbed.d.ts +15 -0
  15. package/lib/Embed/CopyrightEmbed.js +45 -0
  16. package/lib/Embed/index.d.ts +1 -0
  17. package/lib/Embed/index.js +7 -0
  18. package/lib/Gloss/Gloss.js +10 -10
  19. package/lib/Gloss/GlossExample.d.ts +2 -2
  20. package/lib/Gloss/GlossExample.js +10 -5
  21. package/lib/Layout/LayoutItem.d.ts +1 -1
  22. package/lib/Layout/LayoutItem.js +14 -31
  23. package/lib/LicenseByline/EmbedByline.d.ts +6 -1
  24. package/lib/LicenseByline/EmbedByline.js +5 -5
  25. package/lib/all.css +1 -1
  26. package/lib/index.d.ts +1 -1
  27. package/lib/index.js +6 -0
  28. package/lib/locale/messages-en.d.ts +2 -0
  29. package/lib/locale/messages-en.js +3 -1
  30. package/lib/locale/messages-nb.d.ts +2 -0
  31. package/lib/locale/messages-nb.js +3 -1
  32. package/lib/locale/messages-nn.d.ts +2 -0
  33. package/lib/locale/messages-nn.js +4 -2
  34. package/lib/locale/messages-se.d.ts +2 -0
  35. package/lib/locale/messages-se.js +3 -1
  36. package/lib/locale/messages-sma.d.ts +2 -0
  37. package/lib/locale/messages-sma.js +3 -1
  38. package/package.json +18 -18
  39. package/src/Embed/CopyrightEmbed.tsx +37 -0
  40. package/src/Embed/index.ts +1 -0
  41. package/src/FramedContent/FramedContent.stories.tsx +47 -0
  42. package/src/Gloss/Gloss.stories.tsx +13 -0
  43. package/src/Gloss/Gloss.tsx +5 -5
  44. package/src/Gloss/GlossExample.tsx +30 -14
  45. package/src/Layout/LayoutItem.tsx +15 -23
  46. package/src/LicenseByline/EmbedByline.tsx +13 -1
  47. package/src/index.ts +1 -0
  48. package/src/locale/messages-en.ts +2 -0
  49. package/src/locale/messages-nb.ts +2 -0
  50. package/src/locale/messages-nn.ts +2 -0
  51. package/src/locale/messages-se.ts +2 -0
  52. package/src/locale/messages-sma.ts +2 -0
package/lib/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  export { ExpandableBox, ExpandableBoxSummary } from "./ExpandableBox";
9
9
  export { default as FramedContent } from "./FramedContent";
10
- export { ConceptNotionV2, ImageEmbed, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, ConceptListEmbed, UnknownEmbed, InlineConcept, BlockConcept, UuDisclaimerEmbed, } from "./Embed";
10
+ export { ConceptNotionV2, ImageEmbed, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, ConceptListEmbed, UnknownEmbed, InlineConcept, BlockConcept, UuDisclaimerEmbed, CopyrightEmbed, } from "./Embed";
11
11
  export { LicenseLink } from "./LicenseByline";
12
12
  export { ArticleByline, ArticleFootNotes, ArticleIntroduction, ArticleTitle, ArticleWrapper, ArticleHeaderWrapper, default as Article, } from "./Article";
13
13
  export { getPossiblyRelativeUrl } from "./utils/relativeUrl";
package/lib/index.js CHANGED
@@ -207,6 +207,12 @@ Object.defineProperty(exports, "CopyParagraphButton", {
207
207
  return _CopyParagraphButton.default;
208
208
  }
209
209
  });
210
+ Object.defineProperty(exports, "CopyrightEmbed", {
211
+ enumerable: true,
212
+ get: function () {
213
+ return _Embed.CopyrightEmbed;
214
+ }
215
+ });
210
216
  Object.defineProperty(exports, "CreatedBy", {
211
217
  enumerable: true,
212
218
  get: function () {
@@ -434,6 +434,7 @@ declare const messages: {
434
434
  description: string;
435
435
  rules: string;
436
436
  title: string;
437
+ showOrHideExamples: string;
437
438
  embedlink: {
438
439
  heading: string;
439
440
  description: string;
@@ -1314,6 +1315,7 @@ declare const messages: {
1314
1315
  h5p: string;
1315
1316
  external: string;
1316
1317
  gloss: string;
1318
+ copyright: string;
1317
1319
  };
1318
1320
  };
1319
1321
  gloss: {
@@ -453,6 +453,7 @@ const messages = {
453
453
  description: "Remember that built-in content might have a different license than the gloss text",
454
454
  rules: "Rules for use of gloss:",
455
455
  title: "Title",
456
+ showOrHideExamples: "Show or hide examples",
456
457
  embedlink: {
457
458
  heading: "How to show the gloss in other content",
458
459
  description: "This url shows the gloss without menu and footer",
@@ -1332,7 +1333,8 @@ const messages = {
1332
1333
  concept: "Concept",
1333
1334
  h5p: "H5P",
1334
1335
  external: "External resource",
1335
- gloss: "Gloss"
1336
+ gloss: "Gloss",
1337
+ copyright: "Text"
1336
1338
  }
1337
1339
  },
1338
1340
  gloss: {
@@ -449,6 +449,7 @@ declare const messages: {
449
449
  description: string;
450
450
  rules: string;
451
451
  title: string;
452
+ showOrHideExamples: string;
452
453
  embedlink: {
453
454
  heading: string;
454
455
  description: string;
@@ -1314,6 +1315,7 @@ declare const messages: {
1314
1315
  h5p: string;
1315
1316
  external: string;
1316
1317
  gloss: string;
1318
+ copyright: string;
1317
1319
  };
1318
1320
  };
1319
1321
  gloss: {
@@ -468,6 +468,7 @@ const messages = {
468
468
  description: "Husk at innebygd innhold i en glose kan ha en annen lisens enn selve gloseteksten",
469
469
  rules: "Regler for bruk av glose:",
470
470
  title: "Tittel",
471
+ showOrHideExamples: "Vis eller skjul eksempler",
471
472
  embedlink: {
472
473
  heading: "Slik viser du glosen i annet innhold",
473
474
  description: "Denne lenken viser glosen uten kontekst (meny og bunntekst)",
@@ -1332,7 +1333,8 @@ const messages = {
1332
1333
  concept: "Forklaring",
1333
1334
  h5p: "H5P",
1334
1335
  external: "Ekstern ressurs",
1335
- gloss: "Glose"
1336
+ gloss: "Glose",
1337
+ copyright: "Tekst"
1336
1338
  }
1337
1339
  },
1338
1340
  gloss: {
@@ -455,6 +455,7 @@ declare const messages: {
455
455
  description: string;
456
456
  rules: string;
457
457
  title: string;
458
+ showOrHideExamples: string;
458
459
  };
459
460
  files: {
460
461
  heading: string;
@@ -1314,6 +1315,7 @@ declare const messages: {
1314
1315
  h5p: string;
1315
1316
  external: string;
1316
1317
  gloss: string;
1318
+ copyright: string;
1317
1319
  };
1318
1320
  };
1319
1321
  gloss: {
@@ -473,7 +473,8 @@ const messages = {
473
473
  heading: "Slik gjenbruker du gloser",
474
474
  description: "Husk at innebygd innhald i ei glose kan ha ein anna lisens enn sjølve gloseteksten",
475
475
  rules: "Regler for bruk av glose:",
476
- title: "Tittel"
476
+ title: "Tittel",
477
+ showOrHideExamples: "Vis eller skjul eksempler"
477
478
  },
478
479
  files: {
479
480
  heading: "Slik gjenbruker du filer",
@@ -1332,7 +1333,8 @@ const messages = {
1332
1333
  concept: "Forklaring",
1333
1334
  h5p: "H5P",
1334
1335
  external: "Ekstern ressurs",
1335
- gloss: "Glose"
1336
+ gloss: "Glose",
1337
+ copyright: "Tekst"
1336
1338
  }
1337
1339
  },
1338
1340
  gloss: {
@@ -449,6 +449,7 @@ declare const messages: {
449
449
  description: string;
450
450
  rules: string;
451
451
  title: string;
452
+ showOrHideExamples: string;
452
453
  embedlink: {
453
454
  heading: string;
454
455
  description: string;
@@ -1314,6 +1315,7 @@ declare const messages: {
1314
1315
  h5p: string;
1315
1316
  external: string;
1316
1317
  gloss: string;
1318
+ copyright: string;
1317
1319
  };
1318
1320
  };
1319
1321
  gloss: {
@@ -468,6 +468,7 @@ const messages = {
468
468
  description: "Muitte ahte sisdoalus mii lea vuojuhuvvon ovtta gihppagii sáhttá leat eará liseansa go dušše jietnadat.",
469
469
  rules: "Glossa geavaheami njuolggadusat:",
470
470
  title: "Namahus",
471
+ showOrHideExamples: "Čájet dahje čiega ovdamearkkaid",
471
472
  embedlink: {
472
473
  heading: "Čájet jietnadaga eará sisdoaluin",
473
474
  description: "Dát liŋka čájeha teavstta konteavstta haga (fállu ja juolgeteaksta)",
@@ -1332,7 +1333,8 @@ const messages = {
1332
1333
  concept: "Čilgehus",
1333
1334
  h5p: "H5P",
1334
1335
  external: "Olgguldas resursa",
1335
- gloss: "Glose"
1336
+ gloss: "Glose",
1337
+ copyright: "Tekst"
1336
1338
  }
1337
1339
  },
1338
1340
  gloss: {
@@ -449,6 +449,7 @@ declare const messages: {
449
449
  description: string;
450
450
  rules: string;
451
451
  title: string;
452
+ showOrHideExamples: string;
452
453
  embedlink: {
453
454
  heading: string;
454
455
  description: string;
@@ -1314,6 +1315,7 @@ declare const messages: {
1314
1315
  h5p: string;
1315
1316
  external: string;
1316
1317
  gloss: string;
1318
+ copyright: string;
1317
1319
  };
1318
1320
  };
1319
1321
  gloss: {
@@ -468,6 +468,7 @@ const messages = {
468
468
  description: "Mujhtieh sisvege aktene raajesisnie maahta jeatjah lisensem utnedh enn jïjtjehke raajesisnie",
469
469
  rules: "Njoelkedassh guktie diejvesem nåhtadidh:",
470
470
  title: "Tihtele",
471
+ showOrHideExamples: "Vuesiehtimmieh vuesiehtidh jallh vöörhkedh",
471
472
  embedlink: {
472
473
  heading: "Naemhtie gïelem jeatjah sisvegisnie vuesehte",
473
474
  description: "Daate lïenghke vuesehte tjoejh konteksten namhtah (meny jïh nueliekapihtele)",
@@ -1332,7 +1333,8 @@ const messages = {
1332
1333
  concept: "Forklaring",
1333
1334
  h5p: "H5P",
1334
1335
  external: "Ekstern ressurs",
1335
- gloss: "Glosa"
1336
+ gloss: "Glosa",
1337
+ copyright: "Tekst"
1336
1338
  }
1337
1339
  },
1338
1340
  gloss: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "50.9.21",
3
+ "version": "50.10.0",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,23 +31,23 @@
31
31
  "types"
32
32
  ],
33
33
  "dependencies": {
34
- "@ndla/accordion": "^3.0.30",
35
- "@ndla/button": "^12.0.34",
36
- "@ndla/carousel": "^4.0.32",
37
- "@ndla/core": "^4.4.1",
38
- "@ndla/dropdown-menu": "^1.0.29",
39
- "@ndla/forms": "^7.0.1",
34
+ "@ndla/accordion": "^3.0.31",
35
+ "@ndla/button": "^12.0.35",
36
+ "@ndla/carousel": "^4.0.33",
37
+ "@ndla/core": "^4.4.2",
38
+ "@ndla/dropdown-menu": "^1.0.30",
39
+ "@ndla/forms": "^7.0.2",
40
40
  "@ndla/hooks": "^2.1.5",
41
- "@ndla/icons": "^5.0.11",
41
+ "@ndla/icons": "^5.0.12",
42
42
  "@ndla/licenses": "^7.2.5",
43
- "@ndla/modal": "^5.0.31",
44
- "@ndla/notion": "^6.0.32",
45
- "@ndla/safelink": "^4.1.59",
46
- "@ndla/select": "^3.3.6",
47
- "@ndla/switch": "^1.1.35",
48
- "@ndla/tabs": "^3.2.15",
49
- "@ndla/tooltip": "^6.0.18",
50
- "@ndla/typography": "^0.4.12",
43
+ "@ndla/modal": "^5.0.32",
44
+ "@ndla/notion": "^6.0.33",
45
+ "@ndla/safelink": "^4.1.60",
46
+ "@ndla/select": "^3.3.7",
47
+ "@ndla/switch": "^1.1.36",
48
+ "@ndla/tabs": "^3.2.16",
49
+ "@ndla/tooltip": "^6.0.19",
50
+ "@ndla/typography": "^0.4.13",
51
51
  "@ndla/util": "^4.0.4",
52
52
  "@radix-ui/react-popover": "^1.0.7",
53
53
  "@radix-ui/react-slider": "^1.1.2",
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "devDependencies": {
73
73
  "@ndla/types-backend": "^0.2.21",
74
- "@ndla/types-embed": "^4.0.19",
74
+ "@ndla/types-embed": "^4.1.0",
75
75
  "css-loader": "^6.7.3",
76
76
  "mini-css-extract-plugin": "^2.7.5",
77
77
  "sass-loader": "^13.2.2",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "a989d47056d7398c88ac9c74c2efbde7c1418a0c"
84
+ "gitHead": "2fa7b0716612592b98ab1a73f9cd2f86fd6fd251"
85
85
  }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright (c) 2024-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 { ReactNode } from "react";
10
+ import styled from "@emotion/styled";
11
+ import { CopyrightMetaData } from "@ndla/types-embed";
12
+ import { EmbedByline } from "../LicenseByline";
13
+
14
+ interface Props {
15
+ embed: CopyrightMetaData;
16
+ children?: ReactNode;
17
+ }
18
+
19
+ const StyledFigCaption = styled.figcaption`
20
+ background: unset;
21
+ font-size: unset;
22
+ padding: unset;
23
+ color: unset;
24
+ `;
25
+
26
+ const CopyrightEmbed = ({ embed, children }: Props) => {
27
+ return (
28
+ <figure>
29
+ {children}
30
+ <StyledFigCaption>
31
+ <EmbedByline type="copyright" copyright={embed.embedData.copyright} bottomRounded />
32
+ </StyledFigCaption>
33
+ </figure>
34
+ );
35
+ };
36
+
37
+ export default CopyrightEmbed;
@@ -21,4 +21,5 @@ export { default as ConceptListEmbed } from "./ConceptListEmbed";
21
21
  export { default as UnknownEmbed } from "./UnknownEmbed";
22
22
  export { InlineConcept, BlockConcept } from "./ConceptEmbed";
23
23
  export { default as UuDisclaimerEmbed } from "./UuDisclaimerEmbed";
24
+ export { default as CopyrightEmbed } from "./CopyrightEmbed";
24
25
  export type { HeartButtonType, CanonicalUrlFuncs, RenderContext } from "./types";
@@ -7,9 +7,11 @@
7
7
  */
8
8
 
9
9
  import { Meta, StoryObj } from "@storybook/react";
10
+ import { CopyrightMetaData } from "@ndla/types-embed";
10
11
  import FramedContent from "./FramedContent";
11
12
  import FigureImage from "../../../../stories/article/FigureImage";
12
13
  import { defaultParameters } from "../../../../stories/defaults";
14
+ import { CopyrightEmbed } from "../Embed";
13
15
 
14
16
  export default {
15
17
  title: "Components/FramedContent",
@@ -86,3 +88,48 @@ export const TooMuchContent: StoryObj<typeof FramedContent> = {
86
88
  ),
87
89
  },
88
90
  };
91
+
92
+ const copyrightEmbed: CopyrightMetaData = {
93
+ resource: "copyright",
94
+ status: "success",
95
+ data: undefined,
96
+ embedData: {
97
+ resource: "copyright",
98
+ title: "Hallo",
99
+ copyright: {
100
+ license: {
101
+ license: "CC-BY-SA-4.0",
102
+ description: "Creative Commons Attribution-ShareAlike 4.0 International",
103
+ url: "https://creativecommons.org/licenses/by-sa/4.0/",
104
+ },
105
+ creators: [
106
+ {
107
+ type: "originator",
108
+ name: "Camilla Øvstebø ",
109
+ },
110
+ ],
111
+ processors: [
112
+ {
113
+ type: "linguistic",
114
+ name: "Totaltekst",
115
+ },
116
+ ],
117
+ rightsholders: [],
118
+ processed: false,
119
+ },
120
+ },
121
+ };
122
+
123
+ export const WithCopyrightEmbed: StoryObj<typeof FramedContent> = {
124
+ args: {
125
+ children: (
126
+ <>
127
+ <h2>Her har du helt vanlig innhold</h2>
128
+ <p>Det kan som sagt være hva som helst.</p>
129
+ <CopyrightEmbed embed={copyrightEmbed}>
130
+ <p>Dette er innhold som er i en copyright-embed.</p>
131
+ </CopyrightEmbed>
132
+ </>
133
+ ),
134
+ },
135
+ };
@@ -8,6 +8,7 @@
8
8
 
9
9
  import { Meta, StoryObj, StoryFn } from "@storybook/react";
10
10
  import Gloss from "./Gloss";
11
+ import GlossExample from "./GlossExample";
11
12
  import { defaultParameters } from "../../../../stories/defaults";
12
13
  import { wordClass } from "../model/WordClass";
13
14
 
@@ -105,3 +106,15 @@ export const GlossChineseStory: StoryObj<typeof Gloss> = {
105
106
  },
106
107
  },
107
108
  };
109
+
110
+ const GlossExampleText = {
111
+ example: "我叫马红",
112
+ language: "zh",
113
+ transcriptions: {
114
+ pinyin: "wo jiao ma hong",
115
+ },
116
+ };
117
+
118
+ export const GlossExampleStory: StoryFn<typeof Gloss> = () => {
119
+ return <GlossExample originalLanguage="zh" index={0} example={GlossExampleText} isStandalone />;
120
+ };
@@ -41,6 +41,10 @@ const Wrapper = styled.div`
41
41
  flex-wrap: wrap;
42
42
  justify-content: space-between;
43
43
  padding: ${spacing.nsmall} ${spacing.normal} 0 ${spacing.normal};
44
+ span {
45
+ ${fonts.size.text.content}
46
+ font-family: ${fonts.sans};
47
+ }
44
48
  `;
45
49
 
46
50
  const GlossContainer = styled.div`
@@ -48,9 +52,6 @@ const GlossContainer = styled.div`
48
52
  align-items: center;
49
53
  flex-wrap: wrap;
50
54
  gap: ${spacing.nsmall};
51
- span {
52
- ${fonts.size.text.metaText.small};
53
- }
54
55
  span[data-pinyin] {
55
56
  font-style: italic;
56
57
  }
@@ -168,7 +169,7 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs }: Props) =>
168
169
  <>
169
170
  <StyledWrapper>
170
171
  <span lang={title.language}>{title.title}</span>
171
- <StyledTrigger data-styled-trigger>
172
+ <StyledTrigger data-styled-trigger aria-label={t("gloss.examples")}>
172
173
  <StyledChevron />
173
174
  </StyledTrigger>
174
175
  </StyledWrapper>
@@ -181,7 +182,6 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs }: Props) =>
181
182
  example={example}
182
183
  originalLanguage={glossData.originalLanguage}
183
184
  index={innerIndex}
184
- lastExampleIndex={examples.length - 1}
185
185
  />
186
186
  ))}
187
187
  </div>
@@ -15,30 +15,42 @@ export interface Props {
15
15
  example: IGlossExample;
16
16
  originalLanguage: string | undefined;
17
17
  index: number;
18
- lastExampleIndex: number;
18
+ isStandalone?: boolean;
19
19
  }
20
20
 
21
21
  const StyledGlossExampleWrapper = styled.div`
22
- &:first-of-type {
22
+ &[data-is-standalone="true"] {
23
+ &:first-of-type {
24
+ border-top: 1px solid ${colors.brand.lighter};
25
+ }
26
+ }
27
+
28
+ &:first-of-type&:not([data-is-standalone="true"]) {
23
29
  border-top: 1px solid ${colors.brand.primary};
24
30
  }
25
- &:last-of-type {
26
- border-radius: ${misc.borderRadius};
31
+
32
+ &[data-is-standalone="false"] {
33
+ &:not(:last-child) {
34
+ div {
35
+ border-bottom: 1px solid ${colors.brand.lighter};
36
+ border-radius: 0;
37
+ }
38
+ }
27
39
  }
28
- background-color: ${colors.background.default};
29
40
  `;
30
41
 
31
42
  const StyledGlossExample = styled.div`
32
43
  padding: ${spacing.small} ${spacing.normal};
33
- border-bottom: 1px solid ${colors.brand.lighter};
34
44
  background-color: ${colors.background.default};
45
+ border: 1px solid ${colors.brand.lighter};
46
+ border-top: none;
47
+
35
48
  &[data-is-first="true"] {
36
49
  background-color: ${colors.background.lightBlue};
37
- border-radius: 0px;
38
50
  }
39
- &[data-is-last="true"] {
51
+ &[data-is-standalone="false"] {
52
+ border: none;
40
53
  border-radius: ${misc.borderRadius};
41
- border-bottom: none;
42
54
  }
43
55
  `;
44
56
 
@@ -52,23 +64,27 @@ const StyledText = styled(Text)`
52
64
  }
53
65
  `;
54
66
 
55
- const GlossExample = ({ example, originalLanguage, index, lastExampleIndex }: Props) => {
67
+ const GlossExample = ({ example, originalLanguage, index, isStandalone = false }: Props) => {
56
68
  return (
57
- <StyledGlossExampleWrapper>
58
- <StyledGlossExample data-is-first={index === 0} data-is-last={index === lastExampleIndex} lang={example.language}>
69
+ <StyledGlossExampleWrapper data-is-standalone={isStandalone}>
70
+ <StyledGlossExample data-is-first={index === 0} lang={example.language} data-is-standalone={isStandalone}>
59
71
  <StyledText data-is-first={index === 0} textStyle="meta-text-medium" margin="none">
60
72
  {example.example}
61
73
  </StyledText>
62
74
  </StyledGlossExample>
63
75
  {example.transcriptions.pinyin && (
64
- <StyledGlossExample lang={originalLanguage}>
76
+ <StyledGlossExample
77
+ lang={originalLanguage}
78
+ data-is-standalone={isStandalone}
79
+ data-is-last={example.transcriptions.traditional?.length === 0}
80
+ >
65
81
  <StyledText data-pinyin textStyle="meta-text-medium" margin="none">
66
82
  {example.transcriptions?.pinyin}
67
83
  </StyledText>
68
84
  </StyledGlossExample>
69
85
  )}
70
86
  {example.transcriptions.traditional && (
71
- <StyledGlossExample lang={originalLanguage}>
87
+ <StyledGlossExample lang={originalLanguage} data-is-standalone={isStandalone} data-is-last>
72
88
  <StyledText textStyle="meta-text-medium" margin="none">
73
89
  {example.transcriptions?.traditional}
74
90
  </StyledText>
@@ -6,36 +6,28 @@
6
6
  *
7
7
  */
8
8
 
9
- import { HTMLAttributes, ReactNode } from "react";
9
+ import { HTMLAttributes, ReactNode, useMemo } from "react";
10
10
 
11
11
  interface Props extends HTMLAttributes<HTMLElement> {
12
12
  children?: ReactNode;
13
- layout?: string;
13
+ layout?: "extend" | "center";
14
14
  }
15
15
 
16
16
  export const LayoutItem = ({ children, layout, ...rest }: Props) => {
17
- switch (layout) {
18
- case "extend": {
19
- return (
20
- <section className="u-10/12@desktop u-push-1/12@desktop u-10/12@tablet u-push-1/12@tablet">{children}</section>
21
- );
17
+ const className = useMemo(() => {
18
+ if (layout === "extend") {
19
+ return "u-10/12@desktop u-push-1/12@desktop u-10/12@tablet u-push-1/12@tablet";
20
+ } else if (layout === "center") {
21
+ return "u-7/10@desktop u-push-3/20@desktop u-10/12@tablet u-push-1/12@tablet";
22
22
  }
23
- case "center": {
24
- return (
25
- <section className="u-4/6@desktop u-push-1/6@desktop u-10/12@tablet u-push-1/12@tablet">{children}</section>
26
- );
27
- }
28
- case "full": {
29
- return <section className="u-1/1@desktop">{children}</section>;
30
- }
31
- default: {
32
- return (
33
- <section className="o-layout__item" {...rest}>
34
- {children}
35
- </section>
36
- );
37
- }
38
- }
23
+ return undefined;
24
+ }, [layout]);
25
+
26
+ return (
27
+ <section className={className} {...rest}>
28
+ {children}
29
+ </section>
30
+ );
39
31
  };
40
32
 
41
33
  export default LayoutItem;
@@ -13,6 +13,7 @@ import styled from "@emotion/styled";
13
13
  import { breakpoints, colors, fonts, misc, mq, spacing } from "@ndla/core";
14
14
  import { WarningOutline } from "@ndla/icons/common";
15
15
  import { getLicenseByAbbreviation, getLicenseCredits } from "@ndla/licenses";
16
+ import { ICopyright as ArticleCopyright } from "@ndla/types-backend/article-api";
16
17
  import { ICopyright as AudioCopyright } from "@ndla/types-backend/audio-api";
17
18
  import { IDraftCopyright as ConceptCopyright } from "@ndla/types-backend/concept-api";
18
19
  import { ICopyright as ImageCopyright } from "@ndla/types-backend/image-api";
@@ -62,7 +63,18 @@ interface ConceptProps extends BaseProps {
62
63
  copyright: ConceptCopyright | undefined;
63
64
  }
64
65
 
65
- export type EmbedBylineTypeProps = ImageProps | BrightcoveProps | AudioProps | PodcastProps | ConceptProps;
66
+ interface CopyrightProps extends BaseProps {
67
+ type: "copyright";
68
+ copyright: ArticleCopyright | undefined;
69
+ }
70
+
71
+ export type EmbedBylineTypeProps =
72
+ | ImageProps
73
+ | BrightcoveProps
74
+ | AudioProps
75
+ | PodcastProps
76
+ | ConceptProps
77
+ | CopyrightProps;
66
78
 
67
79
  type Props = EmbedBylineTypeProps | EmbedBylineErrorProps;
68
80
 
package/src/index.ts CHANGED
@@ -28,6 +28,7 @@ export {
28
28
  InlineConcept,
29
29
  BlockConcept,
30
30
  UuDisclaimerEmbed,
31
+ CopyrightEmbed,
31
32
  } from "./Embed";
32
33
 
33
34
  export { LicenseLink } from "./LicenseByline";
@@ -453,6 +453,7 @@ const messages = {
453
453
  description: "Remember that built-in content might have a different license than the gloss text",
454
454
  rules: "Rules for use of gloss:",
455
455
  title: "Title",
456
+ showOrHideExamples: "Show or hide examples",
456
457
  embedlink: {
457
458
  heading: "How to show the gloss in other content",
458
459
  description: "This url shows the gloss without menu and footer",
@@ -1351,6 +1352,7 @@ const messages = {
1351
1352
  h5p: "H5P",
1352
1353
  external: "External resource",
1353
1354
  gloss: "Gloss",
1355
+ copyright: "Text",
1354
1356
  },
1355
1357
  },
1356
1358
  gloss: {
@@ -468,6 +468,7 @@ const messages = {
468
468
  description: "Husk at innebygd innhold i en glose kan ha en annen lisens enn selve gloseteksten",
469
469
  rules: "Regler for bruk av glose:",
470
470
  title: "Tittel",
471
+ showOrHideExamples: "Vis eller skjul eksempler",
471
472
  embedlink: {
472
473
  heading: "Slik viser du glosen i annet innhold",
473
474
  description: "Denne lenken viser glosen uten kontekst (meny og bunntekst)",
@@ -1350,6 +1351,7 @@ const messages = {
1350
1351
  h5p: "H5P",
1351
1352
  external: "Ekstern ressurs",
1352
1353
  gloss: "Glose",
1354
+ copyright: "Tekst",
1353
1355
  },
1354
1356
  },
1355
1357
  gloss: {
@@ -474,6 +474,7 @@ const messages = {
474
474
  description: "Husk at innebygd innhald i ei glose kan ha ein anna lisens enn sjølve gloseteksten",
475
475
  rules: "Regler for bruk av glose:",
476
476
  title: "Tittel",
477
+ showOrHideExamples: "Vis eller skjul eksempler",
477
478
  },
478
479
  files: {
479
480
  heading: "Slik gjenbruker du filer",
@@ -1350,6 +1351,7 @@ const messages = {
1350
1351
  h5p: "H5P",
1351
1352
  external: "Ekstern ressurs",
1352
1353
  gloss: "Glose",
1354
+ copyright: "Tekst",
1353
1355
  },
1354
1356
  },
1355
1357
  gloss: {