project-booster-vue 9.30.1 → 9.31.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "9.30.1",
3
+ "version": "9.31.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -4,6 +4,7 @@ import cloneDeep from 'lodash.clonedeep';
4
4
  import PbWarningMessage from './PbWarningMessage';
5
5
  import DEFAULT_PAYLOAD from './default-payload.json';
6
6
  import WITHOUT_EXPLAIN_LINK from './without-explain-link.json';
7
+ import WITH_MODAL from './with-modal.json';
7
8
 
8
9
  <Meta
9
10
  title="Project Booster/Components/Warning Message/PbWarningMessage 🦠"
@@ -57,3 +58,11 @@ export const TemplateSandbox = (args, { argTypes }) => ({
57
58
  {TemplateSandbox.bind({})}
58
59
  </Story>
59
60
  </Canvas>
61
+
62
+ # `PbWarningMessage` - With Modal
63
+
64
+ <Canvas>
65
+ <Story name="With Modal" args={{ payload: WITH_MODAL }}>
66
+ {TemplateSandbox.bind({})}
67
+ </Story>
68
+ </Canvas>
@@ -26,7 +26,16 @@
26
26
  <h3>{{ payload.viewModel.subtitle }}</h3>
27
27
  <p>{{ payload.viewModel.content }}</p>
28
28
  <div class="pb-warning-message__container__message__right__link" v-if="payload.viewModel.explainLink">
29
- <a :href="payload.viewModel.explainLink.href">{{ payload.viewModel.explainLink.label }}</a>
29
+ <a
30
+ v-if="payload.viewModel.explainLink.action"
31
+ href="#"
32
+ @click.prevent="handleHelpDialog(payload.viewModel.explainLink.action.viewModelDialog)"
33
+ >
34
+ {{ payload.viewModel.explainLink.label }}
35
+ </a>
36
+ <a v-else :href="payload.viewModel.explainLink.href">
37
+ {{ payload.viewModel.explainLink.label }}
38
+ </a>
30
39
  </div>
31
40
  </div>
32
41
  </m-flex>
@@ -53,18 +62,44 @@
53
62
  />
54
63
  </m-flex>
55
64
  </div>
65
+
66
+ <m-dialog
67
+ class="pb-warning-message__dialog-help"
68
+ :show-dialog="displayDialogHelp"
69
+ width="771px"
70
+ height="492px"
71
+ maxHeight="100vh"
72
+ @update:show-dialog="handleHelpDialog"
73
+ v-if="dialogHelpContent"
74
+ >
75
+ <template #header>
76
+ <div class="pb-warning-message__dialog-help__title">
77
+ <h2>{{ dialogHelpContent.headerTitle }}</h2>
78
+ </div>
79
+ </template>
80
+ <template #body>
81
+ <div class="pb-warning-message__dialog-help__body" v-html="dialogHelpContent.contentHtml"></div>
82
+ </template>
83
+ <template v-slot:footer>
84
+ <m-flex class="pb-question__dialog-help__footer" align-items="center" justify-content="center">
85
+ <m-button label="Fermer" theme="bordered-neutral" @click.prevent="handleHelpDialog"></m-button>
86
+ </m-flex>
87
+ </template>
88
+ </m-dialog>
56
89
  </m-flex>
57
90
  </template>
58
91
 
59
92
  <script lang="ts">
60
- import { defineComponent, PropType } from 'vue';
93
+ import { defineComponent, PropType, ref } from 'vue';
61
94
  import { v4 as uuidv4 } from 'uuid';
62
95
  import MFlex from './../mozaic/flex/MFlex.vue';
63
96
  import MLink from '../mozaic/link/MLink.vue';
64
97
  import MButton from '../mozaic/buttons/MButton.vue';
98
+ import MDialog from '../mozaic/dialog/MDialog.vue';
65
99
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
66
100
  import SVGInjector from 'svg-injector';
67
101
  import { WarningMessagePayloadAction } from '@/types/pb/WarningMessage';
102
+ import { DialogContent } from './dialogContent';
68
103
  const BACK_ICON =
69
104
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
70
105
  const WARNING_ICON =
@@ -76,6 +111,7 @@ export default defineComponent({
76
111
  MFlex,
77
112
  MLink,
78
113
  MButton,
114
+ MDialog,
79
115
  },
80
116
  props: {
81
117
  /**
@@ -146,6 +182,13 @@ export default defineComponent({
146
182
  },
147
183
  setup(props, { emit }) {
148
184
  const componentId = uuidv4();
185
+ const displayDialogHelp = ref(false);
186
+ const dialogHelpContent = ref();
187
+
188
+ const handleHelpDialog = (content: DialogContent) => {
189
+ displayDialogHelp.value = !displayDialogHelp.value;
190
+ dialogHelpContent.value = content;
191
+ };
149
192
 
150
193
  const skipQuestion = () => {
151
194
  /**
@@ -168,6 +211,9 @@ export default defineComponent({
168
211
  skipQuestion,
169
212
  BACK_ICON,
170
213
  WARNING_ICON,
214
+ displayDialogHelp,
215
+ handleHelpDialog,
216
+ dialogHelpContent,
171
217
  };
172
218
  },
173
219
  });
@@ -184,7 +230,13 @@ $responsive-breakpoint: 'm';
184
230
  @include set-font-face('regular');
185
231
  flex-grow: 1;
186
232
  margin: 0 auto;
187
- width: calc(100% - #{$mu050} - #{$mu050});
233
+ padding: 0 $mu100;
234
+ width: calc(100% - #{$mu100} - #{$mu100});
235
+
236
+ @include set-from-screen($responsive-breakpoint) {
237
+ width: calc(100% - #{$mu200} - #{$mu200});
238
+ }
239
+
188
240
  &__back-button-container {
189
241
  align-self: flex-start;
190
242
  }
@@ -251,7 +303,9 @@ $responsive-breakpoint: 'm';
251
303
  }
252
304
 
253
305
  &__container {
254
- width: 511px;
306
+ @include set-from-screen($responsive-breakpoint) {
307
+ width: 511px;
308
+ }
255
309
  }
256
310
 
257
311
  &__container__message__left {
@@ -274,7 +328,10 @@ $responsive-breakpoint: 'm';
274
328
 
275
329
  &__container--button {
276
330
  margin: $mu250 auto 0 auto;
277
- width: 311px;
331
+
332
+ @include set-from-screen($responsive-breakpoint) {
333
+ width: 311px;
334
+ }
278
335
 
279
336
  &__ok {
280
337
  margin-bottom: $mu100;
@@ -282,3 +339,28 @@ $responsive-breakpoint: 'm';
282
339
  }
283
340
  }
284
341
  </style>
342
+
343
+ <style lang="scss">
344
+ @import 'pb-variables';
345
+
346
+ .pb-warning-message {
347
+ &__dialog-help {
348
+ &__title {
349
+ padding: $mu250 $mu250 0 $mu250;
350
+ }
351
+
352
+ &__body {
353
+ padding: 0 $mu250;
354
+ @include set-font-scale('05', 'l');
355
+ &__image {
356
+ background-size: cover;
357
+ padding: 120px 0;
358
+ }
359
+ }
360
+
361
+ &__footer {
362
+ padding: $mu100 $mu250 $mu250 $mu250;
363
+ }
364
+ }
365
+ }
366
+ </style>
@@ -0,0 +1,4 @@
1
+ export interface DialogContent {
2
+ headerTitle: string;
3
+ contentHtml: string;
4
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "viewModel": {
3
+ "backLabel": "Question précédente",
4
+ "label": "Vos travaux dans un appartement",
5
+ "subtitle": "Nous attirons votre attention !",
6
+ "content": "La pose d’une pompe à chaleur n’est pas adaptée a un appartement. Nous n’avons pas d’offre pour les appartements aujourd’hui..",
7
+ "explainLink": {
8
+ "type": "link",
9
+ "label": "Comment faire des travaux de rénovation énergétique en tant que locataire ?",
10
+ "action": {
11
+ "viewModelDialog": {
12
+ "headerTitle": "Votre travaux dans un appartement",
13
+ "contentHtml": "Mon contenu de modal ici"
14
+ }
15
+ }
16
+ }
17
+ },
18
+ "callToActions": [
19
+ {
20
+ "type": "button",
21
+ "label": "Ok, poursuivre l'estimation",
22
+ "action": {
23
+ "type": "STEP",
24
+ "code": "__END__"
25
+ },
26
+ "bordered": false
27
+ },
28
+ {
29
+ "type": "button",
30
+ "label": "Changer de le type de propriété",
31
+ "action": {
32
+ "type": "STEP",
33
+ "code": "__BACK__"
34
+ },
35
+ "bordered": true
36
+ }
37
+ ]
38
+ }