Skip to content

Commit 8bd3e3d

Browse files
committed
Add webapp shortcode where any web app can be loaded with an appId, script and stylesheet.
1 parent 873aab6 commit 8bd3e3d

File tree

7 files changed

+99
-6
lines changed

7 files changed

+99
-6
lines changed

content/english/technical-tools/documentation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ overview_block:
2929
link: classification-quick-scan/#form
3030
---
3131

32-
{{< iframe src="https://ai-documentation.s3.eu-central-1.amazonaws.com/index.html" id="forms" height="700px" >}}
32+
{{< iframe src="https://ai-documentation.s3.eu-central-1.amazonaws.com/index.html" id="forms" height="500px" >}}
33+
34+
{{< webapp id="webapp" appId="AIActWizard" stylesheet="https://ai-documentation.s3.eu-central-1.amazonaws.com/AI-Act-Questionnaire-v1.0.0.css" src="https://ai-documentation.s3.eu-central-1.amazonaws.com/AI-Act-Questionnaire-v1.0.0.js" title="" >}}

layouts/shortcodes/iframe.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{ $_hugo_config := `{ "version": 1 }` }}
22

33
<div class="container-fluid mt-5 p-0">
4-
<div class="shadow mobile-desktop-container-layout-web-app rounded-lg" id='{{.Get "id" }}'>
4+
<div class="rounded-lg" id='{{.Get "id" }}'>
55
<div class="row">
66
<div class="col-12">
77
{{ if .Get "title" }}
@@ -19,7 +19,7 @@ <h3 class="pl-3">{{ .Get "title" }}
1919

2020
{{ end }}
2121
{{ end}}
22-
<div class="i-frame__container" style="margin: 0px -20px;">
22+
<div class="i-frame__container" >
2323
<iframe class="iframe" src='{{.Get "src" }}'
2424
title='.Get "title"'>
2525
</iframe>

layouts/shortcodes/webapp.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{ $_hugo_config := `{ "version": 1 }` }}
2+
3+
<!-- text field -->
4+
<div class="container-fluid mt-5 p-0">
5+
<div class="shadow mobile-desktop-container-layout-web-app bg-lightblue rounded-lg" id='{{ .Get "id" }}'>
6+
7+
<div class="row">
8+
<div class="col-12">
9+
10+
{{ if .Get "title" }}
11+
{{ if .Get "icon" }}
12+
<!-- Title and icon -->
13+
<h3 class="">
14+
<span class='{{ .Get "icon" }} icon mb-4 pl-5'></span>
15+
{{ .Get "title" | markdownify }}
16+
</h3>
17+
18+
{{ else }}
19+
<!-- Title -->
20+
<h3 class="pl-3">{{ .Get "title" | markdownify }}
21+
</h3>
22+
23+
{{ end }}
24+
{{ end }}
25+
26+
<!-- Bias Detection Tool -->
27+
<div id='{{.Get "appId" }}'></div>
28+
<!-- /Bias Detection Tool -->
29+
30+
</div>
31+
</div>
32+
33+
</div>
34+
</div>
35+
<!-- text field -->
36+
{{ if .Get "stylesheet" }}
37+
<link rel="stylesheet" href='{{ .Get "stylesheet" }}' />
38+
{{ end }}
39+
<script type="module" src='{{ .Get "src" }}'></script>

tina/collections/shared/page/building_blocks.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import team from "../templates/team";
2828
import team1 from "../templates/team1";
2929
import team2 from "../templates/team2";
3030
import tooltip from "../templates/tooltip";
31+
import webapp from "../templates/webapp";
3132
import image from "./image";
3233
import subtitle from "./subtitle";
3334
import title from "./title";
@@ -68,6 +69,7 @@ const building_blocks: TinaField[] = [
6869
team1,
6970
team2,
7071
tooltip,
72+
webapp,
7173
],
7274
},
7375
{

tina/collections/shared/templates/iframe.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ const iframe: RichTextTemplate = {
3333
label: "Title",
3434
type: "string",
3535
description: "",
36-
required: true,
3736
},
3837
{
3938
type: "string",
4039
name: "icon",
4140
label: "Icon",
4241
description:
4342
"From https://fontawesome.com/v5/search?m=free (e.g. fa fa-list for https://fontawesome.com/icons/list?f=classic&s=solid)",
44-
required: false,
4543
},
4644
],
4745
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { RichTextTemplate } from "@tinacms/schema-tools/dist/types/index";
2+
const webapp: RichTextTemplate = {
3+
name: "webapp",
4+
label: "Web App",
5+
match: {
6+
start: "{{<",
7+
end: ">}}",
8+
},
9+
fields: [
10+
{
11+
name: "id",
12+
label: "ID",
13+
type: "string",
14+
description: "Use top level template",
15+
required: true,
16+
},
17+
{
18+
name: "appId",
19+
label: "App ID",
20+
type: "string",
21+
description: "App ID of the web app",
22+
required: true,
23+
},
24+
{
25+
name: "src",
26+
label: "Script url",
27+
type: "string",
28+
description: "Script url of the web app",
29+
required: true,
30+
},
31+
{
32+
name: "stylesheet",
33+
label: "Stylesheet url",
34+
type: "string",
35+
description: "Stylesheet url of the web app",
36+
},
37+
{
38+
name: "title",
39+
label: "Title",
40+
type: "string",
41+
description: "",
42+
},
43+
{
44+
type: "string",
45+
name: "icon",
46+
label: "Icon",
47+
description:
48+
"From https://fontawesome.com/v5/search?m=free (e.g. fa fa-list for https://fontawesome.com/icons/list?f=classic&s=solid)",
49+
},
50+
],
51+
};
52+
export default webapp;

tina/tina-lock.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)