File tree 8 files changed +111
-0
lines changed
api/src/devcomp/infrastructure
datasources/learning-content/modules
8 files changed +111
-0
lines changed Original file line number Diff line number Diff line change 38
38
}
39
39
],
40
40
"grains" : [
41
+ {
42
+ "id" : " 0d4ef09a-ebb8-4514-a037-8fb22e540d7c" ,
43
+ "type" : " discovery" ,
44
+ "title" : " Voici un grain qui contient un webcomponent" ,
45
+ "components" : [
46
+ {
47
+ "type" : " element" ,
48
+ "element" : {
49
+ "id" : " cfec5a0e-2ed5-462f-8974-e5ca25faae38" ,
50
+ "type" : " web-component" ,
51
+ "tagName" : " qcu-image" ,
52
+ "props" : {
53
+ "name" : " Liste d'applications" ,
54
+ "maxChoicesPerLine" : 3 ,
55
+ "imageChoicesSize" : " icon" ,
56
+ "choices" : [
57
+ {
58
+ "name" : " Google" ,
59
+ "image" : {
60
+ "width" : 534 ,
61
+ "height" : 544 ,
62
+ "loading" : " lazy" ,
63
+ "decoding" : " async" ,
64
+ "src" : " https://epreuves.pix.fr/_astro/Google.B1bcY5Go_1BynY8.svg"
65
+ }
66
+ },
67
+ {
68
+ "name" : " LibreOffice Writer" ,
69
+ "image" : {
70
+ "width" : 205 ,
71
+ "height" : 246 ,
72
+ "loading" : " lazy" ,
73
+ "decoding" : " async" ,
74
+ "src" : " https://epreuves.pix.fr/_astro/writer.3bR8N2DK_Z1iWuJ9.webp"
75
+ }
76
+ },
77
+ {
78
+ "name" : " Explorateur" ,
79
+ "image" : {
80
+ "width" : 128 ,
81
+ "height" : 128 ,
82
+ "loading" : " lazy" ,
83
+ "decoding" : " async" ,
84
+ "src" : " https://epreuves.pix.fr/_astro/windows-file-explorer.CnF8MYwI_23driA.webp"
85
+ }
86
+ },
87
+ {
88
+ "name" : " Geogebra" ,
89
+ "image" : {
90
+ "width" : 640 ,
91
+ "height" : 640 ,
92
+ "loading" : " lazy" ,
93
+ "decoding" : " async" ,
94
+ "src" : " https://epreuves.pix.fr/_astro/geogebra.CZH9VYqc_19v4nj.webp"
95
+ }
96
+ }
97
+ ]
98
+ }
99
+ }
100
+ }
101
+ ]
102
+ },
41
103
{
42
104
"id" : " f312c33d-e7c9-4a69-9ba0-913957b8f7dd" ,
43
105
"type" : " discovery" ,
Original file line number Diff line number Diff line change @@ -93,6 +93,8 @@ export class ModuleFactory {
93
93
return ModuleFactory . #buildDownload( element ) ;
94
94
case 'embed' :
95
95
return ModuleFactory . #buildEmbed( element ) ;
96
+ case 'web-component' :
97
+ return ModuleFactory . #buildWebComponent( element ) ;
96
98
case 'expand' :
97
99
return ModuleFactory . #buildExpand( element ) ;
98
100
case 'image' :
@@ -138,6 +140,14 @@ export class ModuleFactory {
138
140
} ) ;
139
141
}
140
142
143
+ static #buildWebComponent( element ) {
144
+ return {
145
+ ...element ,
146
+ id : element . id ,
147
+ type : 'web-component' ,
148
+ } ;
149
+ }
150
+
141
151
static #buildExpand( element ) {
142
152
return new Expand ( {
143
153
id : element . id ,
Original file line number Diff line number Diff line change 1
1
import './deprecation-workflow' ;
2
+ import '@1024pix/web-components' ;
2
3
3
4
import Application from '@ember/application' ;
4
5
import { init as initSentry } from '@sentry/ember' ;
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import QrocmElement from 'mon-pix/components/module/element/qrocm';
12
12
import SeparatorElement from ' mon-pix/components/module/element/separator' ;
13
13
import TextElement from ' mon-pix/components/module/element/text' ;
14
14
import VideoElement from ' mon-pix/components/module/element/video' ;
15
+ import WebComponentElement from ' mon-pix/components/module/element/web-component' ;
15
16
16
17
export default class ModulixElement extends Component {
17
18
@action
@@ -30,6 +31,8 @@ export default class ModulixElement extends Component {
30
31
<DownloadElement @ download ={{@ element }} @ onDownload ={{@ onFileDownload }} />
31
32
{{else if ( eq @ element.type " embed" ) }}
32
33
<EmbedElement @ embed ={{@ element }} @ onAnswer ={{@ onElementAnswer }} />
34
+ {{else if ( eq @ element.type " web-component" ) }}
35
+ <WebComponentElement @ component ={{@ element }} @ onAnswer ={{@ onElementAnswer }} />
33
36
{{else if ( eq @ element.type " expand" ) }}
34
37
<ExpandElement @ expand ={{@ element }} @ onExpandToggle ={{@ onExpandToggle }} />
35
38
{{else if ( eq @ element.type " separator" ) }}
Original file line number Diff line number Diff line change
1
+ import { on } from ' @ember/modifier' ;
2
+ import { action } from ' @ember/object' ;
3
+ import { eq } from ' ember-truth-helpers' ;
4
+
5
+ import ModuleElement from ' ./module-element' ;
6
+
7
+ export default class ModulixWebComponent extends ModuleElement {
8
+ @action
9
+ handleAnswer (event ) {
10
+ this .args .onAnswer ({
11
+ userResponse: [event .detail [0 ]],
12
+ element: this .args .embed ,
13
+ });
14
+ }
15
+
16
+ <template >
17
+ <div class =" element-webcomponent" >
18
+ <div class =" element-webcomponent__container" >
19
+ {{#if ( eq @ component.tagName " qcu-image" ) }}
20
+ <qcu-image props ={{@ component.props }} />
21
+ {{/if }}
22
+ </div >
23
+ </div >
24
+ </template >
25
+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export default class ModuleGrain extends Component {
19
19
static AVAILABLE_ELEMENT_TYPES = [
20
20
' download' ,
21
21
' embed' ,
22
+ ' web-component' ,
22
23
' expand' ,
23
24
' flashcards' ,
24
25
' image' ,
Original file line number Diff line number Diff line change 49
49
"@1024pix/eslint-plugin" : " ^2.1.0" ,
50
50
"@1024pix/pix-ui" : " ^54.14.1" ,
51
51
"@1024pix/stylelint-config" : " ^5.1.27" ,
52
+ "@1024pix/web-components" : " ^0.2.7" ,
52
53
"@babel/eslint-parser" : " ^7.25.1" ,
53
54
"@babel/plugin-proposal-decorators" : " ^7.24.7" ,
54
55
"@ember-data/json-api" : " ^5.3.8" ,
You can’t perform that action at this time.
0 commit comments