Skip to content

Commit 65fc166

Browse files
authored
Merge pull request #365 from it-at-m/feature/364-new-form-error-message-design
Feature/364 new form error message design
2 parents 8523096 + acbc44d commit 65fc166

File tree

4 files changed

+53
-53
lines changed

4 files changed

+53
-53
lines changed

src/components/FileDropzone/MucFileDropzone.vue

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,25 @@
2222
additionalInformation
2323
}}</span>
2424
</div>
25-
<span
26-
v-if="!validFileSizes && maxFileSizeWarning"
27-
class="m-error-message drop-zone-error-message"
28-
>
29-
<MucIcon
30-
icon="warning--filled"
31-
class="icon"
32-
/>
33-
<span>
34-
{{ maxFileSizeWarning }}
35-
</span>
36-
</span>
37-
<span
38-
v-if="!validTotalFileSizes && maxTotalFileSizeWarning"
39-
class="m-error-message drop-zone-error-message"
40-
>
41-
<MucIcon icon="warning--filled" />
42-
<span>
43-
{{ maxTotalFileSizeWarning }}
44-
</span>
45-
</span>
46-
<span
47-
v-if="!validFilesAmount"
48-
class="m-error-message drop-zone-error-message"
49-
>
50-
<MucIcon icon="warning--filled" />
51-
<span>
52-
{{ invalidAmountWarning }}
53-
</span>
54-
</span>
25+
26+
<form-error-message v-if="!validFileSizes && maxFileSizeWarning">
27+
{{ maxFileSizeWarning }}
28+
</form-error-message>
29+
30+
<form-error-message v-if="!validTotalFileSizes && maxTotalFileSizeWarning">
31+
{{ maxTotalFileSizeWarning }}
32+
</form-error-message>
33+
34+
<form-error-message v-if="!validFilesAmount">
35+
{{ invalidAmountWarning }}
36+
</form-error-message>
5537
</template>
5638

5739
<script setup lang="ts">
5840
import { onMounted, onUpdated, ref, watch } from "vue";
5941
6042
import { MucButton } from "../Button";
61-
import { MucIcon } from "../Icon";
43+
import FormErrorMessage from "../Form/FormErrorMessage.vue";
6244
import IconFileUpload from "./IconFileUpload.vue";
6345
6446
const {
@@ -297,19 +279,6 @@ const _clearWarnings = () => {
297279
cursor: pointer;
298280
}
299281
300-
.drop-zone-error-message {
301-
display: flex;
302-
align-items: flex-start;
303-
}
304-
305-
.drop-zone-error-message .icon {
306-
margin-top: 0;
307-
}
308-
309-
.drop-zone-error-message span {
310-
margin-left: 4px;
311-
}
312-
313282
.drop-zone-additional-information {
314283
font-size: 14px;
315284
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<script setup lang="ts">
2+
import { MucIcon } from "../Icon";
3+
</script>
4+
5+
<template>
6+
<span class="m-error-message form-error-message">
7+
<MucIcon icon="warning--filled" />
8+
<span>
9+
<slot></slot>
10+
</span>
11+
</span>
12+
</template>
13+
14+
<style scoped>
15+
.form-error-message {
16+
display: flex;
17+
align-items: flex-start;
18+
}
19+
20+
.form-error-message .icon {
21+
margin-top: 0;
22+
}
23+
24+
.form-error-message span {
25+
margin-left: 4px;
26+
}
27+
</style>

src/components/Form/MucInput.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
<span class="visually-hidden">(erforderlich)</span>
1818
</span>
1919
</label>
20-
<p
21-
id="text-input-error"
22-
class="m-error-message"
23-
>
24-
{{ errorMsg }}
25-
</p>
2620
<div class="m-input-wrapper m-autocomplete">
2721
<div
2822
v-if="!!slots.prefix"
@@ -73,11 +67,19 @@
7367
>
7468
{{ hint }}
7569
</p>
70+
<form-error-message
71+
id="text-input-error"
72+
v-if="errorMsg"
73+
>
74+
{{ errorMsg }}
75+
</form-error-message>
7676
</div>
7777
</template>
7878
<script setup lang="ts">
7979
import { computed } from "vue";
8080
81+
import FormErrorMessage from "./FormErrorMessage.vue";
82+
8183
/**
8284
* Type includes all possible input types possible.
8385
*/

src/components/Form/MucTextArea.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
<span class="visually-hidden">(erforderlich)</span>
1515
</span>
1616
</label>
17-
<p class="m-error-message">
18-
{{ errorMsg }}
19-
</p>
2017
<div class="m-input-wrapper">
2118
<textarea
2219
class="m-textarea"
@@ -29,10 +26,15 @@
2926
<p class="m-hint">
3027
{{ hint }}
3128
</p>
29+
<form-error-message v-if="errorMsg">
30+
{{ errorMsg }}
31+
</form-error-message>
3232
</div>
3333
</template>
3434

3535
<script setup lang="ts">
36+
import FormErrorMessage from "./FormErrorMessage.vue";
37+
3638
/**
3739
* Input value from the form component.
3840
*/

0 commit comments

Comments
 (0)