|
1 | | -import { LitElement, css, html } from 'https://cdn.jsdelivr.net/npm/lit@3.1.1/+esm' |
| 1 | +import { LitElement, css, html } from 'lit'; |
| 2 | +import { classMap } from 'lit/directives/class-map.js'; |
2 | 3 |
|
3 | | -import "./pill-component.js" |
| 4 | +import "./pill-component.js"; |
4 | 5 |
|
5 | 6 | class CardComponent extends LitElement { |
6 | 7 | static styles = css` |
@@ -107,61 +108,98 @@ class CardComponent extends LitElement { |
107 | 108 | padding: .5rem 1rem; |
108 | 109 | border-radius: calc(.5rem - 2px); |
109 | 110 | border: 0; |
| 111 | + transition: filter .3s linear; |
| 112 | + } |
| 113 | + .card>footer>button>div { |
| 114 | + display: flex; |
| 115 | + align-items: center; |
| 116 | + gap: 16px; |
| 117 | + } |
| 118 | + .card>footer>div { |
| 119 | + display: flex; |
| 120 | + align-items: center; |
| 121 | + gap: 6px; |
| 122 | + } |
| 123 | + .card>footer>div>svg { |
| 124 | + width: 18px; |
| 125 | + height: 18px; |
| 126 | + color: rgb(234 179 8 / 1); |
| 127 | + } |
| 128 | + .card>footer>div>span { |
| 129 | + font-size: .875rem; |
| 130 | + line-height: 1.25rem; |
| 131 | + color:var(--muted-foreground); |
| 132 | + } |
| 133 | + .card>footer>button svg { |
| 134 | + width: 18px; |
| 135 | + height: 18px; |
| 136 | + } |
| 137 | + .card>footer>button:hover{ |
| 138 | + filter: brightness(.9) |
110 | 139 | } |
111 | 140 | ` |
112 | 141 | static properties = { |
113 | | - title: {type: String} |
| 142 | + title: {type: String}, |
| 143 | + description: {type: String}, |
| 144 | + tags: {type: Array}, |
| 145 | + score: {type: Number}, |
| 146 | + difficulty: {type: String}, |
114 | 147 | } |
115 | 148 |
|
116 | 149 | constructor() { |
117 | 150 | super() |
118 | | - this.title = "Hello World!" |
| 151 | + this.title ="" |
| 152 | + this.description = "" |
| 153 | + this.tags = "" |
| 154 | + this.score = 0 |
| 155 | + this.difficulty = "" |
119 | 156 | } |
120 | 157 |
|
121 | 158 | render() { |
| 159 | + const classes = { |
| 160 | + pill: true, |
| 161 | + intermediate: this.difficulty === "intermediate", |
| 162 | + beginner: this.difficulty === "beginner", |
| 163 | + advanced: this.difficulty === "advanced", |
| 164 | + } |
122 | 165 | return html/* html */` |
123 | 166 | <li class="card"> |
124 | 167 | <header> |
125 | | - <h3>Build a Responsive Dashboard</h3> |
| 168 | + <h3>${this.title}</h3> |
126 | 169 | <span> |
127 | | - <span class="advanced pill">Advanced</span> |
| 170 | + <span class="${classMap(classes)}">${this.difficulty}</span> |
128 | 171 | </span> |
129 | 172 | </header> |
130 | 173 | <p> |
131 | | - Create a responsive admin dashboard with charts and data visualization |
| 174 | + ${this.description} |
132 | 175 | </p> |
133 | | -
|
134 | 176 | <ul> |
135 | 177 | ${ |
136 | | - Array.from({length: 3}).map((_,idx) => html`<pill-component text="test-${idx}"></pill-component>`) |
| 178 | + this.tags.map((tag) => html`<pill-component text="${tag}"></pill-component>`) |
137 | 179 | } |
138 | | - <template x-for="t in f.tags"> |
139 | | - <li x-text="t"></li> |
140 | | - </template> |
141 | 180 | </ul> |
142 | 181 | <footer> |
143 | 182 | <div> |
144 | | - <i data-lucide="book"></i> |
| 183 | + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-star"><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/></svg> |
145 | 184 | <span> |
146 | 185 | Popularity: |
147 | | - <span x-text="f.popularity"></span> |
| 186 | + <span>${this.score}</span> |
148 | 187 | </span> |
149 | 188 | </div> |
150 | | - <button> |
| 189 | + <button @click="${this.handleClickViewChallenge}"> |
151 | 190 | <div> |
152 | | - <i data-lucide="code"></i> |
| 191 | + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-code"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg> |
153 | 192 | <span>View Challenge</span> |
154 | 193 | </div> |
155 | | - <i data-lucide="arrow-right"></i> |
| 194 | + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg> |
156 | 195 | </button> |
157 | 196 | </footer> |
158 | 197 | </li> |
159 | 198 | ` |
160 | 199 | } |
161 | 200 |
|
162 | | - |
163 | | - changeTitle() { |
164 | | - this.title = 'Lit'; |
| 201 | + handleClickViewChallenge() { |
| 202 | + console.log("clicou") |
165 | 203 | } |
166 | 204 | } |
167 | 205 |
|
|
0 commit comments