| ... | ... |
@@ -1,7 +1,14 @@ |
| 1 | 1 |
import { LitElement, html, css } from 'lit';
|
| 2 | 2 |
|
| 3 | 3 |
export class WinzerCard extends LitElement {
|
| 4 |
- static properties = { category: { type: String }, date: { type: String }, title: { type: String }, text: { type: String }, hasAttachment: { type: Boolean }, featured: { type: Boolean } };
|
|
| 4 |
+ static properties = {
|
|
| 5 |
+ category: { type: String },
|
|
| 6 |
+ date: { type: String },
|
|
| 7 |
+ title: { type: String },
|
|
| 8 |
+ text: { type: String },
|
|
| 9 |
+ hasAttachment: { type: Boolean },
|
|
| 10 |
+ featured: { type: Boolean }
|
|
| 11 |
+ }; |
|
| 5 | 12 |
static styles = css` |
| 6 | 13 |
:host { display: block; margin-bottom: 35px; }
|
| 7 | 14 |
.card { background-color: var(--bg-card); border-radius: var(--radius-card); padding: 20px 20px 40px 20px; position: relative; color: var(--text-main); display: block; }
|
| ... | ... |
@@ -13,9 +20,30 @@ export class WinzerCard extends LitElement {
|
| 13 | 20 |
.action-btn { position: absolute; bottom: -20px; right: 20px; background-color: var(--primary-color); color: var(--bg-white); width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md); cursor: pointer; transition: transform 0.1s; z-index: 10; }
|
| 14 | 21 |
.action-btn:active { transform: scale(0.95); }
|
| 15 | 22 |
svg { width: 24px; height: 24px; fill: currentColor; }
|
| 23 |
+ |
|
| 24 |
+ /* Slot for tags */ |
|
| 25 |
+ .tags-container {
|
|
| 26 |
+ display: flex; |
|
| 27 |
+ gap: 8px; |
|
| 28 |
+ margin-top: 12px; |
|
| 29 |
+ flex-wrap: wrap; |
|
| 30 |
+ } |
|
| 16 | 31 |
`; |
| 17 | 32 |
render() {
|
| 18 |
- return html`<div class="card ${this.featured ? 'featured' : ''}"><div class="header"><span>${this.category}</span><span>${this.date}</span></div><h3>${this.title}</h3><p>${this.text}</p>${this.hasAttachment ? html`<div class="attachment-icon"><svg viewBox="0 0 24 24"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/></svg></div>` : ''}<div class="action-btn"><svg viewBox="0 0 24 24"><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg></div></div>`;
|
|
| 33 |
+ return html` |
|
| 34 |
+ <div class="card ${this.featured ? 'featured' : ''}">
|
|
| 35 |
+ <div class="header"><span>${this.category}</span><span>${this.date}</span></div>
|
|
| 36 |
+ <h3>${this.title}</h3>
|
|
| 37 |
+ <p>${this.text}</p>
|
|
| 38 |
+ |
|
| 39 |
+ <div class="tags-container"> |
|
| 40 |
+ <slot name="tags"></slot> |
|
| 41 |
+ </div> |
|
| 42 |
+ |
|
| 43 |
+ ${this.hasAttachment ? html`<div class="attachment-icon"><svg viewBox="0 0 24 24"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/></svg></div>` : ''}
|
|
| 44 |
+ <div class="action-btn"><svg viewBox="0 0 24 24"><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg></div> |
|
| 45 |
+ </div> |
|
| 46 |
+ `; |
|
| 19 | 47 |
} |
| 20 | 48 |
} |
| 21 | 49 |
customElements.define('winzer-card', WinzerCard);
|
| ... | ... |
@@ -1,10 +1,11 @@ |
| 1 | 1 |
import { LitElement, html, css } from 'lit';
|
| 2 | 2 |
|
| 3 | 3 |
export class WinzerCard extends LitElement {
|
| 4 |
- static properties = { category: { type: String }, date: { type: String }, title: { type: String }, text: { type: String }, hasAttachment: { type: Boolean } };
|
|
| 4 |
+ static properties = { category: { type: String }, date: { type: String }, title: { type: String }, text: { type: String }, hasAttachment: { type: Boolean }, featured: { type: Boolean } };
|
|
| 5 | 5 |
static styles = css` |
| 6 | 6 |
:host { display: block; margin-bottom: 35px; }
|
| 7 | 7 |
.card { background-color: var(--bg-card); border-radius: var(--radius-card); padding: 20px 20px 40px 20px; position: relative; color: var(--text-main); display: block; }
|
| 8 |
+ .card.featured { border: 1px solid var(--primary-color); background-color: var(--primary-light); }
|
|
| 8 | 9 |
.header { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
|
| 9 | 10 |
h3 { color: var(--primary-color); margin: 0 0 8px 0; font-size: 1.1rem; font-weight: 600; }
|
| 10 | 11 |
p { margin: 0; font-size: 0.95rem; line-height: 1.4; color: var(--text-dark); padding-right: 25px; }
|
| ... | ... |
@@ -14,7 +15,7 @@ export class WinzerCard extends LitElement {
|
| 14 | 15 |
svg { width: 24px; height: 24px; fill: currentColor; }
|
| 15 | 16 |
`; |
| 16 | 17 |
render() {
|
| 17 |
- return html`<div class="card"><div class="header"><span>${this.category}</span><span>${this.date}</span></div><h3>${this.title}</h3><p>${this.text}</p>${this.hasAttachment ? html`<div class="attachment-icon"><svg viewBox="0 0 24 24"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/></svg></div>` : ''}<div class="action-btn"><svg viewBox="0 0 24 24"><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg></div></div>`;
|
|
| 18 |
+ return html`<div class="card ${this.featured ? 'featured' : ''}"><div class="header"><span>${this.category}</span><span>${this.date}</span></div><h3>${this.title}</h3><p>${this.text}</p>${this.hasAttachment ? html`<div class="attachment-icon"><svg viewBox="0 0 24 24"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/></svg></div>` : ''}<div class="action-btn"><svg viewBox="0 0 24 24"><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg></div></div>`;
|
|
| 18 | 19 |
} |
| 19 | 20 |
} |
| 20 | 21 |
customElements.define('winzer-card', WinzerCard);
|
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,20 @@ |
| 1 |
+import { LitElement, html, css } from 'lit';
|
|
| 2 |
+ |
|
| 3 |
+export class WinzerCard extends LitElement {
|
|
| 4 |
+ static properties = { category: { type: String }, date: { type: String }, title: { type: String }, text: { type: String }, hasAttachment: { type: Boolean } };
|
|
| 5 |
+ static styles = css` |
|
| 6 |
+ :host { display: block; margin-bottom: 35px; }
|
|
| 7 |
+ .card { background-color: var(--bg-card); border-radius: var(--radius-card); padding: 20px 20px 40px 20px; position: relative; color: var(--text-main); display: block; }
|
|
| 8 |
+ .header { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
|
|
| 9 |
+ h3 { color: var(--primary-color); margin: 0 0 8px 0; font-size: 1.1rem; font-weight: 600; }
|
|
| 10 |
+ p { margin: 0; font-size: 0.95rem; line-height: 1.4; color: var(--text-dark); padding-right: 25px; }
|
|
| 11 |
+ .attachment-icon { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: var(--primary-color); }
|
|
| 12 |
+ .action-btn { position: absolute; bottom: -20px; right: 20px; background-color: var(--primary-color); color: var(--bg-white); width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md); cursor: pointer; transition: transform 0.1s; z-index: 10; }
|
|
| 13 |
+ .action-btn:active { transform: scale(0.95); }
|
|
| 14 |
+ svg { width: 24px; height: 24px; fill: currentColor; }
|
|
| 15 |
+ `; |
|
| 16 |
+ render() {
|
|
| 17 |
+ return html`<div class="card"><div class="header"><span>${this.category}</span><span>${this.date}</span></div><h3>${this.title}</h3><p>${this.text}</p>${this.hasAttachment ? html`<div class="attachment-icon"><svg viewBox="0 0 24 24"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/></svg></div>` : ''}<div class="action-btn"><svg viewBox="0 0 24 24"><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg></div></div>`;
|
|
| 18 |
+ } |
|
| 19 |
+} |
|
| 20 |
+customElements.define('winzer-card', WinzerCard);
|