Browse code

Update

Benjamin Roth authored on05/02/2026 17:13:25
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,152 @@
1
+import { LitElement, html, css } from 'lit';
2
+
3
+export class WinzerFileCard extends LitElement {
4
+    static properties = {
5
+        file: { type: Object } // { name, date, size, type, isNew }
6
+    };
7
+
8
+    static styles = css`
9
+        :host {
10
+            display: block;
11
+            margin-bottom: 12px;
12
+        }
13
+        .file-card {
14
+            background-color: var(--bg-card); /* Standard: Grau für gelesene Dateien */
15
+            border-radius: var(--radius-sm);
16
+            padding: 12px 16px;
17
+            display: flex;
18
+            align-items: center;
19
+            border: 1px solid var(--border-color);
20
+            box-shadow: var(--shadow-sm);
21
+            position: relative;
22
+        }
23
+
24
+        /* UPDATE: Styling für neue Dateien (Weißer BG + Farbiger Rand) */
25
+        .file-card.has-new {
26
+            background-color: var(--bg-white);
27
+            border-color: var(--primary-color);
28
+        }
29
+
30
+        .icon-container {
31
+            width: 40px;
32
+            height: 40px;
33
+            display: flex;
34
+            align-items: center;
35
+            justify-content: center;
36
+            margin-right: 16px;
37
+            flex-shrink: 0;
38
+        }
39
+        .icon-container svg {
40
+            width: 32px;
41
+            height: 32px;
42
+        }
43
+        .file-info {
44
+            flex: 1;
45
+            min-width: 0; /* Text truncation fix */
46
+        }
47
+        .file-name {
48
+            font-weight: 400; /* UPDATE: Standard nicht fett */
49
+            font-size: 0.9rem;
50
+            color: var(--text-dark);
51
+            margin-bottom: 4px;
52
+            white-space: nowrap;
53
+            overflow: hidden;
54
+            text-overflow: ellipsis;
55
+        }
56
+        /* UPDATE: Fett nur wenn neu */
57
+        .has-new .file-name {
58
+            font-weight: 700;
59
+        }
60
+
61
+        .file-meta {
62
+            font-size: 0.75rem;
63
+            color: var(--text-muted);
64
+        }
65
+        .download-btn {
66
+            width: 36px;
67
+            height: 36px;
68
+            border: 1px solid var(--primary-color);
69
+            border-radius: 8px;
70
+            display: flex;
71
+            align-items: center;
72
+            justify-content: center;
73
+
74
+            /* UPDATE: Standard Button Style (Weiß) */
75
+            background-color: var(--bg-white);
76
+            color: var(--primary-color);
77
+
78
+            cursor: pointer;
79
+            margin-left: 12px;
80
+            flex-shrink: 0;
81
+
82
+            /* UPDATE: Transition angepasst an WinzerCard */
83
+            transition: transform 0.1s, background-color 0.2s;
84
+        }
85
+
86
+        /* UPDATE: Klick-Effekt hinzugefügt (wie bei WinzerCard) */
87
+        .download-btn:active {
88
+            transform: scale(0.95);
89
+        }
90
+
91
+        /* UPDATE: Button Style für neue Dateien (Primärfarbe) */
92
+        .has-new .download-btn {
93
+            background-color: var(--primary-color);
94
+            color: white;
95
+        }
96
+
97
+        .download-btn svg {
98
+            width: 20px;
99
+            height: 20px;
100
+        }
101
+
102
+        /* New Indicator Dot */
103
+        .new-dot {
104
+            position: absolute;
105
+            left: 6px; /* UPDATE: Position angepasst für fixe Ausrichtung */
106
+            top: 50%;
107
+            transform: translateY(-50%);
108
+            width: 6px;
109
+            height: 6px;
110
+            background-color: var(--primary-color);
111
+            border-radius: 50%;
112
+        }
113
+        /* UPDATE: Padding-Shift entfernt, damit Icons ausgerichtet bleiben */
114
+
115
+        /* Type Colors */
116
+        .type-pdf { color: var(--alert-color); }
117
+        .type-doc { color: #2b5797; } /* Word blueish */
118
+        .type-default { color: var(--text-muted); }
119
+    `;
120
+
121
+    _getIcon(type) {
122
+        const t = type.toLowerCase();
123
+        if (t === 'pdf') {
124
+            return html`<svg class="type-pdf" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><path d="M9 15l3 3 3-3"></path><path d="M12 18v-6"></path><text x="6" y="22" font-size="6" font-weight="bold" fill="currentColor" stroke="none">PDF</text></svg>`;
125
+        } else if (t === 'docx' || t === 'doc') {
126
+            return html`<svg class="type-doc" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><line x1="10" y1="9" x2="8" y2="9"></line></svg>`;
127
+        }
128
+        return html`<svg class="type-default" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline></svg>`;
129
+    }
130
+
131
+    render() {
132
+        return html`
133
+            <div class="file-card ${this.file.isNew ? 'has-new' : ''}">
134
+                ${this.file.isNew ? html`<div class="new-dot"></div>` : ''}
135
+
136
+                <div class="icon-container">
137
+                    ${this._getIcon(this.file.type)}
138
+                </div>
139
+
140
+                <div class="file-info">
141
+                    <div class="file-name">${this.file.name}</div>
142
+                    <div class="file-meta">${this.file.date} &nbsp; ${this.file.size}</div>
143
+                </div>
144
+
145
+                <div class="download-btn">
146
+                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>
147
+                </div>
148
+            </div>
149
+        `;
150
+    }
151
+}
152
+customElements.define('winzer-file-card', WinzerFileCard);