Skip to content

Commit d46280f

Browse files
committed
[#88169] frontend: src: components: Restyle download button
Signed-off-by: Anna Roszkiewicz <[email protected]>
1 parent 306670e commit d46280f

File tree

1 file changed

+90
-91
lines changed

1 file changed

+90
-91
lines changed

frontend/src/components/devices/Device.vue

Lines changed: 90 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -132,24 +132,25 @@ Component wraps functionality for displaying and working with a single rdfm devi
132132

133133
<template v-if="device?.capabilities.filesystem && allowedTo('read', 'device', device?.id)">
134134
<div class="download-container">
135-
<div class="drdn-wrapper">
136-
<button id="main-button" class="action-button gray">
137-
Download file
138-
<span class="caret-down"> <CaretDown /> </span>
139-
<span class="caret-up"> <CaretUp /> </span>
140-
</button>
141-
<div class="drdn">
142-
<div class="entry">
143-
<p>Path to file on device</p>
135+
<p>Download file from path</p>
136+
<table class="file-selector">
137+
<tbody>
138+
<td class="icon">
139+
<File />
140+
</td>
141+
<td class="input">
144142
<input type="text" ref="fileToDownload" />
145-
<div v-if="emptyPathError" class="errors">
146-
<p>Please enter file path</p>
147-
</div>
148-
</div>
149-
<button class="action-button blue white" @click="downloadFile">
150-
Download
151-
</button>
152-
</div>
143+
</td>
144+
<td>
145+
<button class="action-button" @click="downloadFile">
146+
<Download />
147+
Download file
148+
</button>
149+
</td>
150+
</tbody>
151+
</table>
152+
<div v-if="emptyPathError" class="errors">
153+
<p>File not found</p>
153154
</div>
154155
</div>
155156
</template>
@@ -334,98 +335,91 @@ Component wraps functionality for displaying and working with a single rdfm devi
334335
335336
.download-container {
336337
margin: 2em;
337-
transition: transform 1s;
338338
display: flex;
339339
flex-direction: column;
340340
341-
/* Default state */
342-
.drdn-wrapper {
343-
user-select: none;
344-
position: relative;
345-
display: inline-block;
341+
.file-selector {
342+
width: 520px;
343+
height: 40px;
346344
347-
.caret-up,
348-
.caret-down {
349-
display: inline-block;
350-
}
345+
border-radius: 8px;
346+
border-width: 1px;
347+
border: 1px solid var(--gray-400);
348+
border-collapse: separate;
349+
border-spacing: 0;
351350
352-
.caret-up {
353-
display: none;
351+
td {
352+
padding: 0;
354353
}
355354
356-
.drdn {
357-
display: none;
358-
359-
color: var(--gray-1000);
360-
background-color: var(--gray-100);
361-
border: 2px solid var(--gray-400);
362-
border-radius: 5px;
355+
.icon {
356+
border-right: 1px solid var(--gray-400);
363357
364-
position: absolute;
365-
top: 100%;
366-
width: max-content;
367-
z-index: 100;
368-
369-
padding: 1em;
370-
371-
.entry {
372-
& > p {
373-
margin: 0 0 0.2em 0;
374-
font-size: 0.9em;
375-
}
358+
height: 100%;
359+
display: flex;
360+
justify-content: center;
361+
align-items: center;
362+
363+
& > svg {
364+
fill: var(--gray-900);
365+
width: 20px;
366+
height: 20px;
367+
padding: 8px;
368+
}
369+
}
376370
377-
& > input {
378-
background-color: var(--gray-100);
379-
border: 1px solid var(--gray-400);
380-
border-radius: 5px;
371+
.input {
372+
border-right: 1px solid var(--gray-400);
373+
374+
width: 100%;
375+
height: 100%;
376+
box-sizing: border-box;
377+
background: transparent;
378+
padding: 8px;
379+
380+
input {
381+
height: 100%;
382+
width: 100%;
383+
margin: 0;
384+
padding: 0;
385+
border: none;
386+
box-sizing: border-box;
387+
background: transparent;
388+
}
389+
}
381390
382-
box-sizing: border-box;
383-
padding: 0.9em;
384-
width: 100%;
385-
color: var(--gray-1000);
386-
}
391+
.action-button {
392+
margin: 0px !important;
393+
height: 100%;
394+
width: fit-content;
395+
white-space: nowrap;
396+
border: 0px;
397+
border-radius: 0px 8px 8px 0px;
398+
display: flex;
399+
align-items: center;
400+
text-align: left;
401+
color: var(--gray-900);
402+
background-color: var(--background-100);
387403
388-
&:has(.errors) {
389-
p {
390-
color: var(--destructive-900);
391-
}
392-
}
404+
&:hover {
405+
background-color: var(--gray-200);
406+
color: var(--gray-1000);
393407
394-
div.errors {
395-
p {
396-
color: var(--destructive-900);
397-
margin: 0px;
398-
font-size: 0.75em;
399-
}
408+
svg {
409+
fill: var(--gray-1000);
400410
}
401411
}
402-
}
403412
404-
#main-button {
405-
cursor: pointer;
413+
svg {
414+
margin-right: 10px;
415+
fill: var(--gray-900);
416+
}
406417
}
407418
}
408419
409-
/* Focused state */
410-
.drdn-wrapper:focus-within {
411-
.caret-up {
412-
display: inline-block;
413-
}
414-
415-
.caret-down {
416-
display: none;
417-
}
418-
419-
#main-button {
420-
pointer-events: none;
421-
cursor: pointer;
422-
color: var(--gray-900);
423-
}
424-
425-
.drdn {
426-
display: flex;
427-
flex-direction: column;
428-
row-gap: 0.5em;
420+
.errors {
421+
p {
422+
color: var(--destructive-900);
429423
}
430424
}
431425
}
@@ -549,6 +543,8 @@ import UpdateProgress from '../UpdateProgress.vue';
549543
import Expand from '../icons/Expand.vue';
550544
import Collapse from '../icons/Collapse.vue';
551545
import Cross from '../icons/Cross.vue';
546+
import Download from '../icons/Download.vue';
547+
import File from '../icons/File.vue';
552548
import {
553549
registeredDevicesResources,
554550
groupResources,
@@ -578,6 +574,8 @@ export default {
578574
Expand,
579575
Collapse,
580576
Cross,
577+
Download,
578+
File,
581579
},
582580
unmounted() {
583581
if (this.interval !== null) clearInterval(this.interval);
@@ -786,6 +784,7 @@ export default {
786784
headline: device.value?.name + ' download',
787785
msg: `Failed to download file`,
788786
});
787+
emptyPathError.value = true;
789788
}
790789
};
791790

0 commit comments

Comments
 (0)