Skip to content

Commit fdce331

Browse files
authored
Merge pull request #583 from dnum-mi/develop
Develop
2 parents 7f1188a + 8252799 commit fdce331

File tree

9 files changed

+208
-6
lines changed

9 files changed

+208
-6
lines changed

src/assets/img/technical-error.png

11.6 KB
Loading

src/common-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type TitleTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'

src/components/DsfrAlert/DsfrAlert.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
<script setup lang="ts">
22
import { computed } from 'vue'
33
4-
import { getRandomId } from '../../utils/random-utils'
4+
import { getRandomId } from '@/utils/random-utils'
5+
import { type TitleTag } from '@/common-types'
6+
7+
export type DsfrAlertType = 'error' | 'success' | 'warning' | 'info'
58
69
const props = withDefaults(defineProps<{
710
id?: string,
8-
type?: 'error' | 'success' | 'warning' | 'info',
11+
type?: DsfrAlertType,
912
title?: string,
1013
description: string,
11-
titleTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6',
14+
titleTag?: TitleTag,
1215
small?: boolean,
1316
closed?: boolean,
1417
closeable?: boolean,

src/components/DsfrCard/DsfrCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ defineExpose({ goToTargetLink })
9595
v-if="buttons.length || linksGroup.length"
9696
class="fr-card__footer"
9797
>
98-
<dsfr-button-group
98+
<DsfrButtonGroup
9999
v-if="buttons.length"
100100
:buttons="buttons"
101101
inline-layout-when="lg"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import DsfrErrorPage from './DsfrErrorPage.vue'
2+
3+
export default {
4+
component: DsfrErrorPage,
5+
title: 'Composants/DsfrErrorPage',
6+
argTypes: {
7+
title: {
8+
control: 'text',
9+
description: 'Conséquence de l\'erreur rencontrée.',
10+
},
11+
subtitle: {
12+
control: 'text',
13+
description: 'Code d\'erreur HTTP à l\'origine de l\'erreur rencontrée.',
14+
},
15+
description: {
16+
control: 'text',
17+
description: 'Description de l\'erreur et formule d\'excuses à l\'utilisateur.',
18+
},
19+
help: {
20+
control: 'text',
21+
description: 'Accompagnement de l\'utilisateur qui se retrouve confronté à l\'erreur.',
22+
},
23+
buttons: {
24+
control: 'object',
25+
description: 'Tableau d\'objets contenant les props des boutons d\'actions sur la page.',
26+
},
27+
}
28+
}
29+
30+
export const PageErreur404 = (args) => ({
31+
components: { DsfrErrorPage },
32+
data () {
33+
return args
34+
},
35+
template: `
36+
<DsfrErrorPage
37+
:title="title"
38+
:subtitle="subtitle"
39+
:description="description"
40+
:help="help"
41+
:buttons="buttons"
42+
/>
43+
`,
44+
45+
})
46+
47+
PageErreur404.args = {
48+
title: "Page non trouvée, ne paniquez pas",
49+
subtitle: "Erreur 404 !",
50+
description: "La page que vous recherchez n'existe pas ou l'url est erronée.",
51+
help: "Bonne chance !",
52+
buttons: [{
53+
label: 'Page d\'accueil',
54+
link: 'https://www.systeme-de-design.gouv.fr/',
55+
},
56+
{
57+
label: 'Contactez-nous',
58+
secondary: true,
59+
link: 'https://www.systeme-de-design.gouv.fr/',
60+
},],
61+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<script lang="ts" setup>
2+
import { type DsfrButtonProps } from '../DsfrButton/DsfrButton.vue'
3+
import DsfrButtonGroup from '../DsfrButton/DsfrButtonGroup.vue'
4+
5+
withDefaults(defineProps<{
6+
title?: string
7+
subtitle?: string
8+
description?: string
9+
help?: string
10+
buttons: DsfrButtonProps[]
11+
}>(), {
12+
title: 'Page non trouvée',
13+
subtitle: 'Erreur 404',
14+
description: 'La page que vous cherchez est introuvable. Excusez-nous pour la gêne occasionnée.',
15+
help: 'Si vous avez tapé l\'adresse web dans le navigateur, vérifiez qu\'elle est correcte. La page n\'est peut être plus disponible.',
16+
buttons: () => [],
17+
})
18+
</script>
19+
20+
<template>
21+
<div class="fr-container flex">
22+
<div class="half">
23+
<h1 class="font-25">{{ title }}</h1>
24+
<span class="block mt-15 mb-15">{{ subtitle }}</span>
25+
<p class="font-125">{{ description }}</p>
26+
<p>{{ help }}</p>
27+
<DsfrButtonGroup
28+
v-if="buttons?.length"
29+
:buttons="buttons"
30+
inline-layout-when="always"
31+
/>
32+
</div>
33+
<div class="half self-center text-center">
34+
<img
35+
class="error-img"
36+
src="../../assets/img/technical-error.png"
37+
>
38+
</div>
39+
</div>
40+
</template>
41+
42+
<style scoped>
43+
44+
.flex {
45+
display: flex;
46+
}
47+
48+
.block {
49+
display: flex;
50+
}
51+
52+
.half {
53+
max-width: 50%;
54+
width: 50%;
55+
}
56+
57+
.self-center {
58+
align-self: center;
59+
}
60+
61+
.text-center {
62+
text-align: center;
63+
}
64+
65+
.mt-15 {
66+
margin-top: 1.5rem;
67+
}
68+
69+
.mb-15 {
70+
margin-bottom: 1.5rem;
71+
}
72+
73+
.font-125 {
74+
font-size: 1.25rem;
75+
}
76+
77+
.font-25 {
78+
font-size: 2.5rem;
79+
}
80+
81+
</style>

src/components/DsfrSelect/DsfrSelect.stories.ts

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export default {
3131
control: 'text',
3232
description: 'Message à afficher en situation de succès, sa présence change la couleur de la police d’écriture',
3333
},
34+
defaultUnselectedText: {
35+
control: 'text',
36+
description: 'Texte de l’option sélectionnée par défaut si aucune option valide n’est sélectionnée',
37+
},
3438
errorMessage: {
3539
control: 'text',
3640
description: 'Message à afficher en cas d’erreur, sa présence change la couleur de la police d’écriture',
@@ -103,6 +107,56 @@ ListeDeroulante.args = {
103107
required: false,
104108
}
105109

110+
export const ListeDeroulanteEnAnglais = (args) => ({
111+
components: {
112+
DsfrSelect,
113+
},
114+
115+
data () {
116+
return {
117+
...args,
118+
}
119+
},
120+
121+
template: `
122+
<DsfrSelect
123+
:required="required"
124+
:label="label"
125+
:options="options"
126+
:description="description"
127+
:success-message="successMessage"
128+
:error-message="errorMessage"
129+
:disabled="disabled"
130+
:defaultUnselectedText="defaultUnselectedText"
131+
v-model="modelValue"
132+
/>
133+
`,
134+
135+
watch: {
136+
modelValue (newVal) {
137+
this.onChange(newVal)
138+
},
139+
},
140+
141+
})
142+
ListeDeroulanteEnAnglais.args = {
143+
options: [
144+
'Option 1',
145+
'Option 2',
146+
'Option 3',
147+
'Option 4',
148+
'Option 5',
149+
'Option 6',
150+
],
151+
label: 'Those are the options:',
152+
description: 'I am a description',
153+
successMessage: '',
154+
errorMessage: '',
155+
defaultUnselectedText: 'Please select an option',
156+
disabled: false,
157+
required: false,
158+
}
159+
106160
export const ListeDeroulanteRequise = (args) => ({
107161
components: {
108162
DsfrSelect,
@@ -240,7 +294,6 @@ export const ListeDeroulanteInactive = (args) => ({
240294
},
241295

242296
})
243-
244297
ListeDeroulanteInactive.args = {
245298
options: [
246299
'Option 1',

src/components/DsfrSelect/DsfrSelect.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const props = withDefaults(defineProps<{
1616
options?:(string | number | { value: string | number, text: string, disabled: boolean })[]
1717
successMessage?: string
1818
errorMessage?: string
19+
defaultUnselectedText?: string
1920
}>(), {
2021
selectId: () => getRandomId('select'),
2122
modelValue: undefined,
@@ -24,6 +25,7 @@ const props = withDefaults(defineProps<{
2425
description: undefined,
2526
successMessage: '',
2627
errorMessage: '',
28+
defaultUnselectedText: 'Sélectionnez une option',
2729
})
2830
2931
defineEmits<{(e: 'update:modelValue', payload: string): void}>()
@@ -78,7 +80,7 @@ const messageType = computed(() => {
7880
disabled
7981
hidden
8082
>
81-
Sélectionnez une option
83+
{{ defaultUnselectedText }}
8284
</option>
8385

8486
<option

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ export default {
2626
export * from './components/index.js'
2727
export * from './utils/random-utils'
2828
export * from './composables.js'
29+
export * from './common-types.js'
2930
export * as icons from './icons.js'

0 commit comments

Comments
 (0)