Skip to content

Commit 0700f91

Browse files
committed
💄 [#1309] Added file-input toggle, file info and file error styles
1 parent 95e631e commit 0700f91

File tree

2 files changed

+17
-40
lines changed

2 files changed

+17
-40
lines changed

src/open_inwoner/js/components/upload-document/show-file-info.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ if (fileUploadInput) {
7171
})
7272
}
7373

74-
// pseudocode:
75-
// if input with type = hidden exists inside uploadform, then remove the node "form__control file-type__select"
76-
//close() {
77-
// this.node.parentElement.removeChild(this.node)
78-
// }
74+
// if there is only 1 case-type, remove select and its surrounding label
75+
document
76+
.querySelectorAll('.file-type__select')
77+
.forEach(function (selectType) {
78+
console.log(selectType)
79+
if (selectType.querySelector('input[type="hidden"]')) {
80+
selectType.style.display = 'none'
81+
}
82+
})
7983

8084
// Firefox focus bug fix
8185
fileUploadInput.addEventListener('focus', function () {

src/open_inwoner/scss/components/Form/DocumentUpload.scss

+8-35
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232
}
3333

34-
// styled file-input site wide
34+
/// File-input site wide
3535
input[type='file'] {
3636
background-color: var(--color-white);
3737
color: var(--color-primary-lighter);
@@ -46,7 +46,7 @@ input[type='file'] {
4646
cursor: pointer;
4747
}
4848

49-
// styled file-input clientbutton site wide
49+
/// File-input button site wide
5050
input[type='file']::file-selector-button {
5151
color: var(--color-white);
5252
background-color: var(--color-primary);
@@ -72,45 +72,13 @@ input[type='file']::file-selector-button {
7272
}
7373

7474
.form__open-upload {
75-
//.upload-interface {
76-
// display: block;
77-
// width: 0;
78-
// height: 0;
79-
// opacity: 0;
80-
// padding: 0;
81-
// margin: 0;
82-
//}
83-
8475
.file-type__select {
8576
max-width: var(--mobile-xs-width);
8677
}
8778
.form__control > .label *[class*='icon'] {
8879
top: 69%;
8980
}
9081

91-
.upload__button *[class*='icon'] {
92-
margin-right: var(--spacing-medium);
93-
}
94-
.upload__button,
95-
.upload-button--disabled {
96-
max-width: var(--mobile-xs-width);
97-
display: flex;
98-
margin-top: var(--spacing-medium);
99-
}
100-
101-
&.upload--open {
102-
.upload-interface {
103-
display: block;
104-
width: 100%;
105-
height: initial;
106-
opacity: 1;
107-
}
108-
.upload__button,
109-
.upload-button--disabled {
110-
//display: none;
111-
}
112-
}
113-
11482
.input-file {
11583
position: relative;
11684
max-width: var(--mobile-xs-width);
@@ -122,7 +90,7 @@ input[type='file']::file-selector-button {
12290
color: orange;
12391
}
12492

125-
//styled hidden file-input for cases
93+
/// Hidden file-input for cases
12694
.inputfile {
12795
display: inline-block;
12896
margin-top: var(--spacing-large);
@@ -132,6 +100,7 @@ input[type='file']::file-selector-button {
132100
overflow: hidden;
133101
z-index: 200;
134102
}
103+
135104
.inputfile + label {
136105
display: inline-block;
137106
position: absolute;
@@ -147,6 +116,7 @@ input[type='file']::file-selector-button {
147116
width: 200px;
148117
z-index: -1;
149118
}
119+
150120
.inputfile:focus + label,
151121
.inputfile.has-focus + label,
152122
.inputfile:hover + label,
@@ -155,16 +125,19 @@ input[type='file']::file-selector-button {
155125
top: -5px;
156126
transition: all 0.3s, background-color 0.3s;
157127
}
128+
158129
.inputfile + label *[class*='icons'] {
159130
width: 1.3em;
160131
height: 1em;
161132
vertical-align: middle;
162133
color: white;
163134
margin-top: -0.15em;
164135
}
136+
165137
.inputfile + label {
166138
cursor: pointer; /* "hand" cursor */
167139
}
140+
168141
.inputfile:focus + label {
169142
outline: 2px solid orange;
170143
outline: -webkit-focus-ring-color auto 5px;

0 commit comments

Comments
 (0)