Skip to content

Commit

Permalink
Merge pull request #422 from NDLA-H5P/feature/add-link-label
Browse files Browse the repository at this point in the history
Add label to dialog links
  • Loading branch information
henriettemoe authored Mar 24, 2022
2 parents 2c852f2 + 5bb613c commit 8360056
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
38 changes: 34 additions & 4 deletions .storybook/helpers/h5p.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export const params: Params = {
topicImage: { path: "", alt: "" },
dialog: {
hasNote: true,
links: ["https://example.com", "https://example.com/2"],
links: [
{ label: "Example", url: "https://example.com" },
{ label: "Example 2", url: "https://example.com/2" },
],
},
description: "",
},
Expand All @@ -37,7 +40,10 @@ export const params: Params = {
id: "arrow-1",
dialog: {
hasNote: true,
links: ["https://example.com", "https://example.com/2"],
links: [
{ label: "Example", url: "https://example.com" },
{ label: "Example 2", url: "https://example.com/2" },
],
},
arrowType: ArrowType.Directional,
startElementId: "box-1",
Expand Down Expand Up @@ -180,7 +186,19 @@ export const semantics: H5PFieldGroup = {
field: {
label: "Link",
name: "link",
type: H5PFieldType.Text,
type: H5PFieldType.Group,
fields: [
{
label: "Label",
name: "label",
type: H5PFieldType.Text,
},
{
label: "Url",
name: "url",
type: H5PFieldType.Text,
},
],
},
},
],
Expand Down Expand Up @@ -318,7 +336,19 @@ export const semantics: H5PFieldGroup = {
field: {
label: "Link",
name: "link",
type: H5PFieldType.Text,
type: H5PFieldType.Group,
fields: [
{
label: "Label",
name: "label",
type: H5PFieldType.Text,
},
{
label: "Url",
name: "url",
type: H5PFieldType.Text,
},
],
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"machineName": "H5PEditor.TopicMap",
"majorVersion": 0,
"minorVersion": 1,
"patchVersion": 47,
"patchVersion": 48,
"runnable": 0,
"preloadedJs": [
{
Expand Down
3 changes: 2 additions & 1 deletion src/types/DialogContent.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Audio } from "./H5P/Audio";
import { Video } from "./H5P/Video";
import { Link } from "./Link";

export type DialogContent = {
hasNote: boolean;
links?: Array<string>;
links?: Array<Link>;
text?: string;
video?: Video;
audio?: {
Expand Down
4 changes: 4 additions & 0 deletions src/types/Link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type Link = {
label: string;
url: string;
};

0 comments on commit 8360056

Please sign in to comment.